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[])
16 int ret = CMD_RET_FAILURE;
21 char *usb_controller = argv[1];
22 int controller_index = simple_strtoul(usb_controller, NULL, 0);
23 usb_gadget_initialize(controller_index);
26 g_dnl_register("usb_dnl_sdp");
28 ret = sdp_init(controller_index);
30 pr_err("SDP init failed: %d\n", ret);
34 /* This command typically does not return but jumps to an image */
35 sdp_handle(controller_index);
36 pr_err("SDP ended\n");
40 usb_gadget_release(controller_index);
45 U_BOOT_CMD(sdp, 2, 1, do_sdp,
46 "Serial Downloader Protocol",
48 " - serial downloader protocol via <USB_controller>\n"