[U-Boot] [PATCH 0/3] AM437x: Add runtime DTB selection for QSPI Boot

With SPI framework moving to DM only mode, am437x QSPI XIP boot needs to move to runtime DTB selection to chose proper DT for IDK vs SK. This series adds generic DT file for board detection which is replaced with actual DT once after board discovery via EEPROM. Approach is similar to what is done with K2G EVM.
Tested on AM437x SK and IDK boards. Sanity tested on AM437x GP EVM.
Vignesh R (3): board: ti: am43xx: Define embedded_dtb_select for runtime DTB selection in U-boot ARM: dts: Add new "generic" am4372 device tree file. configs: am43xx_evm_qspiboot_defconfig: Move to DM
arch/arm/dts/Makefile | 3 ++- arch/arm/dts/am4372-generic-u-boot.dtsi | 15 +++++++++++++++ arch/arm/dts/am4372-generic.dts | 24 ++++++++++++++++++++++++ arch/arm/dts/am437x-idk-evm-u-boot.dtsi | 23 +++++++++++++++++++++++ arch/arm/dts/am437x-sk-evm-u-boot.dtsi | 23 +++++++++++++++++++++++ board/ti/am43xx/board.c | 18 ++++++++++++++++-- configs/am43xx_evm_qspiboot_defconfig | 10 +++++++++- 7 files changed, 112 insertions(+), 4 deletions(-) create mode 100644 arch/arm/dts/am4372-generic-u-boot.dtsi create mode 100644 arch/arm/dts/am4372-generic.dts create mode 100644 arch/arm/dts/am437x-idk-evm-u-boot.dtsi create mode 100644 arch/arm/dts/am437x-sk-evm-u-boot.dtsi

AM437x QSPI boot is a single stage boot and hence needs runtime DTB selection to support AM437x-SK and AM437x-IDK with DM enabled. This is required to move am43xx_evm_qspiboot_defconfig to use DM/DT.
Signed-off-by: Vignesh R vigneshr@ti.com --- board/ti/am43xx/board.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c index 715960a596e9..38af1673273b 100644 --- a/board/ti/am43xx/board.c +++ b/board/ti/am43xx/board.c @@ -852,10 +852,14 @@ int ft_board_setup(void *blob, bd_t *bd) } #endif
-#ifdef CONFIG_SPL_LOAD_FIT +#if defined(CONFIG_SPL_LOAD_FIT) || defined(CONFIG_DTB_RESELECT) int board_fit_config_name_match(const char *name) { - if (board_is_evm() && !strcmp(name, "am437x-gp-evm")) + bool eeprom_read = board_ti_was_eeprom_read(); + + if (!strcmp(name, "am4372-generic") && !eeprom_read) + return 0; + else if (board_is_evm() && !strcmp(name, "am437x-gp-evm")) return 0; else if (board_is_sk() && !strcmp(name, "am437x-sk-evm")) return 0; @@ -868,6 +872,16 @@ int board_fit_config_name_match(const char *name) } #endif
+#ifdef CONFIG_DTB_RESELECT +int embedded_dtb_select(void) +{ + do_board_detect(); + fdtdec_setup(); + + return 0; +} +#endif + #ifdef CONFIG_TI_SECURE_DEVICE void board_fit_image_post_process(void **p_image, size_t *p_size) {

On Monday 26 March 2018 01:27 PM, Vignesh R wrote:
AM437x QSPI boot is a single stage boot and hence needs runtime DTB selection to support AM437x-SK and AM437x-IDK with DM enabled. This is required to move am43xx_evm_qspiboot_defconfig to use DM/DT.
Signed-off-by: Vignesh R vigneshr@ti.com
Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
Thanks and regards, Lokesh
board/ti/am43xx/board.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c index 715960a596e9..38af1673273b 100644 --- a/board/ti/am43xx/board.c +++ b/board/ti/am43xx/board.c @@ -852,10 +852,14 @@ int ft_board_setup(void *blob, bd_t *bd) } #endif
-#ifdef CONFIG_SPL_LOAD_FIT +#if defined(CONFIG_SPL_LOAD_FIT) || defined(CONFIG_DTB_RESELECT) int board_fit_config_name_match(const char *name) {
- if (board_is_evm() && !strcmp(name, "am437x-gp-evm"))
- bool eeprom_read = board_ti_was_eeprom_read();
- if (!strcmp(name, "am4372-generic") && !eeprom_read)
return 0;
- else if (board_is_evm() && !strcmp(name, "am437x-gp-evm")) return 0; else if (board_is_sk() && !strcmp(name, "am437x-sk-evm")) return 0;
@@ -868,6 +872,16 @@ int board_fit_config_name_match(const char *name) } #endif
+#ifdef CONFIG_DTB_RESELECT +int embedded_dtb_select(void) +{
- do_board_detect();
- fdtdec_setup();
- return 0;
+} +#endif
#ifdef CONFIG_TI_SECURE_DEVICE void board_fit_image_post_process(void **p_image, size_t *p_size) {

