summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-09-01 10:40:59 -0400
committerTom Rini <trini@konsulko.com>2017-09-01 10:40:59 -0400
commit6aee2ab68c362ace5a59f89a63abed82e0bf19e5 (patch)
tree0b76045a178e9c0ed61e141bd8dfb3e34e4e86a9 /cmd
parent4109d702934c361b2ae2a5ad34f4dfee708cc214 (diff)
parent63af4b0ad0666e0797306593813b6272e1995bde (diff)
Merge git://git.denx.de/u-boot-imx
Signed-off-by: Tom Rini <trini@konsulko.com> Conflicts: configs/imx6qdl_icore_mmc_defconfig configs/imx6qdl_icore_rqs_defconfig
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig7
-rw-r--r--cmd/Makefile1
-rw-r--r--cmd/usb_gadget_sdp.c50
3 files changed, 58 insertions, 0 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 42d955c96a..d6d130edfa 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -895,6 +895,13 @@ config CMD_USB
help
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
bool "UMS usb mass storage"
help
diff --git a/cmd/Makefile b/cmd/Makefile
index 4a865bd7d7..2a5b8ce825 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -132,6 +132,7 @@ obj-$(CONFIG_CMD_FASTBOOT) += fastboot.o
obj-$(CONFIG_CMD_FS_UUID) += fs_uuid.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_XIMG) += ximg.o
obj-$(CONFIG_CMD_YAFFS2) += yaffs2.o
diff --git a/cmd/usb_gadget_sdp.c b/cmd/usb_gadget_sdp.c
new file mode 100644
index 0000000000..b1d8b2858e
--- /dev/null
+++ b/cmd/usb_gadget_sdp.c
@@ -0,0 +1,50 @@
+/*
+ * 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"
+);