Skip to contentSkip to conversation

AM437x: Add runtime DTB selection for QSPI Boot

PATCH New Vignesh R 3 participants 10 messages Mar 26, 2018 – Apr 7, 2018 Arm (32-bit)

lore
Share & tools
lore

Vignesh R

author
#0 lore raw

cover 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
Signature · 1 line
2.16.2
author
#1 lore raw

PATCH 1/3 board: ti: am43xx: Define embedded_dtb_select for runtime DTB selection in U-boot

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.

---
 board/ti/am43xx/board.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
board/ti/am43xx/board.c +16 -2
index 715960a596e9..38af1673273b 100644
@@ -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)
 {
Signature · 1 line
2.16.2
#2 lore raw

PATCH 1/3 board: ti: am43xx: Define embedded_dtb_select for runtime DTB selection in U-boot

Quoted 5 lines · Vignesh R

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.

Thanks and regards,
Lokesh

Quoted 43 lines
---
 board/ti/am43xx/board.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
board/ti/am43xx/board.c +16 -2
index 715960a596e9..38af1673273b 100644
@@ -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)
 {
#3 lore raw

PATCH 1/3 board: ti: am43xx: Define embedded_dtb_select for runtime DTB selection in U-boot

In reply to Vignesh R
Quoted 6 lines · Vignesh R

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180407/1e3b967b/attachment.sig>
author
#4 lore raw

PATCH 2/3 ARM: dts: Add new "generic" am4372 device tree file.

In reply to Vignesh R

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.

---
 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
arch/arm/dts/Makefile +2 -1
index 7dd1dffae599..15212acf90fa 100644
@@ -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
 
arch/arm/dts/am4372-generic-u-boot.dtsi new file +15 -0
new file mode 100644
index 000000000000..03a8a8d17b8c
@@ -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;
+};
arch/arm/dts/am4372-generic.dts new file +24 -0
new file mode 100644
index 000000000000..0c4843901882
@@ -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";
+};
arch/arm/dts/am437x-idk-evm-u-boot.dtsi new file +23 -0
new file mode 100644
index 000000000000..2f68d7ae9cdc
@@ -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;
+};
arch/arm/dts/am437x-sk-evm-u-boot.dtsi new file +23 -0
new file mode 100644
index 000000000000..2f68d7ae9cdc
@@ -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;
+};
Signature · 1 line
2.16.2
#5 lore raw

PATCH 2/3 ARM: dts: Add new "generic" am4372 device tree file.

Quoted 8 lines · Vignesh R

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.

Thanks and regards,
Lokesh

Quoted 136 lines
---
 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
arch/arm/dts/Makefile +2 -1
index 7dd1dffae599..15212acf90fa 100644
@@ -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
 
arch/arm/dts/am4372-generic-u-boot.dtsi new file +15 -0
new file mode 100644
index 000000000000..03a8a8d17b8c
@@ -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;
+};
arch/arm/dts/am4372-generic.dts new file +24 -0
new file mode 100644
index 000000000000..0c4843901882
@@ -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";
+};
arch/arm/dts/am437x-idk-evm-u-boot.dtsi new file +23 -0
new file mode 100644
index 000000000000..2f68d7ae9cdc
@@ -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;
+};
arch/arm/dts/am437x-sk-evm-u-boot.dtsi new file +23 -0
new file mode 100644
index 000000000000..2f68d7ae9cdc
@@ -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;
+};
#6 lore raw

PATCH 2/3 ARM: dts: Add new "generic" am4372 device tree file.

In reply to Vignesh R
Quoted 9 lines · Vignesh R

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180407/72557fac/attachment.sig>
author
#7 lore raw

PATCH 3/3 configs: am43xx_evm_qspiboot_defconfig: Move to DM

In reply to Vignesh R

Move am43xx_evm_qspiboot_defconfig to DM. This is required as SPI core and TI QSPI driver no longer supports non DM interfaces.

---
 configs/am43xx_evm_qspiboot_defconfig | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
configs/am43xx_evm_qspiboot_defconfig +9 -1
index 2bc302c7ed97..3fbf701e601e 100644
@@ -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
Signature · 1 line
2.16.2
#8 lore raw

PATCH 3/3 configs: am43xx_evm_qspiboot_defconfig: Move to DM

Quoted 4 lines · Vignesh R

Move am43xx_evm_qspiboot_defconfig to DM. This is required as SPI core and TI QSPI driver no longer supports non DM interfaces.

Thanks and regards,
Lokesh

Quoted 41 lines
---
 configs/am43xx_evm_qspiboot_defconfig | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
configs/am43xx_evm_qspiboot_defconfig +9 -1
index 2bc302c7ed97..3fbf701e601e 100644
@@ -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
#9 lore raw

PATCH 3/3 configs: am43xx_evm_qspiboot_defconfig: Move to DM

In reply to Vignesh R
Quoted 5 lines · Vignesh R

Move am43xx_evm_qspiboot_defconfig to DM. This is required as SPI core and TI QSPI driver no longer supports non DM interfaces.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180407/c1232b81/attachment.sig>