Traditionally the DFU support is available only
as part 2nd stage boot loader(u-boot) and DFU
is not supported in SPL.

The SPL-DFU feature is useful for boards which
does not have MMC/SD, ethernet boot mechanism
to boot the board and only has USB inteface.

This patch add DFU support in SPL with RAM
memory device support to load and execute u-boot.
And then leverage full functionality DFU in
u-boot to flash boot inital binary images to
factory or bare-metal boards to memory devices
like SPI, eMMC, MMC/SD card using USB interface.

This SPL-DFU support can be enabled through
Menuconfig->Boot Images->Enable SPL-DFU support

Signed-off-by: Ravi Babu <ravib...@ti.com>
---
 Kconfig              |   27 +++++++++++++++++++++++++++
 common/Makefile      |    1 +
 common/command.c     |    2 +-
 scripts/Makefile.spl |    4 ++++
 4 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/Kconfig b/Kconfig
index ef12f9f..ed3e295 100644
--- a/Kconfig
+++ b/Kconfig
@@ -336,6 +336,33 @@ config SPL_FIT_IMAGE_POST_PROCESS
          injected into the FIT creation (i.e. the blobs would have been pre-
          processed before being added to the FIT image).
 
+config SPL_DFU_SUPPORT
+       bool "Enable SPL with DFU to load binaries to memory device"
+       depends on USB && TARGET_DRA7XX_EVM
+       help
+         Currently the SPL does not have capability to load the
+         binaries or boot images to boot devices like ram,eMMC,SPI,etc.
+         This feature enables the DFU (Device Firmware Upgarde) in SPL with
+         RAM memory device support. The ROM code will load and execute
+         the SPL built with dfu. The user can load binaries (u-boot/kernel) to
+         selected device partition from host-pc using dfu-utils.
+               This feature will be useful to flash the binaries to factory
+         or bare-metal boards using USB interface.
+
+choice
+       bool "DFU device selection"
+       depends on SPL_DFU_SUPPORT
+
+config SPL_DFU_RAM
+       bool "RAM device"
+       depends on SPL_DFU_SUPPORT
+       help
+        select RAM/DDR memory device for loading binary images
+        (u-boot/kernel) to the selected device partition using
+        DFU and execute the u-boot/kernel from RAM.
+
+endchoice
+
 config SYS_CLK_FREQ
        depends on ARC || ARCH_SUNXI
        int "CPU clock frequency"
diff --git a/common/Makefile b/common/Makefile
index e08cd3e..7a7a1b4 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -87,6 +87,7 @@ obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
 endif # !CONFIG_SPL_BUILD
 
 ifdef CONFIG_SPL_BUILD
+obj-$(CONFIG_SPL_DFU_SUPPORT) += cli_hush.o
 obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o
 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o
diff --git a/common/command.c b/common/command.c
index e5d9b9c..d1c049c 100644
--- a/common/command.c
+++ b/common/command.c
@@ -520,7 +520,7 @@ enum command_ret_t cmd_process(int flag, int argc, char * 
const argv[],
        if (argc > cmdtp->maxargs)
                rc = CMD_RET_USAGE;
 
-#if defined(CONFIG_CMD_BOOTD)
+#if defined(CONFIG_CMD_BOOTD) && !defined(CONFIG_SPL_BUILD)
        /* avoid "bootd" recursion */
        else if (cmdtp->cmd == do_bootd) {
                if (flag & CMD_FLAG_BOOTD) {
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 3ba9742..3b70c4d 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -57,6 +57,10 @@ libs-y += common/init/
 libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/
 libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
 libs-y += drivers/
+libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/dfu/
+libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/gadget/
+libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/gadget/udc/
+libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/dwc3/
 libs-y += dts/
 libs-y += fs/
 libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
-- 
1.7.9.5

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to