On Mon, Mar 26, 2018 at 01:27:01PM +0530, Vignesh R wrote:
AM437x QSPI boot is a single stage boot and hence needs runtime DTB selection to support AM437x-SK and AM437x-IDK with DM enabled. This is required to move am43xx_evm_qspiboot_defconfig to use DM/DT.
Signed-off-by: Vignesh R vigneshr@ti.com Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!

With U-boot runtime board detect for DTB selection a "default" dtb needs to be created. This will be used temporarily until the "proper" dtb is selected.
Also, add -u-boot.dtsi for AM437x SK and IDK to enable I2C for board detection via DM_I2C.
Signed-off-by: Vignesh R vigneshr@ti.com --- arch/arm/dts/Makefile | 3 ++- arch/arm/dts/am4372-generic-u-boot.dtsi | 15 +++++++++++++++ arch/arm/dts/am4372-generic.dts | 24 ++++++++++++++++++++++++ arch/arm/dts/am437x-idk-evm-u-boot.dtsi | 23 +++++++++++++++++++++++ arch/arm/dts/am437x-sk-evm-u-boot.dtsi | 23 +++++++++++++++++++++++ 5 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/am4372-generic-u-boot.dtsi create mode 100644 arch/arm/dts/am4372-generic.dts create mode 100644 arch/arm/dts/am437x-idk-evm-u-boot.dtsi create mode 100644 arch/arm/dts/am437x-sk-evm-u-boot.dtsi
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 7dd1dffae599..15212acf90fa 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -167,7 +167,8 @@ dtb-$(CONFIG_AM33XX) += am335x-boneblack.dtb am335x-bone.dtb \ am335x-pdu001.dtb dtb-$(CONFIG_AM43XX) += am437x-gp-evm.dtb am437x-sk-evm.dtb \ am43x-epos-evm.dtb \ - am437x-idk-evm.dtb + am437x-idk-evm.dtb \ + am4372-generic.dtb dtb-$(CONFIG_TI816X) += dm8168-evm.dtb dtb-$(CONFIG_THUNDERX) += thunderx-88xx.dtb
diff --git a/arch/arm/dts/am4372-generic-u-boot.dtsi b/arch/arm/dts/am4372-generic-u-boot.dtsi new file mode 100644 index 000000000000..03a8a8d17b8c --- /dev/null +++ b/arch/arm/dts/am4372-generic-u-boot.dtsi @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/{ + ocp { + u-boot,dm-pre-reloc; + }; +}; + +&i2c0 { + u-boot,dm-pre-reloc; +}; diff --git a/arch/arm/dts/am4372-generic.dts b/arch/arm/dts/am4372-generic.dts new file mode 100644 index 000000000000..0c4843901882 --- /dev/null +++ b/arch/arm/dts/am4372-generic.dts @@ -0,0 +1,24 @@ +/* + * Device Tree Source for Generic AM4372 EVM + * + * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/dts-v1/; + +#include "am4372.dtsi" + +/ { + compatible = "ti,am4372", "ti,am43"; + model = "Texas Instruments AM4372 Generic"; + + chosen { + stdout-path = &uart0; + }; +}; + +&i2c0 { + status = "okay"; +}; diff --git a/arch/arm/dts/am437x-idk-evm-u-boot.dtsi b/arch/arm/dts/am437x-idk-evm-u-boot.dtsi new file mode 100644 index 000000000000..2f68d7ae9cdc --- /dev/null +++ b/arch/arm/dts/am437x-idk-evm-u-boot.dtsi @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/{ + ocp { + u-boot,dm-spl; + }; +}; + +&uart0 { + u-boot,dm-spl; +}; + +&i2c0 { + u-boot,dm-spl; +}; + +&mmc1 { + u-boot,dm-spl; +}; diff --git a/arch/arm/dts/am437x-sk-evm-u-boot.dtsi b/arch/arm/dts/am437x-sk-evm-u-boot.dtsi new file mode 100644 index 000000000000..2f68d7ae9cdc --- /dev/null +++ b/arch/arm/dts/am437x-sk-evm-u-boot.dtsi @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/{ + ocp { + u-boot,dm-spl; + }; +}; + +&uart0 { + u-boot,dm-spl; +}; + +&i2c0 { + u-boot,dm-spl; +}; + +&mmc1 { + u-boot,dm-spl; +};

On Monday 26 March 2018 01:27 PM, Vignesh R wrote:
With U-boot runtime board detect for DTB selection a "default" dtb needs to be created. This will be used temporarily until the "proper" dtb is selected.
Also, add -u-boot.dtsi for AM437x SK and IDK to enable I2C for board detection via DM_I2C.
Signed-off-by: Vignesh R vigneshr@ti.com
Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
Thanks and regards, Lokesh
arch/arm/dts/Makefile | 3 ++- arch/arm/dts/am4372-generic-u-boot.dtsi | 15 +++++++++++++++ arch/arm/dts/am4372-generic.dts | 24 ++++++++++++++++++++++++ arch/arm/dts/am437x-idk-evm-u-boot.dtsi | 23 +++++++++++++++++++++++ arch/arm/dts/am437x-sk-evm-u-boot.dtsi | 23 +++++++++++++++++++++++ 5 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/am4372-generic-u-boot.dtsi create mode 100644 arch/arm/dts/am4372-generic.dts create mode 100644 arch/arm/dts/am437x-idk-evm-u-boot.dtsi create mode 100644 arch/arm/dts/am437x-sk-evm-u-boot.dtsi
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 7dd1dffae599..15212acf90fa 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -167,7 +167,8 @@ dtb-$(CONFIG_AM33XX) += am335x-boneblack.dtb am335x-bone.dtb \ am335x-pdu001.dtb dtb-$(CONFIG_AM43XX) += am437x-gp-evm.dtb am437x-sk-evm.dtb \ am43x-epos-evm.dtb \
- am437x-idk-evm.dtb
- am437x-idk-evm.dtb \
- am4372-generic.dtb
dtb-$(CONFIG_TI816X) += dm8168-evm.dtb dtb-$(CONFIG_THUNDERX) += thunderx-88xx.dtb
diff --git a/arch/arm/dts/am4372-generic-u-boot.dtsi b/arch/arm/dts/am4372-generic-u-boot.dtsi new file mode 100644 index 000000000000..03a8a8d17b8c --- /dev/null +++ b/arch/arm/dts/am4372-generic-u-boot.dtsi @@ -0,0 +1,15 @@ +/*
- Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
- SPDX-License-Identifier: GPL-2.0+
- */
+/{
- ocp {
u-boot,dm-pre-reloc;
- };
+};
+&i2c0 {
- u-boot,dm-pre-reloc;
+}; diff --git a/arch/arm/dts/am4372-generic.dts b/arch/arm/dts/am4372-generic.dts new file mode 100644 index 000000000000..0c4843901882 --- /dev/null +++ b/arch/arm/dts/am4372-generic.dts @@ -0,0 +1,24 @@ +/*
- Device Tree Source for Generic AM4372 EVM
- Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
- SPDX-License-Identifier: GPL-2.0+
- */
+/dts-v1/;
+#include "am4372.dtsi"
+/ {
- compatible = "ti,am4372", "ti,am43";
- model = "Texas Instruments AM4372 Generic";
- chosen {
stdout-path = &uart0;
- };
+};
+&i2c0 {
- status = "okay";
+}; diff --git a/arch/arm/dts/am437x-idk-evm-u-boot.dtsi b/arch/arm/dts/am437x-idk-evm-u-boot.dtsi new file mode 100644 index 000000000000..2f68d7ae9cdc --- /dev/null +++ b/arch/arm/dts/am437x-idk-evm-u-boot.dtsi @@ -0,0 +1,23 @@ +/*
- Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
- SPDX-License-Identifier: GPL-2.0+
- */
+/{
- ocp {
u-boot,dm-spl;
- };
+};
+&uart0 {
- u-boot,dm-spl;
+};
+&i2c0 {
- u-boot,dm-spl;
+};
+&mmc1 {
- u-boot,dm-spl;
+}; diff --git a/arch/arm/dts/am437x-sk-evm-u-boot.dtsi b/arch/arm/dts/am437x-sk-evm-u-boot.dtsi new file mode 100644 index 000000000000..2f68d7ae9cdc --- /dev/null +++ b/arch/arm/dts/am437x-sk-evm-u-boot.dtsi @@ -0,0 +1,23 @@ +/*
- Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
- SPDX-License-Identifier: GPL-2.0+
- */
+/{
- ocp {
u-boot,dm-spl;
- };
+};
+&uart0 {
- u-boot,dm-spl;
+};
+&i2c0 {
- u-boot,dm-spl;
+};
+&mmc1 {
- u-boot,dm-spl;
+};

