[PATCH 0/2] ke-am62x-sk_evm: add ospi support

There's a S28HS512T Flash (by Cypress) on the AM625 SK EVM. - Add necessary DT nodes to enable OSPI interface with this flash. - Enable all configs that enable the OSPI related drivers and commands like SF probe.
Tested on my AM62 SK EVM, attaching logs below.
Logs: ------------------------------------------------------------------------ U-Boot SPL 2022.10-rc5-00012-g435596d57f8b-dirty (Sep 26 2022 - 16:27:48 +0530) SYSFW ABI: 3.1 (firmware rev 0x0008 '8.4.6--v08.04.06 (Jolly Jellyfi') Trying to boot from MMC2 Starting ATF on ARM64 core...
NOTICE: BL31: v2.7(release):v2.7.0-dirty NOTICE: BL31: Built : 14:30:02, Aug 27 2022
U-Boot SPL 2022.10-rc5-00012-g435596d57f8b-dirty (Sep 26 2022 - 17:51:27 +0530) SYSFW ABI: 3.1 (firmware rev 0x0008 '8.4.6--v08.04.06 (Jolly Jellyfi') Trying to boot from MMC2
U-Boot 2022.10-rc5-00012-g435596d57f8b-dirty (Sep 26 2022 - 17:51:27 +0530)
SoC: AM62X SR1.0 GP Model: Texas Instruments AM625 SK DRAM: 2 GiB Core: 37 devices, 18 uclasses, devicetree: separate MMC: mmc@fa10000: 2, mmc@fa00000: 1, mmc@fa20000: 3 Loading Environment from nowhere... OK In: serial@2800000 Out: serial@2800000 Err: serial@2800000 Net: No ethernet found. Hit any key to stop autoboot: 0 => sf probe SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB, total 64 MiB => fatload mmc 1 $loadaddr tiboot3.bin 285482 bytes read in 17 ms (16 MiB/s) => sf update $loadaddr 0x0 $filesize device 0 offset 0x0, size 0x45b2a 285482 bytes written, 0 bytes skipped in 2.623s, speed 111322 B/s => sf read 0x90000000 0x0 $filesize device 0 offset 0x0, size 0x45b2a SF: 285482 bytes @ 0x0 Read: OK => md $loadaddr 82000000: 94048230 fd038230 010203a0 64140202 0...0..........d 82000010: 3f829a45 85bb6dd8 232b5568 f8f4176f E..?.m..hU+#o... 82000020: 309fb7ff 2a09060d f7864886 0d01010d ...0...*.H...... 82000030: 81300005 300b319d 55030609 02130604 ..0..1.0...U.... 82000040: 0b315355 03060930 0c080455 31585402 US1.0...U....TX1 82000050: 060d300f 07045503 6144060c 73616c6c .0...U....Dallas 82000060: 25302731 04550306 541e0c0a 73617865 1'0%..U....Texas 82000070: 736e4920 6d757274 73746e65 636e4920 Instruments Inc 82000080: 6f70726f 65746172 30133164 55030611 orporated1.0...U 82000090: 0a0c0b04 636f7250 6f737365 13317372 ....Processors1. 820000a0: 03061130 0c030455 2049540a 70707553 0...U....TI Supp 820000b0: 3174726f 061b301d 48862a09 010df786 ort1.0...*.H.... 820000c0: 0e160109 70707573 4074726f 632e6974 ....support@ti.c 820000d0: 1e306d6f 32320d17 36323930 38353031 om0...2209261058 820000e0: 175a3331 3132320d 31363230 31383530 13Z..22102610581 820000f0: 81305a33 300b319d 55030609 02130604 3Z0..1.0...U.... => md 0x90000000 90000000: 94048230 fd038230 010203a0 64140202 0...0..........d 90000010: 3f829a45 85bb6dd8 232b5568 f8f4176f E..?.m..hU+#o... 90000020: 309fb7ff 2a09060d f7864886 0d01010d ...0...*.H...... 90000030: 81300005 300b319d 55030609 02130604 ..0..1.0...U.... 90000040: 0b315355 03060930 0c080455 31585402 US1.0...U....TX1 90000050: 060d300f 07045503 6144060c 73616c6c .0...U....Dallas 90000060: 25302731 04550306 541e0c0a 73617865 1'0%..U....Texas 90000070: 736e4920 6d757274 73746e65 636e4920 Instruments Inc 90000080: 6f70726f 65746172 30133164 55030611 orporated1.0...U 90000090: 0a0c0b04 636f7250 6f737365 13317372 ....Processors1. 900000a0: 03061130 0c030455 2049540a 70707553 0...U....TI Supp 900000b0: 3174726f 061b301d 48862a09 010df786 ort1.0...*.H.... 900000c0: 0e160109 70707573 4074726f 632e6974 ....support@ti.c 900000d0: 1e306d6f 32320d17 36323930 38353031 om0...2209261058 900000e0: 175a3331 3132320d 31363230 31383530 13Z..22102610581 900000f0: 81305a33 300b319d 55030609 02130604 3Z0..1.0...U.... => cmp.b $loadaddr 0x90000000 $filesize Total of 285482 byte(s) were the same ------------------------------------------------------------------------
Thus tested read, write and probe flash from u-boot prompt
Dhruva Gole (2): arm: dts: k3-am625-sk: Add OSPI support configs: am62x_evm_a53: Enable OSPI Flash support
arch/arm/dts/k3-am625-sk-u-boot.dtsi | 24 +++++++++ arch/arm/dts/k3-am625-sk.dts | 77 ++++++++++++++++++++++++++++ configs/am62x_evm_a53_defconfig | 13 +++++ 3 files changed, 114 insertions(+)

