Skip to contentSkip to conversation

enable OSPI support on AM64x

PATCH In review Jonathan Humphreys 2 participants 8 messages Feb 24, 2024 – Mar 5, 2024 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

v2 cover enable OSPI support on AM64x

This series enables OSPI support for AM64x by setting the proper configs, and DT entries for SPL.

Fixes fa09b12dc5f6 ("arm: ti: k3: Resync dts files and bindings with Linux Kernel v5.14")

Changes from v1:
- removed the OSPI phy pattern partition, as it wasn't used

v1: https://patchwork.ozlabs.org/project/uboot/list/?series=396298

Jonathan Humphreys (2):
configs: am64x_evm_*_defconfig: Enable OSPI support
arm: dts: k3-am642-evm/sk: Enable OSPI support in SPL

 arch/arm/dts/k3-am642-evm-u-boot.dtsi | 16 ++++++++++++++++
 arch/arm/dts/k3-am642-r5-evm.dts      |  5 +++++
 arch/arm/dts/k3-am642-r5-sk.dts       |  5 +++++
 arch/arm/dts/k3-am642-sk-u-boot.dtsi  | 16 ++++++++++++++++
 configs/am64x_evm_a53_defconfig       | 14 ++++++++++++--
 configs/am64x_evm_r5_defconfig        | 14 ++++++++++++--
 6 files changed, 66 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 configs: am64x_evm_*_defconfig: Enable OSPI support

Add configs to support OSPI flash.

---
 configs/am64x_evm_a53_defconfig | 14 ++++++++++++--
 configs/am64x_evm_r5_defconfig  | 14 ++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)
configs/am64x_evm_a53_defconfig +12 -2
index 6711e691ca..27aa78a533 100644
@@ -12,6 +12,7 @@ CONFIG_K3_ATF_LOAD_ADDR=0x701c0000
 CONFIG_TARGET_AM642_A53_EVM=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000
+CONFIG_SF_DEFAULT_SPEED=25000000
 CONFIG_ENV_SIZE=0x20000
 CONFIG_DM_GPIO=y
 CONFIG_SPL_DM_SPI=y
@@ -57,8 +58,11 @@ CONFIG_SPL_NET_VCI_STRING="AM64X U-Boot A53 SPL"
 CONFIG_SPL_POWER_DOMAIN=y
 CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
+# CONFIG_SPL_SPI_FLASH_TINY is not set
+CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_SYS_SPI_U_BOOT_OFFS=0x280000
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x300000
+CONFIG_SPL_THERMAL=y
 CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_SYS_MAXARGS=64
 CONFIG_CMD_ASKENV=y
@@ -109,8 +113,13 @@ CONFIG_SPL_MMC_SDHCI_ADMA=y
 CONFIG_MMC_SDHCI_AM654=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_SOFT_RESET=y
+CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_S28HX_T=y
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_MULTIPLEXER=y
 CONFIG_MUX_MMIO=y
 CONFIG_PHY_TI_DP83867=y
@@ -142,6 +151,7 @@ CONFIG_CADENCE_QSPI=y
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
+CONFIG_DM_THERMAL=y
 CONFIG_USB=y
 CONFIG_DM_USB_GADGET=y
 CONFIG_SPL_DM_USB_GADGET=y
configs/am64x_evm_r5_defconfig +12 -2
index 56df6a4a19..199c7c9a9d 100644
@@ -10,6 +10,7 @@ CONFIG_SOC_K3_AM642=y
 CONFIG_TARGET_AM642_R5_EVM=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x7019b800
+CONFIG_SF_DEFAULT_SPEED=25000000
 CONFIG_ENV_SIZE=0x20000
 CONFIG_ENV_OFFSET=0x680000
 CONFIG_DM_GPIO=y
@@ -63,8 +64,11 @@ CONFIG_SPL_POWER_DOMAIN=y
 CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_REMOTEPROC=y
+# CONFIG_SPL_SPI_FLASH_TINY is not set
+CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x100000
+CONFIG_SPL_THERMAL=y
 CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_MAXARGS=64
@@ -117,8 +121,11 @@ CONFIG_SPL_MMC_SDHCI_ADMA=y
 CONFIG_MMC_SDHCI_AM654=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_SOFT_RESET=y
+CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_S28HX_T=y
 CONFIG_PHY_TI_DP83867=y
 CONFIG_TI_AM65_CPSW_NUSS=y
 CONFIG_PHY=y
@@ -142,6 +149,8 @@ CONFIG_REMOTEPROC_TI_K3_ARM64=y
 CONFIG_RESET_TI_SCI=y
 CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_DM_SERIAL=y
+CONFIG_SOC_DEVICE=y
+CONFIG_SOC_DEVICE_TI_K3=y
 CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
@@ -149,6 +158,7 @@ CONFIG_CADENCE_QSPI=y
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
+CONFIG_DM_THERMAL=y
 CONFIG_TIMER=y
 CONFIG_SPL_TIMER=y
 CONFIG_OMAP_TIMER=y
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/2 arm: dts: k3-am642-evm/sk: Enable OSPI support in SPL

In reply to Jonathan Humphreys

Add bootph DT tags to enable OSPI in SPL.
Set OSPI regs for R5 SPL to address OSPI's boot region.

---
 arch/arm/dts/k3-am642-evm-u-boot.dtsi | 16 ++++++++++++++++
 arch/arm/dts/k3-am642-r5-evm.dts      |  5 +++++
 arch/arm/dts/k3-am642-r5-sk.dts       |  5 +++++
 arch/arm/dts/k3-am642-sk-u-boot.dtsi  | 16 ++++++++++++++++
 4 files changed, 42 insertions(+)
arch/arm/dts/k3-am642-evm-u-boot.dtsi +16 -0
index b843078243..60b219c0be 100644
@@ -182,3 +182,19 @@
 &cpsw_port2 {
 	status = "disabled";
 };
+
+&ospi0_pins_default {
+	bootph-all;
+};
+
+&fss {
+	bootph-all;
+};
+
+&ospi0 {
+	bootph-all;
+
+	flash@0 {
+		bootph-all;
+	};
+};
arch/arm/dts/k3-am642-r5-evm.dts +5 -0
index 64b3c3af63..6825c07df3 100644
@@ -120,3 +120,8 @@
 	/delete-property/ assigned-clock-parents;
 	/delete-property/ power-domains;
 };
+
+&ospi0 {
+	reg = <0x00 0x0fc40000 0x00 0x100>,
+	      <0x00 0x60000000 0x00 0x8000000>;
+};
arch/arm/dts/k3-am642-r5-sk.dts +5 -0
index daa483a781..60d747ddd5 100644
@@ -103,3 +103,8 @@
 	/delete-property/ assigned-clock-parents;
 	/delete-property/ power-domains;
 };
+
+&ospi0 {
+	reg = <0x00 0x0fc40000 0x00 0x100>,
+ 	      <0x00 0x60000000 0x00 0x8000000>;
+};
arch/arm/dts/k3-am642-sk-u-boot.dtsi +16 -0
index 2eb227c1d0..2b42c74190 100644
@@ -211,3 +211,19 @@
 &serdes_refclk {
 	bootph-all;
 };
+
+&ospi0_pins_default {
+	bootph-all;
+};
+
+&fss {
+	bootph-all;
+};
+
+&ospi0 {
+ 	bootph-all;
+
+	flash@0 {
+		bootph-all;
+	};
+};
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH v2 2/2] arm: dts: k3-am642-evm/sk: Enable OSPI support in SPL

Quoted 25 lines · Jonathan Humphreys

Add bootph DT tags to enable OSPI in SPL.
Set OSPI regs for R5 SPL to address OSPI's boot region.

---
 arch/arm/dts/k3-am642-evm-u-boot.dtsi | 16 ++++++++++++++++
 arch/arm/dts/k3-am642-r5-evm.dts      |  5 +++++
 arch/arm/dts/k3-am642-r5-sk.dts       |  5 +++++
 arch/arm/dts/k3-am642-sk-u-boot.dtsi  | 16 ++++++++++++++++
 4 files changed, 42 insertions(+)
arch/arm/dts/k3-am642-evm-u-boot.dtsi +6 -0
index b843078243..60b219c0be 100644
@@ -182,3 +182,19 @@
 &cpsw_port2 {
 	status = "disabled";
 };
+
+&ospi0_pins_default {
+	bootph-all;
+};
+
+&fss {

arch/arm/dts/k3-am642-evm-u-boot.dtsi line 200

Quoted 10 lines
arch/arm/dts/k3-am642-evm-u-boot.dtsi +10 -0
+	bootph-all;
+};
+
+&ospi0 {
+	bootph-all;
+
+	flash@0 {
+		bootph-all;
+	};
+};

So this gets back to what I was asking in the first series, is this needed in SPL or full U-Boot as well? The bootph-* properties are supposed to be transitive, but originally the tooling didn't handle this and now the tooling handles SPL but not full U-Boot. Which also brings back the is this _needed_ question and is bootph-all right, rather than just the big hammer?

Signature · 1 line
Tom
#4 lore raw

Re: [PATCH v2 2/2] arm: dts: k3-am642-evm/sk: Enable OSPI support in SPL

Quoted 35 lines · Tom Rini
Quoted 34 lines · Jonathan Humphreys

Add bootph DT tags to enable OSPI in SPL.
Set OSPI regs for R5 SPL to address OSPI's boot region.

---
 arch/arm/dts/k3-am642-evm-u-boot.dtsi | 16 ++++++++++++++++
 arch/arm/dts/k3-am642-r5-evm.dts      |  5 +++++
 arch/arm/dts/k3-am642-r5-sk.dts       |  5 +++++
 arch/arm/dts/k3-am642-sk-u-boot.dtsi  | 16 ++++++++++++++++
 4 files changed, 42 insertions(+)
arch/arm/dts/k3-am642-evm-u-boot.dtsi +15 -0
index b843078243..60b219c0be 100644
@@ -182,3 +182,19 @@
 &cpsw_port2 {
 	status = "disabled";
 };
+
+&ospi0_pins_default {
+	bootph-all;
+};
+
+&fss {
+	bootph-all;
+};
+
+&ospi0 {
+	bootph-all;
+
+	flash@0 {
+		bootph-all;
+	};
Quoted 9 lines

arch/arm/dts/k3-am642-evm-u-boot.dtsi line 200

Quoted 1 line
arch/arm/dts/k3-am642-evm-u-boot.dtsi +1 -0
+};

So this gets back to what I was asking in the first series, is this needed in SPL or full U-Boot as well? The bootph-* properties are supposed to be transitive, but originally the tooling didn't handle this and now the tooling handles SPL but not full U-Boot. Which also brings back the is this _needed_ question and is bootph-all right, rather than just the big hammer?

By "this", are you referring to the original phypattern partition nodes, or the ospi0 node itself? The partition nodes are not needed at all, so removed. The ospi node is needed in both SPL and U-Boot. In that case, using the bootph-all tag is the proper way, correct?

What do you mean by the 'big hammer'?

Please advise and thanks.

Quoted 2 lines
Signature · 1 line
Tom
#5 lore raw

Re: [PATCH v2 2/2] arm: dts: k3-am642-evm/sk: Enable OSPI support in SPL

Quoted 46 lines · Jon Humphreys
Quoted 35 lines · Tom Rini
Quoted 34 lines · Jonathan Humphreys

Add bootph DT tags to enable OSPI in SPL.
Set OSPI regs for R5 SPL to address OSPI's boot region.

---
 arch/arm/dts/k3-am642-evm-u-boot.dtsi | 16 ++++++++++++++++
 arch/arm/dts/k3-am642-r5-evm.dts      |  5 +++++
 arch/arm/dts/k3-am642-r5-sk.dts       |  5 +++++
 arch/arm/dts/k3-am642-sk-u-boot.dtsi  | 16 ++++++++++++++++
 4 files changed, 42 insertions(+)
arch/arm/dts/k3-am642-evm-u-boot.dtsi +15 -0
index b843078243..60b219c0be 100644
@@ -182,3 +182,19 @@
 &cpsw_port2 {
 	status = "disabled";
 };
+
+&ospi0_pins_default {
+	bootph-all;
+};
+
+&fss {
+	bootph-all;
+};
+
+&ospi0 {
+	bootph-all;
+
+	flash@0 {
+		bootph-all;
+	};
Quoted 9 lines

arch/arm/dts/k3-am642-evm-u-boot.dtsi line 200

Quoted 1 line
arch/arm/dts/k3-am642-evm-u-boot.dtsi +1 -0
+};

So this gets back to what I was asking in the first series, is this needed in SPL or full U-Boot as well? The bootph-* properties are supposed to be transitive, but originally the tooling didn't handle this and now the tooling handles SPL but not full U-Boot. Which also brings back the is this _needed_ question and is bootph-all right, rather than just the big hammer?

Quoted 8 lines

By "this", are you referring to the original phypattern partition nodes, or the ospi0 node itself? The partition nodes are not needed at all, so removed. The ospi node is needed in both SPL and U-Boot. In that case, using the bootph-all tag is the proper way, correct?

What do you mean by the 'big hammer'?

Please advise and thanks.

So, part of the answer is that the documentation isn't as clear and well formatted as I'd like (aside, include/dm/ofnode.h::ofnode_pre_reloc comment should be reworded to render better). First, I want to point to the schema itself:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/bootph.yaml
and then next:
https://docs.u-boot.org/en/latest/develop/driver-model/design.html#pre-relocation-support

And in this case, the "pre" options are a bit less clear as TI platforms don't do the TPL->SPL->Full U-Boot dance that others like say Rockchip do but instead the Cortex-R/Cortex-A dance for the K3 architecture.

Which gets back to what I was trying to ask. What, functionally, requires that property to be present? And then, for the cortex-a platforms these should be in the upstream dtb and I forget if you said that's in progress for these platforms or not.

Signature · 1 line
Tom
#6 lore raw

Re: [PATCH v2 2/2] arm: dts: k3-am642-evm/sk: Enable OSPI support in SPL

Quoted 64 lines · Tom Rini
Quoted 46 lines · Jon Humphreys
Quoted 35 lines · Tom Rini
Quoted 34 lines · Jonathan Humphreys

Add bootph DT tags to enable OSPI in SPL.
Set OSPI regs for R5 SPL to address OSPI's boot region.

---
 arch/arm/dts/k3-am642-evm-u-boot.dtsi | 16 ++++++++++++++++
 arch/arm/dts/k3-am642-r5-evm.dts      |  5 +++++
 arch/arm/dts/k3-am642-r5-sk.dts       |  5 +++++
 arch/arm/dts/k3-am642-sk-u-boot.dtsi  | 16 ++++++++++++++++
 4 files changed, 42 insertions(+)
arch/arm/dts/k3-am642-evm-u-boot.dtsi +15 -0
index b843078243..60b219c0be 100644
@@ -182,3 +182,19 @@
 &cpsw_port2 {
 	status = "disabled";
 };
+
+&ospi0_pins_default {
+	bootph-all;
+};
+
+&fss {
+	bootph-all;
+};
+
+&ospi0 {
+	bootph-all;
+
+	flash@0 {
+		bootph-all;
+	};
Quoted 9 lines

arch/arm/dts/k3-am642-evm-u-boot.dtsi line 200

Quoted 1 line
arch/arm/dts/k3-am642-evm-u-boot.dtsi +1 -0
+};

So this gets back to what I was asking in the first series, is this needed in SPL or full U-Boot as well? The bootph-* properties are supposed to be transitive, but originally the tooling didn't handle this and now the tooling handles SPL but not full U-Boot. Which also brings back the is this _needed_ question and is bootph-all right, rather than just the big hammer?

Quoted 8 lines

By "this", are you referring to the original phypattern partition nodes, or the ospi0 node itself? The partition nodes are not needed at all, so removed. The ospi node is needed in both SPL and U-Boot. In that case, using the bootph-all tag is the proper way, correct?

What do you mean by the 'big hammer'?

Please advise and thanks.

So, part of the answer is that the documentation isn't as clear and well formatted as I'd like (aside, include/dm/ofnode.h::ofnode_pre_reloc comment should be reworded to render better). First, I want to point to the schema itself:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/bootph.yaml
and then next:
https://docs.u-boot.org/en/latest/develop/driver-model/design.html#pre-relocation-support

Quoted 8 lines

And in this case, the "pre" options are a bit less clear as TI platforms don't do the TPL->SPL->Full U-Boot dance that others like say Rockchip do but instead the Cortex-R/Cortex-A dance for the K3 architecture.

Which gets back to what I was trying to ask. What, functionally, requires that property to be present? And then, for the cortex-a platforms these should be in the upstream dtb and I forget if you said that's in progress for these platforms or not.

Without those properties, the on-board OSPI flash is not available to u-boot.

There is a separate action to move the bootph properities (not just the above) to the upstream DT.

Quoted 3 lines
Signature · 2 lines
-- 
Tom
#7 lore raw
In reply to Jonathan Humphreys
Quoted 9 lines · Jonathan Humphreys

This series enables OSPI support for AM64x by setting the proper configs, and DT entries for SPL.

Fixes fa09b12dc5f6 ("arm: ti: k3: Resync dts files and bindings with Linux Kernel v5.14")

Changes from v1:
- removed the OSPI phy pattern partition, as it wasn't used

[...]

Applied to u-boot/next, thanks!

Signature · 1 line
Tom