Skip to content
Snippets Groups Projects
Commit 2f005695 authored by Stefan Agner's avatar Stefan Agner Committed by Stefano Babic
Browse files

cmd: add sdp command


Add a new command to start USB Serial Download Protocol (SDP)
state machine.

Signed-off-by: default avatarStefan Agner <stefan.agner@toradex.com>
Reviewed-by: default avatarŁukasz Majewski <lukma@denx.de>
Reviewed-by: default avatarStefano Babic <sbabic@denx.de>
parent ccd7a4d2
No related branches found
No related tags found
No related merge requests found
...@@ -895,6 +895,13 @@ config CMD_USB ...@@ -895,6 +895,13 @@ config CMD_USB
help help
USB support. USB support.
config CMD_USB_SDP
bool "sdp"
select USB_FUNCTION_SDP
help
Enables the command "sdp" which is used to have U-Boot emulating the
Serial Download Protocol (SDP) via USB.
config CMD_USB_MASS_STORAGE config CMD_USB_MASS_STORAGE
bool "UMS usb mass storage" bool "UMS usb mass storage"
help help
......
...@@ -132,6 +132,7 @@ obj-$(CONFIG_CMD_FASTBOOT) += fastboot.o ...@@ -132,6 +132,7 @@ obj-$(CONFIG_CMD_FASTBOOT) += fastboot.o
obj-$(CONFIG_CMD_FS_UUID) += fs_uuid.o obj-$(CONFIG_CMD_FS_UUID) += fs_uuid.o
obj-$(CONFIG_CMD_USB_MASS_STORAGE) += usb_mass_storage.o obj-$(CONFIG_CMD_USB_MASS_STORAGE) += usb_mass_storage.o
obj-$(CONFIG_CMD_USB_SDP) += usb_gadget_sdp.o
obj-$(CONFIG_CMD_THOR_DOWNLOAD) += thordown.o obj-$(CONFIG_CMD_THOR_DOWNLOAD) += thordown.o
obj-$(CONFIG_CMD_XIMG) += ximg.o obj-$(CONFIG_CMD_XIMG) += ximg.o
obj-$(CONFIG_CMD_YAFFS2) += yaffs2.o obj-$(CONFIG_CMD_YAFFS2) += yaffs2.o
......
/*
* cmd_sdp.c -- sdp command
*
* Copyright (C) 2016 Toradex
* Author: Stefan Agner <stefan.agner@toradex.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#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);
board_usb_init(controller_index, USB_INIT_DEVICE);
g_dnl_clear_detach();
g_dnl_register("usb_dnl_sdp");
ret = sdp_init(controller_index);
if (ret) {
error("SDP init failed: %d", ret);
goto exit;
}
/* This command typically does not return but jumps to an image */
sdp_handle(controller_index);
error("SDP ended");
exit:
g_dnl_unregister();
board_usb_cleanup(controller_index, USB_INIT_DEVICE);
return ret;
}
U_BOOT_CMD(sdp, 2, 1, do_sdp,
"Serial Downloader Protocol",
"<USB_controller>\n"
" - serial downloader protocol via <USB_controller>\n"
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment