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>
14 static int do_sdp(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
21 char *usb_controller
= argv
[1];
22 int controller_index
= simple_strtoul(usb_controller
, NULL
, 0);
23 usb_gadget_initialize(controller_index
);
26 ret
= g_dnl_register("usb_dnl_sdp");
28 pr_err("SDP dnl register failed: %d\n", ret
);
32 ret
= sdp_init(controller_index
);
34 pr_err("SDP init failed: %d\n", ret
);
38 /* This command typically does not return but jumps to an image */
39 sdp_handle(controller_index
);
40 pr_err("SDP ended\n");
45 usb_gadget_release(controller_index
);
47 return CMD_RET_FAILURE
;
50 U_BOOT_CMD(sdp
, 2, 1, do_sdp
,
51 "Serial Downloader Protocol",
53 " - serial downloader protocol via <USB_controller>\n"