1 // SPDX-License-Identifier: GPL-2.0+
3 * cmd_sdp.c -- sdp command
5 * Copyright (C) 2016 Toradex
6 * Author: Stefan Agner <stefan.agner@toradex.com>
15 static int do_sdp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
22 char *usb_controller = argv[1];
23 int controller_index = simple_strtoul(usb_controller, NULL, 0);
24 usb_gadget_initialize(controller_index);
27 ret = g_dnl_register("usb_dnl_sdp");
29 pr_err("SDP dnl register failed: %d\n", ret);
33 ret = sdp_init(controller_index);
35 pr_err("SDP init failed: %d\n", ret);
39 /* This command typically does not return but jumps to an image */
40 sdp_handle(controller_index);
41 pr_err("SDP ended\n");
46 usb_gadget_release(controller_index);
48 return CMD_RET_FAILURE;
51 U_BOOT_CMD(sdp, 2, 1, do_sdp,
52 "Serial Downloader Protocol",
54 " - serial downloader protocol via <USB_controller>\n"