Blame view
cmd/usb_gadget_sdp.c
1.01 KB
83d290c56
|
1 |
// SPDX-License-Identifier: GPL-2.0+ |
2f005695d
|
2 3 4 5 6 |
/* * cmd_sdp.c -- sdp command * * Copyright (C) 2016 Toradex * Author: Stefan Agner <stefan.agner@toradex.com> |
2f005695d
|
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
*/ #include <common.h> #include <g_dnl.h> #include <sdp.h> #include <usb.h> static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int ret = CMD_RET_FAILURE; if (argc < 2) return CMD_RET_USAGE; char *usb_controller = argv[1]; int controller_index = simple_strtoul(usb_controller, NULL, 0); |
a06955ae1
|
23 |
usb_gadget_initialize(controller_index); |
2f005695d
|
24 25 26 27 28 29 |
g_dnl_clear_detach(); g_dnl_register("usb_dnl_sdp"); ret = sdp_init(controller_index); if (ret) { |
24ccd0c8f
|
30 31 |
pr_err("SDP init failed: %d ", ret); |
2f005695d
|
32 33 34 35 36 |
goto exit; } /* This command typically does not return but jumps to an image */ sdp_handle(controller_index); |
24ccd0c8f
|
37 38 |
pr_err("SDP ended "); |
2f005695d
|
39 40 41 |
exit: g_dnl_unregister(); |
a06955ae1
|
42 |
usb_gadget_release(controller_index); |
2f005695d
|
43 44 45 46 47 48 49 50 51 52 53 |
return ret; } U_BOOT_CMD(sdp, 2, 1, do_sdp, "Serial Downloader Protocol", "<USB_controller> " " - serial downloader protocol via <USB_controller> " ); |