SPL: DFU Support in SPL
Subsystems (2)
v2 cover SPL: DFU Support in SPL
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 from PC over USB interface. And then leverage full functional feature of 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.
As a reference, refer to application note [3] on SPL-DFU support based on 2014.07 u-boot.
Steps to build SPL-DFU/RAM:
This SPL-DFU support can be enabled through Menuconfig->Boot Images->Enable SPL-DFU support
1) Soc ROMcode loads the u-boot-spl.bin(+DFU) to IRAM from PC host via usb interface and execute DFU.
2) Then load u-boot.img to RAM using dfu-util from PC-host with -R switch to boot u-boot.
#sudo dfu-util -c 1 -i 0 -a 0 -D u-boot.img -R
Note:
On latest u-boot usb fails, need patch [4] to test dfu.
Tested on dra7xx SoCs family.
[1] is EVM console output with SPL-DFU/RAM enabled.
[2] is ubuntu host console output.
references:
[1] http://pastebin.ubuntu.com/20312940/
[2] http://pastebin.ubuntu.com/20313150/
[3] http://www.ti.com/lit/an/sprac33/sprac33.pdf
[4] https://patchwork.ozlabs.org/patch/651146/
v1 changes :
- support for DFU RAM device only .
- removed support for other SPI flash devices
- SPL+DFU loads and execute u-boot and leaverage u-boot dfu functionality to flash binaries to SPI, eMMC etc.
- saperated the common dfu code used by SPL and u-boot to common/dfu.c
Ravi Babu (5):
spl: dfu: add dfu support in SPL
common: dfu: saperate the dfu common functionality
spl: dfu: adding dfu support functions for SPL-DFU
dra7x: boot: add dfu bootmode support
dra7x: configs: enable SPL-DFU support
Kconfig | 27 ++++++++ arch/arm/cpu/armv7/omap-common/boot-common.c | 5 ++ arch/arm/include/asm/arch-omap5/spl.h | 2 +- cmd/dfu.c | 61 +----------------- common/Makefile | 3 + common/command.c | 2 +- common/dfu.c | 88 ++++++++++++++++++++++++++ common/spl/Makefile | 1 + common/spl/spl.c | 10 ++- common/spl/spl_dfu.c | 57 +++++++++++++++++ include/configs/dra7xx_evm.h | 19 +++++- include/configs/ti_omap5_common.h | 2 - include/g_dnl.h | 1 + include/spl.h | 8 +++ scripts/Makefile.spl | 4 ++ 15 files changed, 225 insertions(+), 65 deletions(-) create mode 100644 common/dfu.c create mode 100644 common/spl/spl_dfu.c
Signature · 1 line
1.7.9.5
RFC PATCH v2 1/5 spl: dfu: add dfu support in SPL
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
--- Kconfig | 27 +++++++++++++++++++++++++++ common/Makefile | 1 + common/command.c | 2 +- scripts/Makefile.spl | 4 ++++ 4 files changed, 33 insertions(+), 1 deletion(-)
Kconfig +27 -0
@@ -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"
common/Makefile +1 -0
@@ -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
common/command.c +1 -1
@@ -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 ) {
scripts/Makefile.spl +4 -0
@@ -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/
Signature · 1 line
1.7.9.5
RFC PATCH v2 2/5 common: dfu: saperate the dfu common functionality
In reply to Ravi BabuThe cmd_dfu functionality is been used by both SPL and u-boot, saperating the core dfu functionality moving it to common/dfu.c.
--- cmd/dfu.c | 61 ++------------------------------------ common/Makefile | 2 ++ common/dfu.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/g_dnl.h | 1 + 4 files changed, 93 insertions(+), 59 deletions(-) create mode 100644 common/dfu.c
cmd/dfu.c +2 -59
@@ -21,7 +21,6 @@static int do_dfu (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { -bool dfu_reset = false;if (argc <4 )return CMD_RET_USAGE ;
@@ -30,7 +29,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])char *interface = argv[2 ];char *devstring = argv[3 ]; -int ret, i =0 ; +int ret;#ifdef CONFIG_DFU_TFTP unsigned long addr =0 ;if (!strcmp (argv[1 ],"tftp" )) {
@@ -52,67 +51,11 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) }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_dfu" ); -while (1 ) { -if (g_dnl_detach ()) { -/* -* Check if USB bus reset is performed after detach, -* which indicates that -R switch has been passed to -* dfu-util. In this case reboot the device -*/ -if (dfu_usb_get_reset ()) { - dfu_reset = true; - goto exit; - } -/* -* This extra number of usb_gadget_handle_interrupts() -* calls is necessary to assure correct transmission -* completion with dfu-util -*/ -if (++i ==10000 ) - goto exit; - } +run_usb_dnl_gadget (controller_index,"usb_dnl_dfu" ); -if (ctrlc ()) - goto exit; - -if (dfu_get_defer_flush ()) { -/* -* Call to usb_gadget_handle_interrupts() is necessary -* to act on ZLP OUT transaction from HOST PC after -* transmitting the whole file. -* -* If this ZLP OUT packet is NAK'ed, the HOST libusb -* function fails after timeout (by default it is set to -* 5 seconds). In such situation the dfu-util program -* exits with error message. -*/ -usb_gadget_handle_interrupts (controller_index); - ret =dfu_flush (dfu_get_defer_flush (),NULL ,0 ,0 ); -dfu_set_defer_flush (NULL ); -if (ret) { -error ("Deferred dfu_flush() failed!" ); - goto exit; - } - } - -WATCHDOG_RESET (); -usb_gadget_handle_interrupts (controller_index); - } -exit: -g_dnl_unregister (); -board_usb_cleanup (controller_index,USB_INIT_DEVICE ); done:dfu_free_entities (); - -if (dfu_reset) -run_command ("reset" ,0 ); - -g_dnl_clear_detach (); -return ret; }
common/Makefile +2 -0
@@ -87,6 +87,7 @@ obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o endif # !CONFIG_SPL_BUILD ifdef CONFIG_SPL_BUILD +obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu.o obj-$(CONFIG_SPL_DFU_SUPPORT) += cli_hush.o obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
@@ -160,6 +161,7 @@ obj-$(CONFIG_CMDLINE) += cli_simple.o obj-y += cli.o obj-$(CONFIG_CMDLINE) += cli_readline.o +obj-$(CONFIG_CMD_DFU) += dfu.o obj-y += command.o obj-y += s_record.o obj-y += xyzModem.o
common/dfu.c new file +88 -0
88 lines not on this page · raw message
include/g_dnl.h +1 -0
@@ -43,5 +43,6 @@ void g_dnl_set_serialnumber(char *);bool g_dnl_detach (void );void g_dnl_trigger_detach (void );void g_dnl_clear_detach (void ); +int run_usb_dnl_gadget (int usbctrl_index,char *usb_dnl_gadget);#endif /* __G_DOWNLOAD_H_ */
Signature · 1 line
1.7.9.5
RFC PATCH v2 3/5 spl: dfu: adding dfu support functions for SPL-DFU
In reply to Ravi BabuAdding support functions to run dfu spl commands.
--- common/spl/Makefile | 1 + common/spl/spl_dfu.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/spl.h | 8 +++++++ 3 files changed, 66 insertions(+) create mode 100644 common/spl/spl_dfu.c
common/spl/Makefile +1 -0
@@ -21,4 +21,5 @@ obj-$(CONFIG_SPL_USB_SUPPORT) += spl_usb.o obj-$(CONFIG_SPL_FAT_SUPPORT) += spl_fat.o obj-$(CONFIG_SPL_EXT_SUPPORT) += spl_ext.o obj-$(CONFIG_SPL_SATA_SUPPORT) += spl_sata.o +obj-$(CONFIG_SPL_DFU_SUPPORT) += spl_dfu.o endif
common/spl/spl_dfu.c new file +57 -0
57 lines not on this page · raw message
include/spl.h +8 -0
@@ -140,4 +140,12 @@ void spl_board_init(void);*/ bool spl_was_boot_source (void ); +/** +* spl_dfu_cmd- run dfu command with chosen mmc device interface +* @param usb_index - usb controller number +* @param mmc_dev - mmc device nubmer +* +* @return 0 on success, otherwise error code +*/ +int spl_dfu_cmd (int usbctrl,char *dfu_alt_info,char *interface,char *devstr);#endif
Signature · 1 line
1.7.9.5
RFC PATCH v2 4/5 dra7x: boot: add dfu bootmode support
In reply to Ravi BabuThis patch enables the DFU boot mode support
for dra7x platform.
--- arch/arm/cpu/armv7/omap-common/boot-common.c | 5 +++++ arch/arm/include/asm/arch-omap5/spl.h | 2 +- common/spl/spl.c | 10 +++++++++- 3 files changed, 15 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/omap-common/boot-common.c +5 -0
@@ -91,6 +91,11 @@ void save_omap_boot_params(void) sys_boot_device =1 ;break ;#endif +#if defined(BOOT_DEVICE_DFU ) && !defined(CONFIG_SPL_DFU_SUPPORT ) +case BOOT_DEVICE_DFU : + sys_boot_device =1 ; +break ; +#endif }if (sys_boot_device) {
arch/arm/include/asm/arch-omap5/spl.h +1 -1
@@ -20,7 +20,7 @@#define BOOT_DEVICE_QSPI_1 0x0A#define BOOT_DEVICE_QSPI_4 0x0B#define BOOT_DEVICE_UART 0x43 -#define BOOT_DEVICE_USB 0x45 +#define BOOT_DEVICE_DFU 0x45#define MMC_BOOT_DEVICES_START BOOT_DEVICE_MMC1#define MMC_BOOT_DEVICES_END BOOT_DEVICE_MMC2_2
common/spl/spl.c +9 -1
@@ -148,7 +148,7 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)# define CONFIG_SPL_LOAD_FIT_ADDRESS 0#endif -#ifdef CONFIG_SPL_RAM_DEVICE +#if defined(CONFIG_SPL_RAM_DEVICE ) || defined(CONFIG_SPL_DFU_SUPPORT )static ulong spl_ram_load_read (struct spl_load_info *load,ulong sector,ulong count,void *buf) {
@@ -286,6 +286,9 @@ struct boot_device_name boot_name_table[] = { #ifdef CONFIG_SPL_USB_SUPPORT { BOOT_DEVICE_USB, "USB" }, #endif +#ifdef CONFIG_SPL_DFU_SUPPORT + { BOOT_DEVICE_DFU, "USB DFU" }, +#endif #ifdef CONFIG_SPL_SATA_SUPPORT { BOOT_DEVICE_SATA, "SATA" }, #endif
@@ -366,6 +369,11 @@ static int spl_load_image(u32 boot_device)case BOOT_DEVICE_USB :return spl_usb_load_image ();#endif +#ifdef CONFIG_SPL_DFU_SUPPORT +case BOOT_DEVICE_DFU : +spl_dfu_cmd (0 ,"dfu_alt_info_ram" ,"ram" ,"0" ); +return spl_ram_load_image (); +#endif #ifdef CONFIG_SPL_SATA_SUPPORT case BOOT_DEVICE_SATA :return spl_sata_load_image ();
Signature · 1 line
1.7.9.5
RFC PATCH v2 5/5 dra7x: configs: enable SPL-DFU support
In reply to Ravi BabuThis patch enables the SPL-DFU support for
dra7x platform.
--- include/configs/dra7xx_evm.h | 19 ++++++++++++++++++- include/configs/ti_omap5_common.h | 2 -- 2 files changed, 18 insertions(+), 3 deletions(-)
include/configs/dra7xx_evm.h +18 -1
@@ -133,6 +133,22 @@#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1#endif +#ifdef CONFIG_SPL_BUILD +#ifdef CONFIG_SPL_DFU_SUPPORT +#define CONFIG_SPL_LOAD_FIT_ADDRESS 0x80200000 +#define CONFIG_SPL_ENV_SUPPORT +#define CONFIG_SPL_HASH_SUPPORT +#define DFU_ALT_INFO_RAM \ + "dfu_alt_info_ram=" \ + "kernel ram 0x80200000 0x4000000;" \ + "fdt ram 0x80f80000 0x80000;" \ + "ramdisk ram 0x81000000 0x4000000\0" +#define DFUARGS \ + "dfu_bufsiz=0x10000\0" \ + DFU_ALT_INFO_RAM +#endif +#endif +#include <configs/ti_omap5_common.h> /* Enhance our eMMC support / experience. */
@@ -222,9 +238,10 @@#define CONFIG_USB_FUNCTION_DFU #define CONFIG_DFU_RAM +#ifndef CONFIG_SPL_BUILD #define CONFIG_DFU_MMC -#define CONFIG_DFU_RAM #define CONFIG_DFU_SF +#endif /* SATA */ #define CONFIG_BOARD_LATE_INIT
include/configs/ti_omap5_common.h +0 -2
@@ -66,7 +66,6 @@#define DFUARGS #endif -#ifndef CONFIG_SPL_BUILD #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG #define CONFIG_EXTRA_ENV_SETTINGS \ DEFAULT_LINUX_BOOT_ENV \
@@ -130,7 +129,6 @@"setenv mmcroot /dev/mmcblk0p2 rw; " \"run mmcboot;" \"" -#endif /* * SPL related defines. The Public RAM memory map the ROM defines the
Signature · 1 line
1.7.9.5
RFC PATCH v2 1/5 spl: dfu: add dfu support in SPL
In reply to Ravi BabuQuoted 31 lines · Ravi Babu
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->BootImages->EnableSPL-DFU supportSigned-off-by Ravi Babu <[email protected]>--- Kconfig | 27 +++++++++++++++++++++++++++ common/Makefile | 1 + common/command.c | 2 +- scripts/Makefile.spl | 4 ++++ 4 files changed, 33 insertions(+), 1 deletion(-)Kconfig +0
-0
Kconfig config SPL_FIT_IMAGE_POST_PROCESS · line 341
Quoted 6 lines
Kconfig +3
-0@@ -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
This seems needlessly restrictive.
common/command.c enum command_ret_t cmd_process(int flag, int argc, char * const argv[], · line 526
Quoted 13 lines
common/command.c +1
-1@@ -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 ) {
Why do we need this?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160722/e6629f94/attachment.sig>
RFC PATCH v2 2/5 common: dfu: saperate the dfu common functionality
In reply to Ravi BabuQuoted 5 lines · Ravi Babu
The
cmd_dfufunctionality is been used by both SPL and u-boot, saperating the core dfu functionality moving it tocommon/dfu.c.Signed-off-by Ravi Babu <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160722/1088db67/attachment.sig>
RFC PATCH v2 3/5 spl: dfu: adding dfu support functions for SPL-DFU
In reply to Ravi BabuQuoted 3 lines · Ravi Babu
Adding support functions to run dfu spl commands.
Signed-off-by Ravi Babu <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160722/41040ddb/attachment.sig>
RFC PATCH v2 4/5 dra7x: boot: add dfu bootmode support
In reply to Ravi BabuQuoted 31 lines · Ravi Babu
This patch enables the DFU boot mode support
for dra7x platform.Signed-off-by Ravi Babu <[email protected]>--- arch/arm/cpu/armv7/omap-common/boot-common.c | 5 +++++ arch/arm/include/asm/arch-omap5/spl.h | 2 +- common/spl/spl.c | 10 +++++++++- 3 files changed, 15 insertions(+), 2 deletions(-)arch/arm/cpu/armv7/omap-common/boot-common.c +5
-0@@ -91,6 +91,11 @@ void save_omap_boot_params(void) sys_boot_device =1 ;break ;#endif +#if defined(BOOT_DEVICE_DFU ) && !defined(CONFIG_SPL_DFU_SUPPORT ) +case BOOT_DEVICE_DFU : + sys_boot_device =1 ; +break ; +#endif }if (sys_boot_device) {arch/arm/include/asm/arch-omap5/spl.h +0
-0
arch/arm/include/asm/arch-omap5/spl.h line 23
Quoted 5 lines
arch/arm/include/asm/arch-omap5/spl.h +1
-1@@ -20,7 +20,7 @@#define BOOT_DEVICE_QSPI_1 0x0A#define BOOT_DEVICE_QSPI_4 0x0B#define BOOT_DEVICE_UART 0x43 -#define BOOT_DEVICE_USB 0x45 +#define BOOT_DEVICE_DFU 0x45
So you're breaking regular USB gadget support with this change, on these platforms, yes?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160722/9c25869d/attachment.sig>
RFC PATCH v2 5/5 dra7x: configs: enable SPL-DFU support
In reply to Ravi BabuQuoted 4 lines · Ravi Babu
This patch enables the SPL-DFU support for
dra7x platform.Signed-off-by Ravi Babu <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160722/32981d25/attachment.sig>
v2 cover SPL: DFU Support in SPL
In reply to Ravi BabuQuoted 7 lines · Ravi Babu
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.
How well did you test DFU on other platforms after these changes? Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160722/5d030e71/attachment.sig>
B
RFC PATCH v2 4/5 dra7x: boot: add dfu bootmode support
In reply to Tom RiniHi Tom
Quoted 9 lines
arch/arm/include/asm/arch-omap5/spl.h line 23
Quoted 7 lines
+++
b/arch/arm/include/asm/arch-omap5/spl.harch/arm/include/asm/arch-omap5/spl.h +1
-1@@ -20,7 +20,7 @@#define BOOT_DEVICE_QSPI_1 0x0A#define BOOT_DEVICE_QSPI_4 0x0B#define BOOT_DEVICE_UART 0x43 -#define BOOT_DEVICE_USB 0x45 +#define BOOT_DEVICE_DFU 0x45So you're breaking regular USB gadget support with this change, on these platforms, yes?
You are correct. This platform does not support BOOT_DEVICE_USB support.
The BOOT_DEVICE_USB is basically the USBHOST-MSC support (CONFIG_SPL_USB_SUPPORT), i.e, boot from mass storage device.
Yes, this platform don't have USBHOST-MSC support, hence BOOT_DEVICE_USB is not valid for this device and removed, and also does not support BOOT_DEVICE_USBETH as well. Instead BOOT_DEVICE_DFU is defined for USB-Gadget-DFU support, i.e, boot from USB-DFU.
Regards
Ravi
RFC PATCH v2 4/5 dra7x: boot: add dfu bootmode support
Quoted 12 lines · Ravi
Hi Tom
Quoted 9 lines
arch/arm/include/asm/arch-omap5/spl.h line 23
Quoted 7 lines
+++
b/arch/arm/include/asm/arch-omap5/spl.harch/arm/include/asm/arch-omap5/spl.h +1
-1@@ -20,7 +20,7 @@#define BOOT_DEVICE_QSPI_1 0x0A#define BOOT_DEVICE_QSPI_4 0x0B#define BOOT_DEVICE_UART 0x43 -#define BOOT_DEVICE_USB 0x45 +#define BOOT_DEVICE_DFU 0x45So you're breaking regular USB gadget support with this change, on these platforms, yes?
Quoted 2 lines
You are correct. This platform does not support
BOOT_DEVICE_USBsupport.
TheBOOT_DEVICE_USBis basically the USBHOST-MSC support (CONFIG_SPL_USB_SUPPORT), i.e, boot from mass storage device.
So, we have 3 SoCs that share these values here, and we need to be correct for all of them. What does 0x45 mean, on OMAP5, DRA7xx and AM57xx, in terms of what, and how, the ROM loaded something in?
Quoted 1 line
Yes, this platform don't have USBHOST-MSC support, hence
BOOT_DEVICE_USBis not valid for this device and removed, and also does not supportBOOT_DEVICE_USBETHas well.
When you say platform and device, do you mean SoC, or the specific EVM you're working with?
Quoted 1 line
Instead
BOOT_DEVICE_DFUis defined for USB-Gadget-DFU support, i.e, boot from USB-DFU.
It sounds like you're saying here that 0x45, for DRA7xx/AM57xx means "ROM enumerated a USB gadget (of type what?) and was given a payload". This is what, on TI platforms, usually happens with 0x45. Sometimes it's a USB RNDIS device and bootp (am33xx, am43xx), sometimes it's a something else (I honestly forget what OMAP4 did, I think it was just a vendor class self-defined and spec-allowed thing). What is happening in this case, and how do we get this first part in?
Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160725/e62d1610/attachment.sig>
B
v2 cover SPL: DFU Support in SPL
In reply to Tom RiniTom
Quoted 8 lines
Quoted 5 lines
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.
How well did you test DFU on other platforms after these changes? Thanks
Actually earlier platforms did not had this support, support for either RNDIS boot mode (CONFIG_SPL_USBETH_SUPPORT) or CONFIG_SPL_USB_SUPPORT (boot from mass-storage device) were only supported.
But ideally, this should work on any other platform, as functional flow of SPL-DFU is same as DFU functionality in u-boot and reuse of common dfu driver, also DFU has been verified in multiple platforms in u-boot mainline.
The same DFU support is now brought to SPL to facilitate booting EVM using USB interface.
Regards
Ravi
B
RFC PATCH v2 4/5 dra7x: boot: add dfu bootmode support
In reply to Tom RiniHi Tom
Quoted 5 lines
Quoted 3 lines
You are correct. This platform does not support
BOOT_DEVICE_USBsupport.
TheBOOT_DEVICE_USBis basically the USBHOST-MSC support (CONFIG_SPL_USB_SUPPORT), i.e, boot from mass storage device.So, we have 3 SoCs that share these values here, and we need to be correct for all of them. What does
0x45mean, on OMAP5, DRA7xx and AM57xx, in terms of what, and how, the ROM loaded something in?
For all OMAP5/DRA7X/AM57X devices, 0x45 means ROM-USB peripheral boot mode. You are correct, as pointed out, the "ROM enumerated as USB gadget (type : vendor specific download gadget)".
Quoted 7 lines
Quoted 1 line
Yes, this platform don't have USBHOST-MSC support, hence
BOOT_DEVICE_USBis not valid for this device and removed, and also does not supportBOOT_DEVICE_USBETHas well.When you say platform and device, do you mean SoC, or the specific EVM you're working with?
Quoted 1 line
Instead
BOOT_DEVICE_DFUis defined for USB-Gadget-DFU support, i.e, boot from USB-DFU.It sounds like you're saying here that
0x45, for DRA7xx/AM57xx means "ROM enumerated a USB gadget (of type what?) and was given a payload".
Correct. ROM implements custom download gadget.
Quoted 1 line
This is what, on TI platforms, usually happens with
0x45. Sometimes it's a USB RNDIS device and bootp (am33xx, am43xx), sometimes it's a something else
Yes you are correct, there is only one USB mode implemented in ROM (either host boot or peripheral boot mode).
Quoted 1 line
(I honestly forget what OMAP4 did, I think it was just a vendor class self-defined and spec-allowed thing). What is happening in this case, and how do we get this first part in?
I am not sure on OMAP4, it must be similar to OMAP5 which is vendor class specific download gadget.
Regards
Ravi
v2 cover SPL: DFU Support in SPL
In reply to BQuoted 5 lines · Ravi
Tom
Quoted 3 lines
Quoted 3 lines
Traditionally the DFU support is available only as part 2nd stage boot loader(u-boot) and DFU is not supported in SPL.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
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.
How well did you test DFU on other platforms after these changes? Thanks
Actually earlier platforms did not had this support, support for either RNDIS boot mode (
CONFIG_SPL_USBETH_SUPPORT) orCONFIG_SPL_USB_SUPPORT(boot from mass-storage device) were only supported.
Yes, sorry, I mean you're making generic DFU code changes too, did you test them on other TI platforms which support DFU in other cases to make sure nothing slipped in and broke them with these changes?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160725/09d9d07c/attachment.sig>
B
v2 cover SPL: DFU Support in SPL
Tom
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
How well did you test DFU on other platforms after these changes? Thanks
Actually earlier platforms did not had this support, support for
either RNDIS boot mode (CONFIG_SPL_USBETH_SUPPORT) orCONFIG_SPL_USB_SUPPORT(boot from mass-storage device) were only supported.Yes, sorry, I mean you're making generic DFU code changes too, did you test them on other TI platforms which support DFU in other cases to make sure nothing slipped in and broke them with these changes?
I got your point, You are referring to generic dfu code changes, that is moving common dfu code to common/dfu.c , so that both u-boot and SPL can leverage common code. But this change is generic cleanup code. Yes, I did test DFU functionality on other platforms (say AM335X). I can check other platform as well.
But SPL-DFU is tied with ROM-USB peripheral boot mode, I cannot test other than DRA7X/AM57X.
But in order to verify the SPL-DFU boot on other platform, I have tested SPL-DFU on AM335x, hacking common/spl/spl.c to execute SPL-DFU code by default and could able to load u-boot.img into RAM and boot to u-boot. (using dfu-utils from PC host).
Let me know I have clarified.
Regards
Ravi
v2 cover SPL: DFU Support in SPL
Quoted 14 lines · Ravi
Tom
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
How well did you test DFU on other platforms after these changes? Thanks
Actually earlier platforms did not had this support, support for
either RNDIS boot mode (CONFIG_SPL_USBETH_SUPPORT) orCONFIG_SPL_USB_SUPPORT(boot from mass-storage device) were only supported.Yes, sorry, I mean you're making generic DFU code changes too, did you test them on other TI platforms which support DFU in other cases to make sure nothing slipped in and broke them with these changes?
I got your point, You are referring to generic dfu code changes, that is moving common dfu code to
common/dfu.c, so that both u-boot and SPL can leverage common code. But this change is generic cleanup code. Yes, I did test DFU functionality on other platforms (say AM335X). I can check other platform as well.
Quoted 5 lines
But SPL-DFU is tied with ROM-USB peripheral boot mode, I cannot test other than DRA7X/AM57X.
But in order to verify the SPL-DFU boot on other platform, I have tested SPL-DFU on AM335x, hackingcommon/spl/spl.cto execute SPL-DFU code by default and could able to load u-boot.img into RAM and boot to u-boot. (using dfu-utils from PC host).Let me know I have clarified.
OK. Please note in the next round (and in general) when you also test that generic changes have been confirmed on other platforms, thanks.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160725/5b8b7b13/attachment.sig>
B
v2 cover SPL: DFU Support in SPL
Hi Tom
Quoted 11 lines
Quoted 9 lines
I got your point, You are referring to generic dfu code changes, that
is moving common dfu code tocommon/dfu.c, so that both u-boot and SPL can leverage common code. But this change is generic cleanup code. Yes, I did test DFU functionality on other platforms (say AM335X). I can check other platform as well.But SPL-DFU is tied with ROM-USB peripheral boot mode, I cannot test other than DRA7X/AM57X.
But in order to verify the SPL-DFU boot on other platform, I have
tested SPL-DFU on AM335x, hackingcommon/spl/spl.cto execute SPL-DFU code by default and could able to load u-boot.img into RAM and boot to u-boot. (using dfu-utils from PC host).Let me know I have clarified.
OK. Please note in the next round (and in general) when you also test that generic changes have been confirmed on other platforms, thanks.
Yes, I will do. Thanks.
Regards
Ravi
B
RFC PATCH v2 1/5 spl: dfu: add dfu support in SPL
In reply to Tom RiniHi Tom
Missed this thread to reply.
Quoted 7 lines
Quoted 7 lines
index ef12f9f..ed3e295 100644
Kconfig +0
-0@@ -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).
Quoted 5 lines
Kconfig config SPL_FIT_IMAGE_POST_PROCESS · line 341
Quoted 3 lines
Kconfig +3
-0+config SPL_DFU_SUPPORT + bool "Enable SPL with DFU to load binaries to memory device" + depends on USB && TARGET_DRA7XX_EVMThis seems needlessly restrictive.
Yes, I do agree, at present only dra7x platform support BOOT_DEVICE_DFU.
if we make it generic, then other platform should also enable the SPL-DFU
support for their respective platform (similar to [RFC PATCH v2 5/5] dra7x: configs: enable SPL-DFU support).
Quoted 8 lines
Quoted 8 lines
common/command.c index renamed from common/command.c +0
-0e5d9b9c..d1c049c 100644
common/command.c +0
-0@@ -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 ;
Quoted 8 lines
Quoted 6 lines
common/command.c +1
-1-#if defined(CONFIG_CMD_BOOTD ) +#if defined(CONFIG_CMD_BOOTD ) && !defined(CONFIG_SPL_BUILD ) /* avoid "bootd" recursion */ Check whether they use DMA or PIO mode. else if (cmdtp->cmd == do_bootd) {if (flag &
CMD_FLAG_BOOTD) {Why do we need this?
Actually CONFIG_CMD_BOOTD is not required for SPL-DFU.
But cmd/Kconfg has defined CONFIG_CMD_BOOTD by default, which is causing compilation error for "do_bootd" not defined. Again do_bootd depends on CONFIG_CMD_BOOTM which is not defined for SPL.
What is best way? What do you suggest ?
Regards
Ravi
RFC PATCH v2 1/5 spl: dfu: add dfu support in SPL
Quoted 17 lines · Ravi
Hi Tom
Missed this thread to reply.
Quoted 7 lines
Quoted 7 lines
index ef12f9f..ed3e295 100644
Kconfig +0
-0@@ -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).Quoted 5 lines
Kconfig config SPL_FIT_IMAGE_POST_PROCESS · line 341
Quoted 3 lines
Kconfig +3
-0+config SPL_DFU_SUPPORT + bool "Enable SPL with DFU to load binaries to memory device" + depends on USB && TARGET_DRA7XX_EVMThis seems needlessly restrictive.
Quoted 3 lines
Yes, I do agree, at present only dra7x platform support
BOOT_DEVICE_DFU.
if we make it generic, then other platform should also enable the SPL-DFU
support for their respective platform (similar to [RFC PATCH v2 5/5] dra7x: configs: enable SPL-DFU support).
That's what I'm saying, this all looks generic today, except for the restriction here in Kconfig. Yes, boards that want to use it will have to fill in plumbing, but that's normal.
Quoted 15 lines
Quoted 14 lines
Quoted 14 lines
common/command.c index renamed from common/command.c +0
-0e5d9b9c..d1c049c 100644
common/command.c +1
-1@@ -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 */ Check whether they use DMA or PIO mode. else if (cmdtp->cmd == do_bootd) {if (flag &
CMD_FLAG_BOOTD) {
Quoted 7 lines
Quoted 1 line
Why do we need this?
Actually
CONFIG_CMD_BOOTDis not required for SPL-DFU.
But cmd/Kconfg has definedCONFIG_CMD_BOOTDby default, which is causing compilation error for "do_bootd" not defined. Againdo_bootddepends onCONFIG_CMD_BOOTMwhich is not defined for SPL.What is best way? What do you suggest ?
First, what is the exact compile error you get? And second, probably disable CMD_BOOTD.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160727/a61e7466/attachment.sig>
B
RFC PATCH v2 1/5 spl: dfu: add dfu support in SPL
Tom
Quoted 20 lines · Tom Rini
Quoted 19 lines · Ravi
Hi Tom
Missed this thread to reply.
Quoted 12 lines
Kconfig config SPL_FIT_IMAGE_POST_PROCESS · line 341
Quoted 10 lines
index ef12f9f..ed3e295 100644
Kconfig +3
-0@@ -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_EVMThis seems needlessly restrictive.
Quoted 7 lines
Quoted 3 lines
Yes, I do agree, at present only dra7x platform support
BOOT_DEVICE_DFU.
if we make it generic, then other platform should also enable the SPL-DFU
support for their respective platform (similar to [RFC PATCH v2 5/5] dra7x: configs: enable SPL-DFU support).That's what I'm saying, this all looks generic today, except for the restriction here in
Kconfig. Yes, boards that want to use it will have to fill in plumbing, but that's normal.
Ok, then I will remove this restriction.
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 14 lines
common/command.c index renamed from common/command.c +0
-0e5d9b9c..d1c049c 100644
common/command.c +1
-1@@ -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 */ Check whether they use DMA or PIO mode. else if (cmdtp->cmd == do_bootd) {Quoted 1 line
if (flag & CMD_FLAG_BOOTD) {Why do we need this?
Quoted 8 lines
Quoted 5 lines
Actually
CONFIG_CMD_BOOTDis not required for SPL-DFU.
But cmd/Kconfg has definedCONFIG_CMD_BOOTDby default, which is causing compilation error for "do_bootd" not defined. Againdo_bootddepends onCONFIG_CMD_BOOTMwhich is not defined for SPL.What is best way? What do you suggest ?
First, what is the exact compile error you get? And second, probably disable
CMD_BOOTD.
Since CMD_BOOTD is enabled, the function do_bood is undefined due to cmd/bootm.c compiled out for SPL.
As you said, better to disable CMD_BOOTD.
Regards
Ravi
RFC PATCH v2 1/5 spl: dfu: add dfu support in SPL
Quoted 5 lines · Ravi
Tom
Quoted 3 lines · Tom Rini
Quoted 2 lines · Ravi
[snip]
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 8 lines
Quoted 8 lines
common/command.c index renamed from common/command.c +0
-0e5d9b9c..d1c049c 100644
common/command.c +0
-0@@ -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 ;Quoted 8 lines
Quoted 6 lines
common/command.c +1
-1-#if defined(CONFIG_CMD_BOOTD ) +#if defined(CONFIG_CMD_BOOTD ) && !defined(CONFIG_SPL_BUILD ) /* avoid "bootd" recursion */ Check whether they use DMA or PIO mode. else if (cmdtp->cmd == do_bootd) {if (flag & CMD_FLAG_BOOTD) {Why do we need this?
Actually
CONFIG_CMD_BOOTDis not required for SPL-DFU.
But cmd/Kconfg has definedCONFIG_CMD_BOOTDby default, which is causing compilation error for "do_bootd" not defined. Againdo_bootddepends onCONFIG_CMD_BOOTMwhich is not defined for SPL.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
What is best way? What do you suggest ?
First, what is the exact compile error you get? And second, probably disable
CMD_BOOTD.Since
CMD_BOOTDis enabled, the functiondo_boodis undefined due tocmd/bootm.ccompiled out for SPL.As you said, better to disable
CMD_BOOTD.
Ah, the problems of bringing in command parsing stuff to SPL. Yeah, for now lets turn off CMD_BOOTD but I think long term this is why we need to not be relying on command parsing but instead use the API directly.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160728/a2ab3991/attachment.sig>