On Mon, Mar 26, 2018 at 01:27:02PM +0530, Vignesh R wrote:
With U-boot runtime board detect for DTB selection a "default" dtb needs to be created. This will be used temporarily until the "proper" dtb is selected.
Also, add -u-boot.dtsi for AM437x SK and IDK to enable I2C for board detection via DM_I2C.
Signed-off-by: Vignesh R vigneshr@ti.com Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!

Move am43xx_evm_qspiboot_defconfig to DM. This is required as SPI core and TI QSPI driver no longer supports non DM interfaces.
Signed-off-by: Vignesh R vigneshr@ti.com --- configs/am43xx_evm_qspiboot_defconfig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/configs/am43xx_evm_qspiboot_defconfig b/configs/am43xx_evm_qspiboot_defconfig index 2bc302c7ed97..3fbf701e601e 100644 --- a/configs/am43xx_evm_qspiboot_defconfig +++ b/configs/am43xx_evm_qspiboot_defconfig @@ -3,6 +3,7 @@ CONFIG_ARM=y CONFIG_ARCH_OMAP2PLUS=y CONFIG_SYS_TEXT_BASE=0x30000000 CONFIG_AM43XX=y +CONFIG_DEFAULT_DEVICE_TREE="am437x-sk-evm" CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_EXTRA_OPTIONS="SERIAL1,CONS_INDEX=1,QSPI,QSPI_BOOT" CONFIG_QSPI_BOOT=y @@ -23,10 +24,18 @@ CONFIG_CMD_SPI=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_EXT4_WRITE=y +CONFIG_OF_CONTROL=y +CONFIG_OF_LIST="am4372-generic am437x-sk-evm am437x-idk-evm" +CONFIG_DTB_RESELECT=y +CONFIG_MULTI_DTB_FIT=y CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_DM=y +# CONFIG_BLK is not set CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y CONFIG_DFU_SF=y +CONFIG_DM_GPIO=y +CONFIG_DM_MMC=y CONFIG_MMC_OMAP_HS=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y @@ -48,4 +57,3 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0403 CONFIG_USB_GADGET_PRODUCT_NUM=0xbd00 CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_FAT_WRITE=y -CONFIG_OF_LIBFDT=y

On Monday 26 March 2018 01:27 PM, Vignesh R wrote:
Move am43xx_evm_qspiboot_defconfig to DM. This is required as SPI core and TI QSPI driver no longer supports non DM interfaces.
Signed-off-by: Vignesh R vigneshr@ti.com
Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
Thanks and regards, Lokesh
configs/am43xx_evm_qspiboot_defconfig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/configs/am43xx_evm_qspiboot_defconfig b/configs/am43xx_evm_qspiboot_defconfig index 2bc302c7ed97..3fbf701e601e 100644 --- a/configs/am43xx_evm_qspiboot_defconfig +++ b/configs/am43xx_evm_qspiboot_defconfig @@ -3,6 +3,7 @@ CONFIG_ARM=y CONFIG_ARCH_OMAP2PLUS=y CONFIG_SYS_TEXT_BASE=0x30000000 CONFIG_AM43XX=y +CONFIG_DEFAULT_DEVICE_TREE="am437x-sk-evm" CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_EXTRA_OPTIONS="SERIAL1,CONS_INDEX=1,QSPI,QSPI_BOOT" CONFIG_QSPI_BOOT=y @@ -23,10 +24,18 @@ CONFIG_CMD_SPI=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_EXT4_WRITE=y +CONFIG_OF_CONTROL=y +CONFIG_OF_LIST="am4372-generic am437x-sk-evm am437x-idk-evm" +CONFIG_DTB_RESELECT=y +CONFIG_MULTI_DTB_FIT=y CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_DM=y +# CONFIG_BLK is not set CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y CONFIG_DFU_SF=y +CONFIG_DM_GPIO=y +CONFIG_DM_MMC=y CONFIG_MMC_OMAP_HS=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y @@ -48,4 +57,3 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0403 CONFIG_USB_GADGET_PRODUCT_NUM=0xbd00 CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_FAT_WRITE=y -CONFIG_OF_LIBFDT=y

On Mon, Mar 26, 2018 at 01:27:03PM +0530, Vignesh R wrote:
Move am43xx_evm_qspiboot_defconfig to DM. This is required as SPI core and TI QSPI driver no longer supports non DM interfaces.
Signed-off-by: Vignesh R vigneshr@ti.com Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!
participants (3)
-
Lokesh Vutla
-
Tom Rini
-
Vignesh R