Add support for USB host and peripheral bootmodes on am65x-idk
Subsystems (2)
cover Add support for USB host and peripheral bootmodes on am65x-idk
The following patches add support for USB mass storage and USB dfu bootmodes on am654x-idk.
Because of space constrains and the size of the USB stack, there are two different usbmsc and usbdfu defconfigs for building R5 SPL. Fitting both of these into one defconfig requires some changes in the USB subsystem which is a longer term effort
Faiz Abbas (13):
spl: usb: Create an API spl_usb_load()
spl: usb: Only init usb once
armv7R: K3: am654: Use full malloc in SPL both pre and post reloc
arm: mach-k3: sysfw-loader: Add support to load SYSFW from USB
arm: mach-k3: am6_init: Gate mmc related configurations with the
appropriate config
arm: mach-k3: am6_init: Do USB fixups to facilitate host and device
boot modes
arm: mach-k3: am6_init: Add support for USB boot mode
arm: dts: k3-am654-r5-base-board: Add USB0 nodes
arm: dts: k3-am654-base-board: Add support for USB0 in SPL
configs: am65x_evm: Add support for DFU related configs
configs: am65x_evm_a53: Enable USB Mass storage and DFU boot modes
configs: Add new config for supporting USB mass storage boot
configs: Add defconfig for USB DFU bootmode
arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 27 +++++ arch/arm/dts/k3-am654-r5-base-board.dts | 35 ++++++ arch/arm/mach-k3/am6_init.c | 96 ++++++++++++++- arch/arm/mach-k3/include/mach/am6_hardware.h | 2 + arch/arm/mach-k3/include/mach/am6_spl.h | 3 +- arch/arm/mach-k3/sysfw-loader.c | 11 ++ common/spl/spl_usb.c | 31 +++-- configs/am65x_evm_a53_defconfig | 9 ++ configs/am65x_evm_r5_usbdfu_defconfig | 119 +++++++++++++++++++ configs/am65x_evm_r5_usbmsc_defconfig | 119 +++++++++++++++++++ include/configs/am65x_evm.h | 10 +- include/spl.h | 14 +++ 12 files changed, 461 insertions(+), 15 deletions(-) create mode 100644 configs/am65x_evm_r5_usbdfu_defconfig create mode 100644 configs/am65x_evm_r5_usbmsc_defconfig
Signature · 1 line
2.17.1
PATCH 1/13 spl: usb: Create an API spl_usb_load()
Create a new API spl_usb_load() that takes the filename as a parameter instead of taking the default U-boot PAYLOAD_NAME
--- common/spl/spl_usb.c | 20 +++++++++++++------- include/spl.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 7 deletions(-)
common/spl/spl_usb.c +13 -7
@@ -18,8 +18,9 @@static int usb_stor_curr_dev =-1 ;/* current device */ -static int spl_usb_load_image (struct spl_image_info *spl_image, -struct spl_boot_device *bootdev) +int spl_usb_load (struct spl_image_info *spl_image, +struct spl_boot_device *bootdev,int partition, +const char *filename) {int err;struct blk_desc *stor_dev;
@@ -43,13 +44,10 @@ static int spl_usb_load_image(struct spl_image_info *spl_image,#ifdef CONFIG_SPL_OS_BOOT if (spl_start_uboot () || -spl_load_image_fat_os (spl_image, stor_dev, - CONFIG_SYS_USB_FAT_BOOT_PARTITION)) + spl_load_image_fat_os(spl_image, stor_dev, partition))#endif { - err =spl_load_image_fat (spl_image, stor_dev, -CONFIG_SYS_USB_FAT_BOOT_PARTITION , -CONFIG_SPL_FS_LOAD_PAYLOAD_NAME ); + err =spl_load_image_fat (spl_image, stor_dev, partition, filename); }if (err) {
@@ -59,4 +57,12 @@ static int spl_usb_load_image(struct spl_image_info *spl_image,return 0 ; } + +static int spl_usb_load_image (struct spl_image_info *spl_image, +struct spl_boot_device *bootdev) +{ +return spl_usb_load (spl_image, bootdev, +CONFIG_SYS_USB_FAT_BOOT_PARTITION , +CONFIG_SPL_FS_LOAD_PAYLOAD_NAME ); +}SPL_LOAD_IMAGE_METHOD ("USB" ,0 ,BOOT_DEVICE_USB , spl_usb_load_image);
include/spl.h +14 -0
@@ -503,6 +503,20 @@ int spl_mmc_load(struct spl_image_info *spl_image,int raw_part, unsigned long raw_sect); +/** +* spl_usb_load() - Load an image file from USB mass storage +* +* @param spl_image Image data filled in by loading process +* @param bootdev Describes which device to load from +* @param raw_part Fat partition to load from +* @param filename Name of file to load +* +* @return 0 on success, otherwise error code +*/ +int spl_usb_load (struct spl_image_info *spl_image, +struct spl_boot_device *bootdev, +int partition,const char *filename); +int spl_ymodem_load_image (struct spl_image_info *spl_image,struct spl_boot_device *bootdev);
Signature · 1 line
2.17.1
PATCH 2/13 spl: usb: Only init usb once
In reply to Faiz Abbasusb_init() may be called multiple times for fetching multiple images from SPL. Skip reinitializing USB if its already been done
--- common/spl/spl_usb.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
common/spl/spl_usb.c +8 -3
@@ -22,11 +22,16 @@ int spl_usb_load(struct spl_image_info *spl_image, struct spl_boot_device *bootdev, int partition, const char *filename) { - int err; + int err = 0;struct blk_desc *stor_dev; +static bool usb_init_pending = true; + +if (usb_init_pending) { +usb_stop (); + err =usb_init (); + usb_init_pending = false; + } -usb_stop (); - err =usb_init ();if (err) {#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("%s: usb init failed: err - %d\n" , __func__, err);
Signature · 1 line
2.17.1
PATCH 3/13 armv7R: K3: am654: Use full malloc in SPL both pre and post reloc
In reply to Faiz AbbasIn order to be able to use things like file system drivers early on in SPL (before relocation) in a memory-constrained environment when DDR is not yet available we cannot use the simple malloc scheme which does not implement the freeing of previously allocated memory blocks. To address this issue go ahead and enable the use of the full malloc by manually initializing the required functionality inside board_init_f by creating a full malloc pool inside the pre-relocation malloc pool.
--- arch/arm/mach-k3/am6_init.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/arm/mach-k3/am6_init.c +18 -0
@@ -18,7 +18,9 @@#include <dm/uclass-internal.h> #include <dm/pinctrl.h> #include <linux/soc/ti/ti_sci_protocol.h> +#include <log.h> #include <mmc.h> +#include <stdlib.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW
@@ -119,6 +121,8 @@ void board_init_f(ulong dummy) {#if defined(CONFIG_K3_LOAD_SYSFW ) || defined(CONFIG_K3_AM654_DDRSS )struct udevice *dev; +size_t pool_size; +void *pool_addr;int ret;#endif /*
@@ -149,6 +153,20 @@ void board_init_f(ulong dummy)#endif #ifdef CONFIG_K3_LOAD_SYSFW +/* +* Initialize an early full malloc environment. Do so by allocating a +* new malloc area inside the currently active pre-relocation "first" +* malloc pool of which we use all that's left. +*/ + pool_size =CONFIG_VAL (SYS_MALLOC_F_LEN ) - gd->malloc_ptr; + pool_addr =malloc (pool_size); +if (!pool_addr) +panic ("ERROR: Can't allocate full malloc pool!\n" ); + +mem_malloc_init ((ulong )pool_addr, (ulong )pool_size); + gd->flags |=GD_FLG_FULL_MALLOC_INIT ; +debug ("%s: initialized an early full malloc pool at 0x%08lx of 0x%lx bytes\n" , + __func__, (unsigned long )pool_addr, (unsigned long )pool_size);/* * Process pinctrl for the serial0 a.k.a. WKUP_UART0 module and continue * regardless of the result of pinctrl. Do this without probing the
Signature · 1 line
2.17.1
PATCH 4/13 arm: mach-k3: sysfw-loader: Add support to load SYSFW from USB
In reply to Faiz AbbasAdd support for loading system firmware from a USB mass storage device
--- arch/arm/mach-k3/sysfw-loader.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm/mach-k3/sysfw-loader.c +11 -0
@@ -299,6 +299,17 @@ void k3_sysfw_loader(void (*config_pm_pre_callback) (void), ret =k3_sysfw_dfu_download (sysfw_load_address);break ;#endif +#if CONFIG_IS_ENABLED (USB_STORAGE ) +case BOOT_DEVICE_USB : + ret =spl_usb_load (&spl_image, &bootdev, +CONFIG_SYS_USB_FAT_BOOT_PARTITION , +#ifdef CONFIG_K3_SYSFW_IMAGE_NAME +CONFIG_K3_SYSFW_IMAGE_NAME ); +#else + NULL); +#endif +#endif +break ;default :panic ("Loading SYSFW image from device %u not supported!\n" , bootdev.boot_device);
Signature · 1 line
2.17.1
PATCH 5/13 arm: mach-k3: am6_init: Gate mmc related configurations with the appropriate config
In reply to Faiz AbbasGate mmc related system related configurations with DM_MMC to avoid build errors when MMC is not enabled
--- arch/arm/mach-k3/am6_init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/mach-k3/am6_init.c +4 -1
@@ -90,7 +90,7 @@ static void store_boot_index_from_rom(void) bootindex = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX ); } -#if defined(CONFIG_K3_LOAD_SYSFW ) +#if defined(CONFIG_K3_LOAD_SYSFW ) &&CONFIG_IS_ENABLED (DM_MMC )void k3_mmc_stop_clock (void ) {if (spl_boot_device () ==BOOT_DEVICE_MMC1 ) {
@@ -115,6 +115,9 @@ void k3_mmc_restart_clock(void) mmc_set_clock(mmc, mmc->saved_clock, false); } } +#else +void k3_mmc_stop_clock (void ) {} +void k3_mmc_restart_clock (void ) {}#endif void board_init_f (ulong dummy)
Signature · 1 line
2.17.1
PATCH 6/13 arm: mach-k3: am6_init: Do USB fixups to facilitate host and device boot modes
In reply to Faiz AbbasU-boot only supports either USB host or device mode for a node at a time in dts To support both host and dfu bootmodes, set "peripheral" as the default dr_mode but fixup property to "host" if host bootmode is detected
This needs to happen before the dwc3 generic layer binds the usb device to a host or device driver. Therefore, open code the configurations in spl_early_init() and add the fixup after the fdtdec_setup() and before the dm_init_scan()
Also use the same fixup function to set the USB-PCIe Serdes mux to PCIe in both the host and device cases. This is required for accessing the interface at USB 2.0 speeds
--- arch/arm/mach-k3/am6_init.c | 68 +++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-)
arch/arm/mach-k3/am6_init.c +66 -2
@@ -7,6 +7,7 @@*/ #include <common.h> +#include <fdt_support.h> #include <init.h> #include <asm/io.h> #include <spl.h>
@@ -17,11 +18,15 @@#include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <dm/root.h> +#include <linux/compiler.h> #include <linux/soc/ti/ti_sci_protocol.h> #include <log.h> #include <mmc.h> #include <stdlib.h> +DECLARE_GLOBAL_DATA_PTR ; +#ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW #ifdef CONFIG_TI_SECURE_DEVICE
@@ -119,7 +124,67 @@ void k3_mmc_restart_clock(void)void k3_mmc_stop_clock (void ) {}void k3_mmc_restart_clock (void ) {}#endif +#if CONFIG_IS_ENABLED (DFU ) ||CONFIG_IS_ENABLED (USB_STORAGE ) +#define CTRLMMR_SERDES0_CTRL 0x00104080 +#define PCIE_LANE0 0x1 +void fixup_usb_boot (void ) +{ +int ret; +switch (spl_boot_device ()) { +case BOOT_DEVICE_USB : +/* +* If bootmode is Host bootmode, fixup the dr_mode to host +* before the dwc3 bind takes place +*/ + ret =fdt_find_and_setprop ((void *)gd->fdt_blob, +"/interconnect at 100000/dwc3 at 4000000/usb at 10000" , +"dr_mode" ,"host" ,11 ,0 ); +if (ret) +printf ("%s: fdt_find_and_setprop() failed:%d\n" , __func__, + ret); +/* fallthrough */ +case BOOT_DEVICE_DFU : +/* +* The serdes mux between PCIe and USB3 needs to be set to PCIe for +* accessing the interface at USB 2.0 +*/ +writel (PCIE_LANE0 ,CTRLMMR_SERDES0_CTRL ); +default : + ; + } +} +#endif +int am6_spl_early_init (void ) +{ +int ret; +#if CONFIG_VAL (SYS_MALLOC_F_LEN ) +#ifdef CONFIG_MALLOC_F_ADDR + gd->malloc_base =CONFIG_MALLOC_F_ADDR ; +#endif + gd->malloc_limit =CONFIG_VAL (SYS_MALLOC_F_LEN ); + gd->malloc_ptr =0 ; +#endif + ret =fdtdec_setup (); +if (ret) { +printf ("fdtdec_setup() returned error %d\n" , ret); +return ret; + } + +#if CONFIG_IS_ENABLED (DFU ) ||CONFIG_IS_ENABLED (USB_STORAGE ) +fixup_usb_boot (); +#endif +/* With CONFIG_SPL_OF_PLATDATA, bring in all devices */ + ret =dm_init_and_scan (!CONFIG_IS_ENABLED (OF_PLATDATA )); +if (ret) { +printf ("dm_init_and_scan() returned error %d\n" , ret); +return ret; + } + + gd->flags |=GD_FLG_SPL_EARLY_INIT ; + +return 0 ; +}void board_init_f (ulong dummy) {#if defined(CONFIG_K3_LOAD_SYSFW ) || defined(CONFIG_K3_AM654_DDRSS )
@@ -141,9 +206,8 @@ void board_init_f(ulong dummy)disable_linefill_optimization ();setup_k3_mpu_regions ();#endif -/* Init DM early in-order to invoke system controller */ -spl_early_init (); +am6_spl_early_init ();#ifdef CONFIG_K3_EARLY_CONS /*
Signature · 1 line
2.17.1
PATCH 6/13 arm: mach-k3: am6_init: Do USB fixups to facilitate host and device boot modes
Hi,
On 02/07/20 1:32 pm, Faiz Abbas wrote:
[...]
Quoted 1 line
int
am6_spl_early_init(void)
Can this be static or do you intend to use this outside of this func file?
Quoted 33 lines
arch/arm/mach-k3/am6_init.c +29
-0+{ +int ret; +#if CONFIG_VAL (SYS_MALLOC_F_LEN ) +#ifdef CONFIG_MALLOC_F_ADDR + gd->malloc_base =CONFIG_MALLOC_F_ADDR ; +#endif + gd->malloc_limit =CONFIG_VAL (SYS_MALLOC_F_LEN ); + gd->malloc_ptr =0 ; +#endif + ret =fdtdec_setup (); +if (ret) { +printf ("fdtdec_setup() returned error %d\n" , ret); +return ret; + } + +#if CONFIG_IS_ENABLED (DFU ) ||CONFIG_IS_ENABLED (USB_STORAGE ) +fixup_usb_boot (); +#endif +/* With CONFIG_SPL_OF_PLATDATA, bring in all devices */ + ret =dm_init_and_scan (!CONFIG_IS_ENABLED (OF_PLATDATA )); +if (ret) { +printf ("dm_init_and_scan() returned error %d\n" , ret); +return ret; + } + + gd->flags |=GD_FLG_SPL_EARLY_INIT ; + +return 0 ; +}void board_init_f (ulong dummy) {#if defined(CONFIG_K3_LOAD_SYSFW ) || defined(CONFIG_K3_AM654_DDRSS )
arch/arm/mach-k3/am6_init.c void board_init_f(ulong dummy) · line 146
Quoted 6 lines
arch/arm/mach-k3/am6_init.c +0
-2@@ -141,9 +206,8 @@ void board_init_f(ulong dummy)disable_linefill_optimization ();setup_k3_mpu_regions ();#endif -/* Init DM early in-order to invoke system controller */ -spl_early_init ();
I don't like this part as patch now open codes part of spl_early_init() here and any fixes/enhancements to that core code would not be available for am6 unless explicitly ported....
How about having a arch specific post fdtdec_setup() hook instead, that gets called from spl_common_init()?
arch/arm/mach-k3/am6_init.c void board_init_f(ulong dummy)
Quoted 5 lines
arch/arm/mach-k3/am6_init.c +1
-1+am6_spl_early_init ();#ifdef CONFIG_K3_EARLY_CONS /* -- 2.17.1
Regards
Vignesh
PATCH 6/13 arm: mach-k3: am6_init: Do USB fixups to facilitate host and device boot modes
Hi Vignesh,
Quoted 8 lines · Vignesh Raghavendra
Hi,
On 02/07/20 1:32 pm, Faiz Abbas wrote:
[...]
Quoted 1 line
int
am6_spl_early_init(void)Can this be static or do you intend to use this outside of this func file?
Fixed this in v2.
Quoted 45 lines
Quoted 34 lines
arch/arm/mach-k3/am6_init.c +29
-0+{ +int ret; +#if CONFIG_VAL (SYS_MALLOC_F_LEN ) +#ifdef CONFIG_MALLOC_F_ADDR + gd->malloc_base =CONFIG_MALLOC_F_ADDR ; +#endif + gd->malloc_limit =CONFIG_VAL (SYS_MALLOC_F_LEN ); + gd->malloc_ptr =0 ; +#endif + ret =fdtdec_setup (); +if (ret) { +printf ("fdtdec_setup() returned error %d\n" , ret); +return ret; + } + +#if CONFIG_IS_ENABLED (DFU ) ||CONFIG_IS_ENABLED (USB_STORAGE ) +fixup_usb_boot (); +#endif +/* With CONFIG_SPL_OF_PLATDATA, bring in all devices */ + ret =dm_init_and_scan (!CONFIG_IS_ENABLED (OF_PLATDATA )); +if (ret) { +printf ("dm_init_and_scan() returned error %d\n" , ret); +return ret; + } + + gd->flags |=GD_FLG_SPL_EARLY_INIT ; + +return 0 ; +}void board_init_f (ulong dummy) {#if defined(CONFIG_K3_LOAD_SYSFW ) || defined(CONFIG_K3_AM654_DDRSS )arch/arm/mach-k3/am6_init.c void board_init_f(ulong dummy) · line 146
Quoted 6 lines
arch/arm/mach-k3/am6_init.c +0
-2@@ -141,9 +206,8 @@ void board_init_f(ulong dummy)disable_linefill_optimization ();setup_k3_mpu_regions ();#endif -/* Init DM early in-order to invoke system controller */ -spl_early_init ();I don't like this part as patch now open codes part of
spl_early_init()here and any fixes/enhancements to that core code would not be available for am6 unless explicitly ported....
Quoted 3 lines
How about having a arch specific post
fdtdec_setup()hook instead, that gets called fromspl_common_init()?
there was an fdtdec_board_setup() which can be overridden for this. Implemented using that in v2.
Thanks,
Faiz
PATCH 6/13 arm: mach-k3: am6_init: Do USB fixups to facilitate host and device boot modes
In reply to Faiz AbbasQuoted 113 lines · Faiz Abbas
U-boot only supports either USB host or device mode for a node at a time in dts To support both host and dfu bootmodes, set "peripheral" as the default
dr_modebut fixup property to "host" if host bootmode is detectedThis needs to happen before the dwc3 generic layer binds the usb device to a host or device driver. Therefore, open code the configurations in
spl_early_init()and add the fixup after thefdtdec_setup()and before thedm_init_scan()Also use the same fixup function to set the USB-PCIe Serdes mux to PCIe in both the host and device cases. This is required for accessing the interface at USB 2.0 speeds
Signed-off-by Faiz Abbas <[email protected]>--- arch/arm/mach-k3/am6_init.c | 68 +++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-)arch/arm/mach-k3/am6_init.c +65
-0@@ -7,6 +7,7 @@*/ #include <common.h> +#include <fdt_support.h> #include <init.h> #include <asm/io.h> #include <spl.h> @@ -17,11 +18,15 @@#include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <dm/root.h> +#include <linux/compiler.h> #include <linux/soc/ti/ti_sci_protocol.h> #include <log.h> #include <mmc.h> #include <stdlib.h> +DECLARE_GLOBAL_DATA_PTR ; +#ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW #ifdef CONFIG_TI_SECURE_DEVICE @@ -119,7 +124,67 @@ void k3_mmc_restart_clock(void)void k3_mmc_stop_clock (void ) {}void k3_mmc_restart_clock (void ) {}#endif +#if CONFIG_IS_ENABLED (DFU ) ||CONFIG_IS_ENABLED (USB_STORAGE ) +#define CTRLMMR_SERDES0_CTRL 0x00104080 +#define PCIE_LANE0 0x1 +void fixup_usb_boot (void ) +{ +int ret; +switch (spl_boot_device ()) { +case BOOT_DEVICE_USB : +/* +* If bootmode is Host bootmode, fixup the dr_mode to host +* before the dwc3 bind takes place +*/ + ret =fdt_find_and_setprop ((void *)gd->fdt_blob, +"/interconnect at 100000/dwc3 at 4000000/usb at 10000" , +"dr_mode" ,"host" ,11 ,0 ); +if (ret) +printf ("%s: fdt_find_and_setprop() failed:%d\n" , __func__, + ret); +/* fallthrough */ +case BOOT_DEVICE_DFU : +/* +* The serdes mux between PCIe and USB3 needs to be set to PCIe for +* accessing the interface at USB 2.0 +*/ +writel (PCIE_LANE0 ,CTRLMMR_SERDES0_CTRL ); +default : + ; + } +} +#endif +int am6_spl_early_init (void ) +{ +int ret; +#if CONFIG_VAL (SYS_MALLOC_F_LEN ) +#ifdef CONFIG_MALLOC_F_ADDR + gd->malloc_base =CONFIG_MALLOC_F_ADDR ; +#endif + gd->malloc_limit =CONFIG_VAL (SYS_MALLOC_F_LEN ); + gd->malloc_ptr =0 ; +#endif + ret =fdtdec_setup (); +if (ret) { +printf ("fdtdec_setup() returned error %d\n" , ret); +return ret; + } + +#if CONFIG_IS_ENABLED (DFU ) ||CONFIG_IS_ENABLED (USB_STORAGE ) +fixup_usb_boot (); +#endif +/* With CONFIG_SPL_OF_PLATDATA, bring in all devices */ + ret =dm_init_and_scan (!CONFIG_IS_ENABLED (OF_PLATDATA )); +if (ret) { +printf ("dm_init_and_scan() returned error %d\n" , ret); +return ret; + } + + gd->flags |=GD_FLG_SPL_EARLY_INIT ; + +return 0 ; +}void board_init_f (ulong dummy) {#if defined(CONFIG_K3_LOAD_SYSFW ) || defined(CONFIG_K3_AM654_DDRSS )
arch/arm/mach-k3/am6_init.c void board_init_f(ulong dummy) · line 210
Quoted 7 lines
arch/arm/mach-k3/am6_init.c +1
-2@@ -141,9 +206,8 @@ void board_init_f(ulong dummy)disable_linefill_optimization ();setup_k3_mpu_regions ();#endif -/* Init DM early in-order to invoke system controller */ -spl_early_init (); +am6_spl_early_init ();
Nack. Try the below sequence for your case:
- spl_early_init
- if (usb dt fixup required)
fdt_fixups()
device_remove
dm_init.
Thanks and regards,
Lokesh
PATCH 7/13 arm: mach-k3: am6_init: Add support for USB boot mode
In reply to Faiz AbbasAdd support for identifying USB host and device boot modes
--- arch/arm/mach-k3/am6_init.c | 5 +++++ arch/arm/mach-k3/include/mach/am6_hardware.h | 2 ++ arch/arm/mach-k3/include/mach/am6_spl.h | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-)
arch/arm/mach-k3/am6_init.c +5 -0
@@ -357,6 +357,11 @@ static u32 __get_primary_bootmedia(u32 devstat)CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_SHIFT ;if (port ==0x1 ) bootmode =BOOT_DEVICE_MMC2 ; + }else if (bootmode ==BOOT_DEVICE_DFU ) { +u32 mode = (devstat &CTRLMMR_MAIN_DEVSTAT_USB_MODE_MASK ) >> +CTRLMMR_MAIN_DEVSTAT_USB_MODE_SHIFT ; +if (mode ==0x2 ) + bootmode =BOOT_DEVICE_USB ; }return bootmode;
arch/arm/mach-k3/include/mach/am6_hardware.h +2 -0
@@ -25,6 +25,8 @@#define CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_SHIFT 14#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_MASK GENMASK(17, 17)#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 12 +#define CTRLMMR_MAIN_DEVSTAT_USB_MODE_SHIFT 9 +#define CTRLMMR_MAIN_DEVSTAT_USB_MODE_MASK GENMASK(10, 9)#define WKUP_CTRL_MMR0_BASE 0x43000000#define MCU_CTRL_MMR0_BASE 0x40f00000
arch/arm/mach-k3/include/mach/am6_spl.h +2 -1
@@ -14,7 +14,8 @@#define BOOT_DEVICE_I2C 0x05#define BOOT_DEVICE_MMC2 0x06#define BOOT_DEVICE_ETHERNET 0x07 -#define BOOT_DEVICE_USB 0x08 +#define BOOT_DEVICE_DFU 0x08 +#define BOOT_DEVICE_USB 0x408#define BOOT_DEVICE_PCIE 0x09#define BOOT_DEVICE_UART 0x0a#define BOOT_DEVICE_NAND 0x0c
Signature · 1 line
2.17.1
PATCH 8/13 arm: dts: k3-am654-r5-base-board: Add USB0 nodes
In reply to Faiz AbbasAdd USB0 nodes and set them to host mode to support USB host and peripheral boot modes
--- arch/arm/dts/k3-am654-r5-base-board.dts | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
arch/arm/dts/k3-am654-r5-base-board.dts +35 -0
@@ -278,3 +278,38 @@ #size-cells = <1>; }; }; + +&main_pmx0 { + u-boot,dm-spl; + usb0_pins_default: usb0_pins_default { + pinctrl-single,pins = < + AM65X_IOPAD(0x02bc, PIN_OUTPUT, 0) /* (AD9) USB0_DRVVBUS */ + >; + u-boot,dm-spl; + }; +}; + +&dwc3_0 { + status = "okay"; + u-boot,dm-spl; + /delete-property/ power-domains; + /delete-property/ assigned-clocks; + /delete-property/ assigned-clock-parents; +}; + +&usb0_phy { + status = "okay"; + u-boot,dm-spl; + /delete-property/ clocks; +}; + +&usb0 { + pinctrl-names = "default"; + pinctrl-0 = <&usb0_pins_default>; + dr_mode = "peripheral"; + u-boot,dm-spl; +}; + +&scm_conf { + u-boot,dm-spl; +};
Signature · 1 line
2.17.1
PATCH 9/13 arm: dts: k3-am654-base-board: Add support for USB0 in SPL
In reply to Faiz AbbasAdd nodes for USB0 in SPL to enable USB host boot mode
--- arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+)
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +27 -0
@@ -287,6 +287,12 @@ u-boot,dm-spl; }; + usb0_pins_default: usb0_pins_default { + pinctrl-single,pins = < + AM65X_IOPAD(0x02bc, PIN_OUTPUT, 0) /* (AD9) USB0_DRVVBUS */ + >; + u-boot,dm-spl; + }; }; &main_pmx1 {
@@ -393,3 +399,24 @@ u-boot,dm-spl; }; }; + +&dwc3_0 { + status = "okay"; + u-boot,dm-spl; +}; + +&usb0_phy { + status = "okay"; + u-boot,dm-spl; +}; + +&usb0 { + pinctrl-names = "default"; + pinctrl-0 = <&usb0_pins_default>; + dr_mode = "peripheral"; + u-boot,dm-spl; +}; + +&scm_conf { + u-boot,dm-spl; +};
Signature · 1 line
2.17.1
PATCH 10/13 configs: am65x_evm: Add support for DFU related configs
In reply to Faiz AbbasAdd offset and environment related configs used for booting from DFU.
--- include/configs/am65x_evm.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
include/configs/am65x_evm.h +7 -1
@@ -22,6 +22,9 @@#ifdef CONFIG_TARGET_AM654_A53_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 +#define CONFIG_SYS_DFU_DATA_BUF_SIZE 0x20000#else /* * Maximum size in memory allocated to the SPL BSS. Keep it as tight as
@@ -44,6 +47,9 @@/* 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 +#define CONFIG_SYS_DFU_DATA_BUF_SIZE 0x5000#endif #ifdef CONFIG_SYS_K3_SPL_ATF
@@ -124,8 +130,8 @@"rootfstype=ubifs root=ubi0:rootfs rw ubi.mtd=ospi.rootfs\0" #define EXTRA_ENV_DFUARGS \ -"dfu_bufsiz=0x20000\0" \DFU_ALT_INFO_MMC \ +DFU_ALT_INFO_RAM \DFU_ALT_INFO_EMMC \DFU_ALT_INFO_OSPI
Signature · 1 line
2.17.1
PATCH 11/13 configs: am65x_evm_a53: Enable USB Mass storage and DFU boot modes
In reply to Faiz AbbasEnable configs to facilitate booting from USB Mass Storage devices as well as USB peripheral boot
--- configs/am65x_evm_a53_defconfig | 9 +++++++++ include/configs/am65x_evm.h | 2 ++ 2 files changed, 11 insertions(+)
configs/am65x_evm_a53_defconfig +9 -0
@@ -33,14 +33,20 @@ CONFIG_SPL_SEPARATE_BSS=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400 CONFIG_SPL_DMA=y +CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_DM_MAILBOX=y CONFIG_SPL_MTD_SUPPORT=y CONFIG_SPL_DM_RESET=y CONFIG_SPL_POWER_DOMAIN=y +CONFIG_SPL_RAM_SUPPORT=y # CONFIG_SPL_SPI_FLASH_TINY is not set CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y CONFIG_SPL_SPI_LOAD=y +CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_USB_STORAGE=y +CONFIG_SPL_USB_GADGET=y +CONFIG_SPL_DFU=y CONFIG_SPL_YMODEM_SUPPORT=y CONFIG_CMD_ASKENV=y CONFIG_CMD_DFU=y
@@ -69,6 +75,7 @@ CONFIG_DM=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_REGMAP=y +CONFIG_SPL_SYSCON=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_CLK=y CONFIG_SPL_CLK=y
@@ -109,6 +116,7 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_PCI_KEYSTONE=y CONFIG_PHY=y +CONFIG_SPL_PHY=y CONFIG_AM654_PHY=y CONFIG_OMAP_USB2_PHY=y CONFIG_PINCTRL=y
@@ -132,6 +140,7 @@ CONFIG_SYSRESET_TI_SCI=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_DM_USB_GADGET=y +CONFIG_SPL_DM_USB_GADGET=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_DWC3=y
include/configs/am65x_evm.h +2 -0
@@ -152,6 +152,8 @@#define CONFIG_SYS_MMC_ENV_PART 1#endif +#define CONFIG_SYS_USB_FAT_BOOT_PARTITION 1 +/* Now for the remaining common defines */ #include <configs/ti_armv7_common.h>
Signature · 1 line
2.17.1
PATCH 12/13 configs: Add new config for supporting USB mass storage boot
In reply to Faiz AbbasBecause of space constraints, create a new USB defconfig for R5 to faciliate booting from USB mass storage devices
--- configs/am65x_evm_r5_usbmsc_defconfig | 119 ++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 configs/am65x_evm_r5_usbmsc_defconfig
configs/am65x_evm_r5_usbmsc_defconfig new file +119 -0
@@ -0,0 +1,119 @@ +CONFIG_ARM=y +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_SOC_K3_AM6=y +CONFIG_K3_EARLY_CONS=y +CONFIG_TARGET_AM654_R5_EVM=y +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y +CONFIG_ENV_SIZE=0x20000 +CONFIG_SPL_STACK_R_ADDR=0x82000000 +CONFIG_NR_DRAM_BANKS=2 +CONFIG_SPL_FS_FAT=y +CONFIG_SPL_LIBDISK_SUPPORT=y +CONFIG_SPL_TEXT_BASE=0x41c00000 +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_SPL_LOAD_FIT=y +CONFIG_USE_BOOTCOMMAND=y +# CONFIG_DISPLAY_CPUINFO is not set +CONFIG_SPL_STACK_R=y +CONFIG_SPL_SEPARATE_BSS=y +CONFIG_SPL_EARLY_BSS=y +CONFIG_SPL_DMA=y +CONFIG_SPL_ENV_SUPPORT=y +CONFIG_SPL_I2C_SUPPORT=y +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_REMOTEPROC=y +CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_USB_STORAGE=y +CONFIG_SPL_USB_GADGET=y +CONFIG_SPL_YMODEM_SUPPORT=y +CONFIG_HUSH_PARSER=y +CONFIG_CMD_BOOTZ=y +CONFIG_CMD_ASKENV=y +CONFIG_CMD_GPT=y +CONFIG_CMD_I2C=y +CONFIG_CMD_REMOTEPROC=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_TIME=y +CONFIG_CMD_FAT=y +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="k3-am654-r5-base-board" +CONFIG_SPL_MULTI_DTB_FIT=y +CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_DM=y +CONFIG_SPL_DM=y +CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_REGMAP=y +CONFIG_SPL_REGMAP=y +CONFIG_SYSCON=y +CONFIG_SPL_SYSCON=y +CONFIG_SPL_OF_TRANSLATE=y +CONFIG_BLK=y +CONFIG_CLK=y +CONFIG_SPL_CLK=y +CONFIG_CLK_TI_SCI=y +CONFIG_TI_SCI_PROTOCOL=y +CONFIG_DM_GPIO=y +CONFIG_DA8XX_GPIO=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_SYS_I2C_OMAP24XX=y +CONFIG_DM_MAILBOX=y +CONFIG_K3_SEC_PROXY=y +CONFIG_MISC=y +CONFIG_K3_AVS0=y +# CONFIG_MMC is not set +CONFIG_PHY=y +CONFIG_SPL_PHY=y +CONFIG_OMAP_USB2_PHY=y +CONFIG_PINCTRL=y +# CONFIG_PINCTRL_GENERIC is not set +CONFIG_SPL_PINCTRL=y +# CONFIG_SPL_PINCTRL_GENERIC is not set +CONFIG_PINCTRL_SINGLE=y +CONFIG_POWER_DOMAIN=y +CONFIG_TI_SCI_POWER_DOMAIN=y +CONFIG_DM_REGULATOR=y +CONFIG_SPL_DM_REGULATOR=y +CONFIG_DM_REGULATOR_GPIO=y +CONFIG_SPL_DM_REGULATOR_GPIO=y +CONFIG_DM_REGULATOR_TPS62360=y +CONFIG_RAM=y +CONFIG_SPL_RAM=y +CONFIG_K3_SYSTEM_CONTROLLER=y +CONFIG_REMOTEPROC_TI_K3_ARM64=y +CONFIG_DM_RESET=y +CONFIG_RESET_TI_SCI=y +CONFIG_DM_SERIAL=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +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_XHCI_HCD=y +CONFIG_USB_XHCI_DWC3=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GENERIC=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" +CONFIG_USB_GADGET_VENDOR_NUM=0x0451 +CONFIG_USB_GADGET_PRODUCT_NUM=0x6162 +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
Signature · 1 line
2.17.1
PATCH 13/13 configs: Add defconfig for USB DFU bootmode
In reply to Faiz AbbasBecause of space constraints, create a new USB defconfig for R5 to faciliate booting in USB peripheral (DFU) bootmode
--- configs/am65x_evm_r5_usbdfu_defconfig | 119 ++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 configs/am65x_evm_r5_usbdfu_defconfig
configs/am65x_evm_r5_usbdfu_defconfig new file +119 -0
@@ -0,0 +1,119 @@ +CONFIG_ARM=y +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_SOC_K3_AM6=y +CONFIG_K3_EARLY_CONS=y +CONFIG_TARGET_AM654_R5_EVM=y +CONFIG_ENV_SIZE=0x20000 +CONFIG_DM_GPIO=y +CONFIG_SPL_TEXT_BASE=0x41c00000 +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y +CONFIG_SPL_STACK_R_ADDR=0x82000000 +CONFIG_NR_DRAM_BANKS=2 +CONFIG_SPL_FS_FAT=y +CONFIG_SPL_LIBDISK_SUPPORT=y +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_SPL_LOAD_FIT=y +CONFIG_USE_BOOTCOMMAND=y +# CONFIG_DISPLAY_CPUINFO is not set +CONFIG_SPL_STACK_R=y +CONFIG_SPL_SEPARATE_BSS=y +CONFIG_SPL_EARLY_BSS=y +CONFIG_SPL_DMA=y +CONFIG_SPL_ENV_SUPPORT=y +CONFIG_SPL_I2C_SUPPORT=y +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_REMOTEPROC=y +CONFIG_SPL_USB_GADGET=y +CONFIG_SPL_DFU=y +CONFIG_SPL_YMODEM_SUPPORT=y +CONFIG_HUSH_PARSER=y +CONFIG_CMD_BOOTZ=y +CONFIG_CMD_ASKENV=y +CONFIG_CMD_DFU=y +CONFIG_CMD_GPT=y +CONFIG_CMD_I2C=y +CONFIG_CMD_REMOTEPROC=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_TIME=y +CONFIG_CMD_FAT=y +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="k3-am654-r5-base-board" +CONFIG_SPL_MULTI_DTB_FIT=y +CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_DM=y +CONFIG_SPL_DM=y +CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_REGMAP=y +CONFIG_SPL_REGMAP=y +CONFIG_SYSCON=y +CONFIG_SPL_SYSCON=y +CONFIG_SPL_OF_TRANSLATE=y +CONFIG_BLK=y +CONFIG_CLK=y +CONFIG_SPL_CLK=y +CONFIG_CLK_TI_SCI=y +CONFIG_TI_SCI_PROTOCOL=y +CONFIG_DA8XX_GPIO=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_SYS_I2C_OMAP24XX=y +CONFIG_DM_MAILBOX=y +CONFIG_K3_SEC_PROXY=y +CONFIG_MISC=y +CONFIG_K3_AVS0=y +# CONFIG_MMC is not set +CONFIG_PHY=y +CONFIG_SPL_PHY=y +CONFIG_OMAP_USB2_PHY=y +CONFIG_PINCTRL=y +# CONFIG_PINCTRL_GENERIC is not set +CONFIG_SPL_PINCTRL=y +# CONFIG_SPL_PINCTRL_GENERIC is not set +CONFIG_PINCTRL_SINGLE=y +CONFIG_POWER_DOMAIN=y +CONFIG_TI_SCI_POWER_DOMAIN=y +CONFIG_DM_REGULATOR=y +CONFIG_SPL_DM_REGULATOR=y +CONFIG_DM_REGULATOR_GPIO=y +CONFIG_SPL_DM_REGULATOR_GPIO=y +CONFIG_DM_REGULATOR_TPS62360=y +CONFIG_RAM=y +CONFIG_SPL_RAM=y +CONFIG_K3_SYSTEM_CONTROLLER=y +CONFIG_REMOTEPROC_TI_K3_ARM64=y +CONFIG_DM_RESET=y +CONFIG_RESET_TI_SCI=y +CONFIG_DM_SERIAL=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +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_XHCI_HCD=y +CONFIG_USB_XHCI_DWC3=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GENERIC=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" +CONFIG_USB_GADGET_VENDOR_NUM=0x0451 +CONFIG_USB_GADGET_PRODUCT_NUM=0x6162 +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
Signature · 1 line
2.17.1