[U-Boot] [RFC PATCH v1 1/6] spl: dfu: add dfu support in SPL
Lukasz Majewski
l.majewski at samsung.com
Fri Jun 24 10:50:26 CEST 2016
Hi Ravi,
> 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 at 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
Is this dependency correct? Especially the CONFIG_CMD_DFU? As fair as I
remember, we don't need "dfu" command to make SPL dfu working.
What we do need are
CONFIG_USB_GADGET_DOWNLOAD,CONFIG_USB_FUNCTION_THOR,
CONFIG_USB_FUNCTION_DFU, etc.
> + 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/
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
More information about the U-Boot
mailing list