Add DT nodes to enable S28HS512T OSPI flash on the SK board.
Signed-off-by: Dhruva Gole d-gole@ti.com --- arch/arm/dts/k3-am625-sk-u-boot.dtsi | 24 +++++++++ arch/arm/dts/k3-am625-sk.dts | 77 ++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+)
diff --git a/arch/arm/dts/k3-am625-sk-u-boot.dtsi b/arch/arm/dts/k3-am625-sk-u-boot.dtsi index 159fa36bbe9f..92788bae3e09 100644 --- a/arch/arm/dts/k3-am625-sk-u-boot.dtsi +++ b/arch/arm/dts/k3-am625-sk-u-boot.dtsi @@ -102,3 +102,27 @@ &main_mmc1_pins_default { u-boot,dm-spl; }; + +&fss { + u-boot,dm-spl; +}; + +&ospi0_pins_default { + u-boot,dm-spl; +}; + +&ospi0 { + u-boot,dm-spl; + + flash@0 { + u-boot,dm-spl; + + partitions { + u-boot,dm-spl; + + partition@3fc0000 { + u-boot,dm-spl; + }; + }; + }; +}; diff --git a/arch/arm/dts/k3-am625-sk.dts b/arch/arm/dts/k3-am625-sk.dts index 76b06ea23953..5d4b2fddafaa 100644 --- a/arch/arm/dts/k3-am625-sk.dts +++ b/arch/arm/dts/k3-am625-sk.dts @@ -19,6 +19,7 @@ aliases { serial2 = &main_uart0; mmc1 = &sdhci1; + spi0 = &ospi0; };
chosen { @@ -77,6 +78,23 @@ AM62X_IOPAD(0x240, PIN_INPUT, 0) /* (D17) MMC1_SDCD */ >; }; + + ospi0_pins_default: ospi0-pins-default { + pinctrl-single,pins = < + AM62X_IOPAD(0x000, PIN_OUTPUT, 0) /* (H24) OSPI0_CLK */ + AM62X_IOPAD(0x02c, PIN_OUTPUT, 0) /* (F23) OSPI0_CSn0 */ + AM62X_IOPAD(0x00c, PIN_INPUT, 0) /* (E25) OSPI0_D0 */ + + AM62X_IOPAD(0x010, PIN_INPUT, 0) /* (G24) OSPI0_D1 */ + AM62X_IOPAD(0x014, PIN_INPUT, 0) /* (F25) OSPI0_D2 */ + AM62X_IOPAD(0x018, PIN_INPUT, 0) /* (F24) OSPI0_D3 */ + AM62X_IOPAD(0x01c, PIN_INPUT, 0) /* (J23) OSPI0_D4 */ + AM62X_IOPAD(0x020, PIN_INPUT, 0) /* (J25) OSPI0_D5 */ + AM62X_IOPAD(0x024, PIN_INPUT, 0) /* (H25) OSPI0_D6 */ + AM62X_IOPAD(0x028, PIN_INPUT, 0) /* (J22) OSPI0_D7 */ + AM62X_IOPAD(0x008, PIN_INPUT, 0) /* (J24) OSPI0_DQS */ + >; + }; };
&wkup_uart0 { @@ -148,3 +166,62 @@ ti,driver-strength-ohm = <50>; disable-wp; }; + +&ospi0 { + pinctrl-names = "default"; + pinctrl-0 = <&ospi0_pins_default>; + + flash@0{ + compatible = "jedec,spi-nor"; + reg = <0x0>; + spi-tx-bus-width = <8>; + spi-rx-bus-width = <8>; + spi-max-frequency = <25000000>; + cdns,tshsl-ns = <60>; + cdns,tsd2d-ns = <60>; + cdns,tchsh-ns = <60>; + cdns,tslch-ns = <60>; + cdns,read-delay = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ospi.tiboot3"; + reg = <0x0 0x80000>; + }; + + partition@80000 { + label = "ospi.tispl"; + reg = <0x80000 0x200000>; + }; + + partition@280000 { + label = "ospi.u-boot"; + reg = <0x280000 0x400000>; + }; + + partition@680000 { + label = "ospi.env"; + reg = <0x680000 0x40000>; + }; + + partition@6c0000 { + label = "ospi.env.backup"; + reg = <0x6c0000 0x40000>; + }; + + partition@800000 { + label = "ospi.rootfs"; + reg = <0x800000 0x37c0000>; + }; + + partition@3fc0000 { + label = "ospi.phypattern"; + reg = <0x3fc0000 0x40000>; + }; + }; + }; +};

On Tue, Sep 27, 2022 at 10:59:17AM +0530, Dhruva Gole wrote:
Add DT nodes to enable S28HS512T OSPI flash on the SK board.
Signed-off-by: Dhruva Gole d-gole@ti.com
arch/arm/dts/k3-am625-sk-u-boot.dtsi | 24 +++++++++ arch/arm/dts/k3-am625-sk.dts | 77 ++++++++++++++++++++++++++++
What is the status of the non u-boot.dtsi portion of this patch with upstream Linux? Thanks.

Hi Tom,
On 06/10/22 21:08, Tom Rini wrote:
On Tue, Sep 27, 2022 at 10:59:17AM +0530, Dhruva Gole wrote:
Add DT nodes to enable S28HS512T OSPI flash on the SK board.
Signed-off-by: Dhruva Gole d-gole@ti.com
arch/arm/dts/k3-am625-sk-u-boot.dtsi | 24 +++++++++ arch/arm/dts/k3-am625-sk.dts | 77 ++++++++++++++++++++++++++++
What is the status of the non u-boot.dtsi portion of this patch with upstream Linux? Thanks.
In upstream, please refer to https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/ti/k3-am6...
spi0 = &ospi0;
and pinmux is all done in a similar fashion as I have done in these patches.

On Wed, Oct 19, 2022 at 12:17:43PM +0530, Dhruva Gole wrote:
Hi Tom,
On 06/10/22 21:08, Tom Rini wrote:
On Tue, Sep 27, 2022 at 10:59:17AM +0530, Dhruva Gole wrote:
Add DT nodes to enable S28HS512T OSPI flash on the SK board.
Signed-off-by: Dhruva Gole d-gole@ti.com
arch/arm/dts/k3-am625-sk-u-boot.dtsi | 24 +++++++++ arch/arm/dts/k3-am625-sk.dts | 77 ++++++++++++++++++++++++++++
What is the status of the non u-boot.dtsi portion of this patch with upstream Linux? Thanks.
In upstream, please refer to https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/ti/k3-am6...
spi0 = &ospi0;
and pinmux is all done in a similar fashion as I have done in these patches.
The preferred way to do this then is to post a patch syncing the whole of the DTS files with a given upstream tag then, so that it's clear and also so the trees stay up to date. This also applies to the patches you posted today.

On 19/10/22 18:04, Tom Rini wrote:
On Wed, Oct 19, 2022 at 12:17:43PM +0530, Dhruva Gole wrote:
Hi Tom,
On 06/10/22 21:08, Tom Rini wrote:
On Tue, Sep 27, 2022 at 10:59:17AM +0530, Dhruva Gole wrote:
Add DT nodes to enable S28HS512T OSPI flash on the SK board.
Signed-off-by: Dhruva Gole d-gole@ti.com
arch/arm/dts/k3-am625-sk-u-boot.dtsi | 24 +++++++++ arch/arm/dts/k3-am625-sk.dts | 77 ++++++++++++++++++++++++++++
What is the status of the non u-boot.dtsi portion of this patch with upstream Linux? Thanks.
In upstream, please refer to https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/ti/k3-am6...
spi0 = &ospi0;
and pinmux is all done in a similar fashion as I have done in these patches.
The preferred way to do this then is to post a patch syncing the whole of the DTS files with a given upstream tag then, so that it's clear and also so the trees stay up to date. This also applies to the patches you posted today.
Okay noted, I will be sending out a new series where I will sync up the DTS files with kernel upstream.
Also kindly note that the series https://lore.kernel.org/u-boot/20221019064759.493607-1-d-gole@ti.com/ supersedes this series.
I will also be re-spinning that series based on the suggestions given so far.

Set the necessary config options that help to build the necessary drivers that support spansion S28HS512T Flash
Signed-off-by: Dhruva Gole d-gole@ti.com --- configs/am62x_evm_a53_defconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig index 2c0bd4d2e10c..2a670449408f 100644 --- a/configs/am62x_evm_a53_defconfig +++ b/configs/am62x_evm_a53_defconfig @@ -31,7 +31,11 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img" CONFIG_SPL_DM_MAILBOX=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_POWER_DOMAIN=y +# CONFIG_SPL_SPI_FLASH_TINY is not set +CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y +CONFIG_SPL_SPI_LOAD=y CONFIG_SPL_YMODEM_SUPPORT=y CONFIG_SYS_BOOTM_LEN=0x800000 CONFIG_CMD_MMC=y @@ -57,6 +61,12 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ADMA=y CONFIG_SPL_MMC_SDHCI_ADMA=y CONFIG_MMC_SDHCI_AM654=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_S28HS512T=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_SINGLE=y @@ -70,6 +80,9 @@ 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 +CONFIG_CADENCE_QSPI=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y
participants (2)
-
Dhruva Gole
-
Tom Rini