From patchwork Mon Jan 27 12:29:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 240278 List-Id: U-Boot discussion From: vigneshr at ti.com (Vignesh Raghavendra) Date: Mon, 27 Jan 2020 17:59:23 +0530 Subject: [PATCH 1/7] arm: mach-k3: j721e: Rename BOOT_DEVICE_USB to BOOT_DEVICE_DFU In-Reply-To: <20200127122929.25179-1-vigneshr@ti.com> References: <20200127122929.25179-1-vigneshr@ti.com> Message-ID: <20200127122929.25179-2-vigneshr@ti.com> J721e does not support USB Host MSC boot, but only supports DFU boot. Since BOOT_DEVICE_USB is often used for host boot mode and BOOT_DEVICE_DFU is used for DFU boot, rename BOOT_DEVICE_USB macro to BOOT_DEVICE_DFU Signed-off-by: Vignesh Raghavendra --- arch/arm/mach-k3/include/mach/j721e_spl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-k3/include/mach/j721e_spl.h b/arch/arm/mach-k3/include/mach/j721e_spl.h index 2b52faf9443b..475278bd041a 100644 --- a/arch/arm/mach-k3/include/mach/j721e_spl.h +++ b/arch/arm/mach-k3/include/mach/j721e_spl.h @@ -18,7 +18,7 @@ /* With BootMode B = 1 */ #define BOOT_DEVICE_MMC2 0x10 #define BOOT_DEVICE_MMC1 0x11 -#define BOOT_DEVICE_USB 0x12 +#define BOOT_DEVICE_DFU 0x12 #define BOOT_DEVICE_UFS 0x13 #define BOOT_DEVIE_GPMC 0x14 #define BOOT_DEVICE_PCIE 0x15 From patchwork Mon Jan 27 12:29:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 240279 List-Id: U-Boot discussion From: vigneshr at ti.com (Vignesh Raghavendra) Date: Mon, 27 Jan 2020 17:59:24 +0530 Subject: [PATCH 2/7] arm: mach-k3: sysfw-loader: Add support to download SYSFW via DFU In-Reply-To: <20200127122929.25179-1-vigneshr@ti.com> References: <20200127122929.25179-1-vigneshr@ti.com> Message-ID: <20200127122929.25179-3-vigneshr@ti.com> Add support to download SYSFW into internal RAM via DFU in DFU boot mode. Prepare a DFU config entity entry dynamically using buffer address allocated for SYSFW and start DFU gadget to get SYSFW. Signed-off-by: Vignesh Raghavendra --- arch/arm/mach-k3/sysfw-loader.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c index 5903bbe12aa3..94dbeb9437d9 100644 --- a/arch/arm/mach-k3/sysfw-loader.c +++ b/arch/arm/mach-k3/sysfw-loader.c @@ -11,6 +11,10 @@ #include #include #include +#include +#include +#include + #include #include "common.h" @@ -172,6 +176,27 @@ static void k3_sysfw_configure_using_fit(void *fit, ret); } +#if CONFIG_IS_ENABLED(DFU) +static int k3_sysfw_dfu_download(void *addr) +{ + char dfu_str[50]; + int ret; + + sprintf(dfu_str, "sysfw.itb ram 0x%p 0x%x", addr, + CONFIG_K3_SYSFW_IMAGE_SIZE_MAX); + ret = dfu_config_entities(dfu_str, "ram", "0"); + if (ret) { + dfu_free_entities(); + goto exit; + } + + run_usb_dnl_gadget(0, "usb_dnl_dfu"); +exit: + dfu_free_entities(); + return ret; +} +#endif + void k3_sysfw_loader(void (*config_pm_done_callback)(void)) { struct spl_image_info spl_image = { 0 }; @@ -235,6 +260,11 @@ void k3_sysfw_loader(void (*config_pm_done_callback)(void)) #endif ret = spl_ymodem_load_image(&spl_image, &bootdev); break; +#endif +#if CONFIG_IS_ENABLED(DFU) + case BOOT_DEVICE_DFU: + ret = k3_sysfw_dfu_download(sysfw_load_address); + break; #endif default: panic("Loading SYSFW image from device %u not supported!\n", From patchwork Mon Jan 27 12:29:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 240280 List-Id: U-Boot discussion From: vigneshr at ti.com (Vignesh Raghavendra) Date: Mon, 27 Jan 2020 17:59:25 +0530 Subject: [PATCH 3/7] arm: dts: k3-j721e-common-proc-board: Enable USB0 in peripheral mode In-Reply-To: <20200127122929.25179-1-vigneshr@ti.com> References: <20200127122929.25179-1-vigneshr@ti.com> Message-ID: <20200127122929.25179-4-vigneshr@ti.com> Enable USB0 in peripheral mode so that it be used for DFU Signed-off-by: Vignesh Raghavendra --- arch/arm/dts/k3-j721e-r5-common-proc-board.dts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm/dts/k3-j721e-r5-common-proc-board.dts b/arch/arm/dts/k3-j721e-r5-common-proc-board.dts index 28a355d49c9b..585cc839632b 100644 --- a/arch/arm/dts/k3-j721e-r5-common-proc-board.dts +++ b/arch/arm/dts/k3-j721e-r5-common-proc-board.dts @@ -40,6 +40,13 @@ clock-frequency = <200000000>; u-boot,dm-spl; }; + + clk_19_2mhz: dummy_clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <19200000>; + u-boot,dm-spl; + }; }; &cbass_mcu_wakeup { @@ -207,4 +214,15 @@ u-boot,dm-spl; }; +&usbss0 { + /delete-property/ power-domains; + /delete-property/ assigned-clocks; + /delete-property/ assigned-clock-parents; + clocks = <&clk_19_2mhz>; + clock-names = "usb2_refclk"; + pinctrl-names = "default"; + pinctrl-0 = <&main_usbss0_pins_default>; + ti,vbus-divider; +}; + #include "k3-j721e-common-proc-board-u-boot.dtsi" From patchwork Mon Jan 27 12:29:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 240281 List-Id: U-Boot discussion From: vigneshr at ti.com (Vignesh Raghavendra) Date: Mon, 27 Jan 2020 17:59:26 +0530 Subject: [PATCH 4/7] configs: j721e_evm: Add DFU related variables In-Reply-To: <20200127122929.25179-1-vigneshr@ti.com> References: <20200127122929.25179-1-vigneshr@ti.com> Message-ID: <20200127122929.25179-5-vigneshr@ti.com> Add configs to download varies stages of bootloader images to RAM during DFU boot. Signed-off-by: Vignesh Raghavendra --- include/configs/j721e_evm.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/configs/j721e_evm.h b/include/configs/j721e_evm.h index eaed520e6be0..4371c471e5a9 100644 --- a/include/configs/j721e_evm.h +++ b/include/configs/j721e_evm.h @@ -23,6 +23,8 @@ #ifdef CONFIG_TARGET_J721E_A72_EVM #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SPL_TEXT_BASE + \ CONFIG_SYS_K3_NON_SECURE_MSRAM_SIZE) +/* Image load address in RAM for DFU boot*/ +#define CONFIG_SPL_LOAD_FIT_ADDRESS 0x81000000 #else /* * Maximum size in memory allocated to the SPL BSS. Keep it as tight as @@ -45,6 +47,8 @@ /* Configure R5 SPL post-relocation malloc pool in DDR */ #define CONFIG_SYS_SPL_MALLOC_START 0x84000000 #define CONFIG_SYS_SPL_MALLOC_SIZE SZ_16M +/* Image load address in RAM for DFU boot*/ +#define CONFIG_SPL_LOAD_FIT_ADDRESS 0x80080000 #endif #ifdef CONFIG_SYS_K3_SPL_ATF From patchwork Mon Jan 27 12:29:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 240282 List-Id: U-Boot discussion From: vigneshr at ti.com (Vignesh Raghavendra) Date: Mon, 27 Jan 2020 17:59:27 +0530 Subject: [PATCH 5/7] configs: j721e_evm_r5_defconfig: Increase early malloc size In-Reply-To: <20200127122929.25179-1-vigneshr@ti.com> References: <20200127122929.25179-1-vigneshr@ti.com> Message-ID: <20200127122929.25179-6-vigneshr@ti.com> Increase R5 SPL early malloc memory pool by ~7K to accommodate SPL USB DFU boot requirements Signed-off-by: Vignesh Raghavendra --- configs/j721e_evm_r5_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig index a90ab62195e3..efe5389cc93e 100644 --- a/configs/j721e_evm_r5_defconfig +++ b/configs/j721e_evm_r5_defconfig @@ -3,7 +3,7 @@ CONFIG_ARCH_K3=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y -CONFIG_SYS_MALLOC_F_LEN=0x55000 +CONFIG_SYS_MALLOC_F_LEN=0x70000 CONFIG_SOC_K3_J721E=y CONFIG_TARGET_J721E_R5_EVM=y CONFIG_ENV_SIZE=0x20000 From patchwork Mon Jan 27 12:29:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 240283 List-Id: U-Boot discussion From: vigneshr at ti.com (Vignesh Raghavendra) Date: Mon, 27 Jan 2020 17:59:28 +0530 Subject: [PATCH 6/7] configs: j721e_evm_r5/a72_defconfig: Enable USB Gadget related configs In-Reply-To: <20200127122929.25179-1-vigneshr@ti.com> References: <20200127122929.25179-1-vigneshr@ti.com> Message-ID: <20200127122929.25179-7-vigneshr@ti.com> Enable USB Gadget for R5 SPL, A72 SPL and A72 U-Boot to support DFU boot Signed-off-by: Vignesh Raghavendra --- configs/j721e_evm_a72_defconfig | 2 ++ configs/j721e_evm_r5_defconfig | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig index d5e54a228d07..d4e4bd30a34a 100644 --- a/configs/j721e_evm_a72_defconfig +++ b/configs/j721e_evm_a72_defconfig @@ -34,6 +34,7 @@ CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_POWER_DOMAIN=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x280000 +CONFIG_SPL_USB_GADGET=y CONFIG_SPL_YMODEM_SUPPORT=y CONFIG_CMD_ASKENV=y CONFIG_CMD_DFU=y @@ -139,6 +140,7 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_CDNS3=y CONFIG_USB_CDNS3_GADGET=y CONFIG_USB_CDNS3_HOST=y +CONFIG_SPL_USB_CDNS3_GADGET=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" CONFIG_USB_GADGET_VENDOR_NUM=0x0451 diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig index efe5389cc93e..f18eeed118c2 100644 --- a/configs/j721e_evm_r5_defconfig +++ b/configs/j721e_evm_r5_defconfig @@ -36,6 +36,7 @@ CONFIG_SPL_RAM_DEVICE=y CONFIG_SPL_REMOTEPROC=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000 +CONFIG_SPL_USB_GADGET=y CONFIG_SPL_YMODEM_SUPPORT=y CONFIG_HUSH_PARSER=y # CONFIG_CMD_FLASH is not set @@ -104,5 +105,16 @@ CONFIG_SYSRESET_TI_SCI=y CONFIG_TIMER=y CONFIG_SPL_TIMER=y CONFIG_OMAP_TIMER=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_DM_USB_GADGET=y +CONFIG_SPL_DM_USB_GADGET=y +CONFIG_USB_CDNS3=y +CONFIG_USB_CDNS3_GADGET=y +CONFIG_SPL_USB_CDNS3_GADGET=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" +CONFIG_USB_GADGET_VENDOR_NUM=0x0451 +CONFIG_USB_GADGET_PRODUCT_NUM=0x6163 CONFIG_FS_EXT4=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 From patchwork Mon Jan 27 12:29:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 240284 List-Id: U-Boot discussion From: vigneshr at ti.com (Vignesh Raghavendra) Date: Mon, 27 Jan 2020 17:59:29 +0530 Subject: [PATCH 7/7] configs: j721e_evm_r5/a72_defconfig: Enable DFU related configs In-Reply-To: <20200127122929.25179-1-vigneshr@ti.com> References: <20200127122929.25179-1-vigneshr@ti.com> Message-ID: <20200127122929.25179-8-vigneshr@ti.com> Enable DFU, Fastboot and USB mass storage gadget related configs Signed-off-by: Vignesh Raghavendra --- configs/j721e_evm_a72_defconfig | 4 ++++ configs/j721e_evm_r5_defconfig | 3 +++ 2 files changed, 7 insertions(+) diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig index d4e4bd30a34a..162fa3b53caf 100644 --- a/configs/j721e_evm_a72_defconfig +++ b/configs/j721e_evm_a72_defconfig @@ -32,9 +32,12 @@ CONFIG_SPL_DM_MAILBOX=y CONFIG_SPL_DM_RESET=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_POWER_DOMAIN=y +CONFIG_SPL_RAM_SUPPORT=y +CONFIG_SPL_RAM_DEVICE=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x280000 CONFIG_SPL_USB_GADGET=y +CONFIG_SPL_DFU=y CONFIG_SPL_YMODEM_SUPPORT=y CONFIG_CMD_ASKENV=y CONFIG_CMD_DFU=y @@ -118,6 +121,7 @@ CONFIG_PINCTRL_SINGLE=y CONFIG_POWER_DOMAIN=y CONFIG_TI_SCI_POWER_DOMAIN=y CONFIG_RAM=y +CONFIG_SPL_RAM=y CONFIG_REMOTEPROC_TI_K3_DSP=y CONFIG_REMOTEPROC_TI_K3_R5F=y CONFIG_DM_RESET=y diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig index f18eeed118c2..116470fb5e47 100644 --- a/configs/j721e_evm_r5_defconfig +++ b/configs/j721e_evm_r5_defconfig @@ -37,8 +37,10 @@ CONFIG_SPL_REMOTEPROC=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000 CONFIG_SPL_USB_GADGET=y +CONFIG_SPL_DFU=y CONFIG_SPL_YMODEM_SUPPORT=y CONFIG_HUSH_PARSER=y +CONFIG_CMD_DFU=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y @@ -116,5 +118,6 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" CONFIG_USB_GADGET_VENDOR_NUM=0x0451 CONFIG_USB_GADGET_PRODUCT_NUM=0x6163 +CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_FS_EXT4=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384