U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ravi Babu <ravibabu@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH v1 1/6] spl: dfu: add dfu support in SPL
Date: Tue, 14 Jun 2016 16:32:19 +0530	[thread overview]
Message-ID: <1465902144-30934-2-git-send-email-ravibabu@ti.com> (raw)
In-Reply-To: <1465902144-30934-1-git-send-email-ravibabu@ti.com>

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 has
only USB inteface and do not have external interface
like ethernet or MMC/SD to boot the board.

This patch add DFU support in SPL 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 <ravibabu@ti.com>
---
 Kconfig              |   33 +++++++++++++++++++++++++++++++++
 common/Makefile      |   26 +++++++++++++++++++-------
 common/command.c     |    2 +-
 scripts/Makefile.spl |   13 +++++++++++++
 4 files changed, 66 insertions(+), 8 deletions(-)

diff --git a/Kconfig b/Kconfig
index f53759a..969641e 100644
--- a/Kconfig
+++ b/Kconfig
@@ -285,6 +285,39 @@ config SPL_LOAD_FIT
 	  particular it can handle selecting from multiple device tree
 	  and passing the correct one to U-Boot.
 
+config SPL_DFU
+	bool "Enable SPL with DFU to load binaries to bootdevices using USB"
+	depends on USB && CMD_DFU && TARGET_DRA7XX_EVM
+	help
+	  Currently the SPL does not have capability to load the
+	  binaries or boot images to boot devices like eMMC,SPI,etc.
+	  This feature enables the DFU (Device Firmware Upgarde) in SPL with
+	  RAM device as default bootdevice. The ROM code will load and execute
+	  the SPL/MLO dfu image. The user can flash the binaries to selected
+	  dfu 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 CMD_DFU && SPL_DFU
+
+config SPL_DFU_RAM
+	bool "RAM device"
+	depends on CMD_DFU
+	help
+	 select DDR memory device for flashing binary images to
+	 the selected partition using DFU.
+
+config SPL_DFU_SF
+	bool "SPI device"
+	depends on CMD_DFU && SPL_DFU
+	help
+	 select SPI flash memory device for flashing binary images to
+	 the selected partition using DFU.
+
+endchoice
+
 config SYS_CLK_FREQ
 	depends on ARC || ARCH_SUNXI
 	int "CPU clock frequency"
diff --git a/common/Makefile b/common/Makefile
index b23f312..0fa441f 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -6,15 +6,30 @@
 #
 
 # core
-ifndef CONFIG_SPL_BUILD
-obj-y += init/
-obj-y += main.o
-obj-y += exports.o
+
+CONFIG_INC_DFU=y
+ifdef CONFIG_SPL_BUILD
+ifndef CONFIG_SPL_DFU
+CONFIG_INC_DFU=n
+endif
+endif
+
+ifeq ($(CONFIG_INC_DFU),y)
 obj-y += hash.o
 ifdef CONFIG_SYS_HUSH_PARSER
 obj-y += cli_hush.o
 endif
 
+obj-y += env_attr.o
+obj-y += env_callback.o
+obj-y += env_flags.o
+endif
+
+ifndef CONFIG_SPL_BUILD
+obj-y += init/
+obj-y += main.o
+obj-y += exports.o
+
 # This option is not just y/n - it can have a numeric value
 ifdef CONFIG_BOOTDELAY
 obj-y += autoboot.o
@@ -34,9 +49,6 @@ obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o
 
 # environment
-obj-y += env_attr.o
-obj-y += env_callback.o
-obj-y += env_flags.o
 obj-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
 obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
 extra-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.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 ec8d8f1..be74991 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -35,6 +35,13 @@ else
 SPL_BIN := u-boot-spl
 endif
 
+CONFIG_INC_DFU=y
+ifdef CONFIG_SPL_BUILD
+ifndef CONFIG_SPL_DFU
+CONFIG_INC_DFU=n
+endif
+endif
+
 include $(srctree)/config.mk
 include $(srctree)/arch/$(ARCH)/Makefile
 
@@ -56,6 +63,12 @@ libs-y += common/init/
 libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/
 libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
 libs-y += drivers/
+ifeq ($(CONFIG_INC_DFU),y)
+libs-y += drivers/dfu/
+libs-y += drivers/usb/gadget/
+libs-y += drivers/usb/gadget/udc/
+libs-y += drivers/usb/dwc3/
+endif
 libs-y += dts/
 libs-y += fs/
 libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
-- 
1.7.9.5

  reply	other threads:[~2016-06-14 11:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14 11:02 [U-Boot] [RFC PATCH v1 0/6] SPL: DFU Support in SPL Ravi Babu
2016-06-14 11:02 ` Ravi Babu [this message]
2016-06-24  8:50   ` [U-Boot] [RFC PATCH v1 1/6] spl: dfu: add dfu support " Lukasz Majewski
2016-06-24  8:54     ` B, Ravi
2016-06-14 11:02 ` [U-Boot] [RFC PATCH v1 2/6] spl: dfu: adding dfu support functions for SPL-DFU Ravi Babu
2016-06-24  9:00   ` Lukasz Majewski
2016-06-24  9:02     ` B, Ravi
2016-06-14 11:02 ` [U-Boot] [RFC PATCH v1 3/6] dfu: spl: add generic spl-dfu function in common-spl Ravi Babu
2016-06-24  9:01   ` Lukasz Majewski
2016-06-14 11:02 ` [U-Boot] [RFC PATCH v1 4/6] dra7x: spl: dfu: adding SPL-DFU support for dra7x platform Ravi Babu
2016-06-24  9:10   ` Lukasz Majewski
2016-06-24  9:27     ` B, Ravi
2016-06-14 11:02 ` [U-Boot] [RFC PATCH v1 5/6] dfu: spl: dra7x: enable SPL-dfu " Ravi Babu
2016-06-24  9:12   ` Lukasz Majewski
2016-06-24  9:21     ` B, Ravi
2016-06-14 11:02 ` [U-Boot] [RFC PATCH v1 6/6] dfu: spl: am335x: SPL-DFU support for am335x Ravi Babu
2016-06-24  9:15   ` Lukasz Majewski
2016-06-24  9:29     ` B, Ravi
2016-06-21  8:39 ` [U-Boot] [RFC PATCH v1 0/6] SPL: DFU Support in SPL B, Ravi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465902144-30934-2-git-send-email-ravibabu@ti.com \
    --to=ravibabu@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox