xilinx: Align usb dfu boot mode and bootcommand with distroboot
cover xilinx: Align usb dfu boot mode and bootcommand with distroboot
Hi,
usb dfu was handled differently then other boot commands. First of all fix usb dfu boot mode for zynqmp where usb boot mode is not usb host but usb dfu.
Align also versal, zynq and zynqmp implementations to each other.
Thanks,
Michal
Michal Simek (2):
cmd: dfu: Propagate error if dfu gadget fails
xilinx: zynqmp: Remove dfu_ram_info setup
T Karthik Reddy (4):
xilinx: zynqmp: Add usb dfu/thor distro boot support
xilinx: versal: Add usb dfu/thor distro boot support
xilinx: zynq: Add usb dfu/thor distro boot support
xilinx: Enable DFU_TIMEOUT config
board/xilinx/versal/board.c | 2 +- board/xilinx/zynqmp/zynqmp.c | 2 +- cmd/dfu.c | 2 +- configs/xilinx_versal_virt_defconfig | 1 + configs/xilinx_zynq_virt_defconfig | 1 + configs/xilinx_zynqmp_virt_defconfig | 1 + include/configs/syzygy_hub.h | 1 - include/configs/topic_miami.h | 1 - include/configs/xilinx_versal.h | 52 ++++++++++++------------ include/configs/xilinx_zynqmp.h | 49 ++++++++++++++-------- include/configs/zynq-common.h | 61 ++++++++++++++-------------- 11 files changed, 94 insertions(+), 79 deletions(-)
Signature · 1 line
2.31.0
PATCH 1/6 cmd: dfu: Propagate error if dfu gadget fails
On systems without usb gadget dfu core fails which was reported by error but command itself returns pass which breaks any usage in a script. That's why propagate error from run_usb_dnl_gadget().
---
Before this patch
ZynqMP> run bootcmd_usb_dfu0
No USB device foundusb_gadget_initialize failed
DFU0: Trying to boot script at 0x20000000
Wrong image format for "source" command
DFU0: SCRIPT FAILED: continuing...
After
ZynqMP> run bootcmd_usb_dfu0
No USB device foundusb_gadget_initialize failed
DFU0: SCRIPT FAILED: continuing...
--- cmd/dfu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/dfu.c +1 -1
@@ -68,7 +68,7 @@ static int do_dfu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])int controller_index =simple_strtoul (usb_controller,NULL ,0 );bool retry = false; do { - run_usb_dnl_gadget(controller_index, "usb_dnl_dfu"); + ret = run_usb_dnl_gadget(controller_index, "usb_dnl_dfu"); if (dfu_reinit_needed) { dfu_free_entities();
Signature · 1 line
2.31.0
PATCH 2/6 xilinx: zynqmp: Add usb dfu/thor distro boot support
In reply to Michal SimekFrom: T Karthik Reddy <[email protected]>
In usb boot mode distro boot should select usb device as primary boot device instead of usb host. So make usb dfu as primary boot device. But do not list it in boot_targets as fallback option because it is not classic mode for booting. Using 60s timeout by default should be enough time for dfu-utils to start transaction. In case none needs this please change timeout value in the command or disable CONFIG_DFU_TIMEOUT.
---
board/xilinx/zynqmp/zynqmp.c | 2 +- configs/xilinx_zynqmp_virt_defconfig | 1 + include/configs/xilinx_zynqmp.h | 30 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-)
board/xilinx/zynqmp/zynqmp.c +1 -1
@@ -571,7 +571,7 @@ int board_late_init(void)switch (bootmode) {case USB_MODE :puts ("USB_MODE\n" ); - mode ="usb" ; + mode ="usb_dfu0 usb_dfu1" ;env_set ("modeboot" ,"usb_dfu_spl" );break ;case JTAG_MODE :
configs/xilinx_zynqmp_virt_defconfig +1 -0
@@ -83,6 +83,7 @@ CONFIG_SCSI_AHCI=y CONFIG_SATA_CEVA=y CONFIG_CLK_ZYNQMP=y CONFIG_DFU_TFTP=y +CONFIG_DFU_TIMEOUT=y CONFIG_DFU_RAM=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_FLASH=y
include/configs/xilinx_zynqmp.h +30 -0
@@ -179,11 +179,41 @@#define BOOTENV_DEV_NAME_JTAG (devtypeu, devtypel, instance) \ "jtag " +#define BOOT_TARGET_DEVICES_USB_DFU (func) \ + func(USB_DFU, usb_dfu, 0) func(USB_DFU, usb_dfu, 1) + +#define BOOTENV_DEV_USB_DFU (devtypeu, devtypel, instance) \ + "bootcmd_" #devtypel #instance "=setenv dfu_alt_info boot.scr ram " \ + "$scriptaddr $script_size_f && " \ + "dfu " #instance " ram " #instance " 60 && " \ + "echo DFU" #instance ": Trying to boot script at ${scriptaddr} && " \ + "source ${scriptaddr}; " \ + "echo DFU" #instance ": SCRIPT FAILED: continuing...;\0" + +#define BOOTENV_DEV_NAME_USB_DFU (devtypeu, devtypel, instance) \ + "" + +#define BOOT_TARGET_DEVICES_USB_THOR (func) \ + func(USB_THOR, usb_thor, 0) func(USB_THOR, usb_thor, 1) + +#define BOOTENV_DEV_USB_THOR (devtypeu, devtypel, instance) \ + "bootcmd_" #devtypel #instance "=setenv dfu_alt_info boot.scr ram " \ + "$scriptaddr $script_size_f && " \ + "thordown " #instance " ram " #instance " && " \ + "echo THOR" #instance ": Trying to boot script at ${scriptaddr} && " \ + "source ${scriptaddr}; " \ + "echo THOR" #instance ": SCRIPT FAILED: continuing...;\0" + +#define BOOTENV_DEV_NAME_USB_THOR (devtypeu, devtypel, instance) \ + "" +#define BOOT_TARGET_DEVICES (func) \ BOOT_TARGET_DEVICES_JTAG(func) \ BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_QSPI(func) \ BOOT_TARGET_DEVICES_NAND(func) \ + BOOT_TARGET_DEVICES_USB_DFU(func) \ + BOOT_TARGET_DEVICES_USB_THOR(func) \ BOOT_TARGET_DEVICES_USB(func) \ BOOT_TARGET_DEVICES_SCSI(func) \ BOOT_TARGET_DEVICES_PXE(func) \
Signature · 1 line
2.31.0
PATCH 3/6 xilinx: zynqmp: Remove dfu_ram_info setup
In reply to Michal SimekThe dfu ram info is wired in connection to Linux kernel and certain setup. We should change this to be more generic as others command. That's why using boot via script is the way to go.
---
include/configs/xilinx_zynqmp.h | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-)
include/configs/xilinx_zynqmp.h +1 -18
@@ -55,18 +55,6 @@#define CONFIG_SYS_DFU_DATA_BUF_SIZE 0x1800000#define DFU_DEFAULT_POLL_TIMEOUT 300#define CONFIG_THOR_RESET_OFF -#define DFU_ALT_INFO_RAM \ - "dfu_ram_info=" \ - "setenv dfu_alt_info " \ - "Image ram 80000 $kernel_size_r\\\\;" \ - "system.dtb ram $fdt_addr_r $fdt_size_r\0" \ - "dfu_ram=run dfu_ram_info && dfu 0 ram 0\0" \ - "thor_ram=run dfu_ram_info && thordown 0 ram 0\0" \ - "dfu_ram_tftp=run dfu_ram_info && setenv updatefile boot && " \ - "setenv loadaddr 10000000 && dfu tftp ram 0\0" - -#define DFU_ALT_INFO \ - DFU_ALT_INFO_RAM#ifndef CONFIG_SPL_BUILD # define PARTS_DEFAULT \
@@ -76,10 +64,6 @@#endif #endif -#if !defined(DFU_ALT_INFO ) -# define DFU_ALT_INFO -#endif -#if !defined(PARTS_DEFAULT )# define PARTS_DEFAULT #endif
@@ -225,8 +209,7 @@#ifndef CONFIG_EXTRA_ENV_SETTINGS #define CONFIG_EXTRA_ENV_SETTINGS \ ENV_MEM_LAYOUT_SETTINGS \ - BOOTENV \ - DFU_ALT_INFO + BOOTENV#endif /* SPL can't handle all huge variables - define just DFU */
Signature · 1 line
2.31.0
PATCH 4/6 xilinx: versal: Add usb dfu/thor distro boot support
In reply to Michal SimekFrom: T Karthik Reddy <[email protected]>
Change "dfu_usb" to "usb_dfu" for better representation and change required macros. Add 60s timeout of dfu-utils to start transaction. Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM as we use bootcmd_usb_dfu instead of dfu_ram.
---
board/xilinx/versal/board.c | 2 +- include/configs/xilinx_versal.h | 52 +++++++++++++++++---------------- 2 files changed, 28 insertions(+), 26 deletions(-)
board/xilinx/versal/board.c +1 -1
@@ -130,7 +130,7 @@ int board_late_init(void)switch (bootmode) {case USB_MODE :puts ("USB_MODE\n" ); - mode ="dfu_usb" ; + mode ="usb_dfu0 usb_dfu1" ;break ;case JTAG_MODE :puts ("JTAG_MODE\n" );
include/configs/xilinx_versal.h +27 -25
78 lines not on this page · raw message
Signature · 1 line
2.31.0
PATCH 5/6 xilinx: zynq: Add usb dfu/thor distro boot support
In reply to Michal SimekFrom: T Karthik Reddy <[email protected]>
Add support for usb dfu & thor to distro boot on zynq platform. Add 60s timeout of dfu-utils to start transaction. Remove DFU_ALT_INFO_RAM as we use bootcmd_usb_dfu instead of dfu_ram. Remove DFU_ALT_INFO_MMC as part of distro boot cleanup.
---
include/configs/syzygy_hub.h | 1 - include/configs/topic_miami.h | 1 - include/configs/zynq-common.h | 61 +++++++++++++++++------------------ 3 files changed, 30 insertions(+), 33 deletions(-)
include/configs/syzygy_hub.h +0 -1
@@ -58,7 +58,6 @@"jtagboot=echo TFTPing FIT to RAM... && " \"tftpboot ${load_addr} ${fit_image} && " \"bootm ${load_addr}\0" \ -DFU_ALT_INFO \ BOOTENV#include <configs/zynq-common.h>
include/configs/topic_miami.h +0 -1
@@ -49,7 +49,6 @@"${devicetree_addr}; " \"fi\0" /* Note that addresses here should match the addresses in the env */ -# undef DFU_ALT_INFO # define DFU_ALT_INFO \"dfu_alt_info=" \"uImage ram 0x2080000 0x500000;" \
include/configs/zynq-common.h +30 -31
85 lines not on this page · raw message
Signature · 1 line
2.31.0
PATCH 6/6 xilinx: Enable DFU_TIMEOUT config
In reply to Michal SimekFrom: T Karthik Reddy <[email protected]>
Enable CONFIG_DFU_TIMEOUT to set timeout waiting for dfu command.
---
configs/xilinx_versal_virt_defconfig | 1 + configs/xilinx_zynq_virt_defconfig | 1 + 2 files changed, 2 insertions(+)
configs/xilinx_versal_virt_defconfig +1 -0
@@ -49,6 +49,7 @@ CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=4096 CONFIG_CLK_VERSAL=y +CONFIG_DFU_TIMEOUT=y CONFIG_DFU_RAM=y CONFIG_FPGA_XILINX=y CONFIG_FPGA_VERSALPL=y
configs/xilinx_zynq_virt_defconfig +1 -0
@@ -65,6 +65,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NETCONSOLE=y CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_DFU_TIMEOUT=y CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y CONFIG_FPGA_XILINX=y
Signature · 1 line
2.31.0
cover xilinx: Align usb dfu boot mode and bootcommand with distroboot
In reply to Michal Simekst 31. 3. 2021 v 10:17 odes?latel Michal Simek <[email protected]> napsal:
Quoted 35 lines
Hi,
usb dfu was handled differently then other boot commands. First of all fix usb dfu boot mode for zynqmp where usb boot mode is not usb host but usb dfu.
Align also versal, zynq and zynqmp implementations to each other.Thanks,
MichalMichal Simek (2):
cmd: dfu: Propagate error if dfu gadget fails
xilinx: zynqmp: Removedfu_ram_infosetupT Karthik Reddy (4):
xilinx: zynqmp: Add usb dfu/thor distro boot support
xilinx: versal: Add usb dfu/thor distro boot support
xilinx: zynq: Add usb dfu/thor distro boot support
xilinx: EnableDFU_TIMEOUTconfigboard/xilinx/versal/board.c | 2 +- board/xilinx/zynqmp/zynqmp.c | 2 +- cmd/dfu.c | 2 +- configs/xilinx_versal_virt_defconfig | 1 + configs/xilinx_zynq_virt_defconfig | 1 + configs/xilinx_zynqmp_virt_defconfig | 1 + include/configs/syzygy_hub.h | 1 - include/configs/topic_miami.h | 1 - include/configs/xilinx_versal.h | 52 ++++++++++++------------ include/configs/xilinx_zynqmp.h | 49 ++++++++++++++-------- include/configs/zynq-common.h | 61 ++++++++++++++-------------- 11 files changed, 94 insertions(+), 79 deletions(-)
Quoted 3 lines
--
2.31.0
Applied all.
M
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs