Skip to contentSkip to conversation

socfpga: n5x: Update Boot Support for N5X

PATCH Superseded Chen Huei Lok 2 participants 10 messages Jun 8 – Jun 23

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover socfpga: n5x: Update Boot Support for N5X

This patch series updates the N5X platform support:
- Consolidate ATF defconfig and simplify VAB defconfig
- Update GMAC nodes and DT register settings
- Enable CMD_MTD for MTD operations from the U-Boot shell
- Enable ISSI SPI flash support
- Migrate firewall setup to driver model and remove legacy code
- Switch to upstream Linux DT configuration
- Update SPL data save and restore implementation

Tested-on: Intel SoCFPGA N5X SoCDK hardware.

Note: This series depends on a concurrent patch series by Alif Zakuan Yuslaimi that removes the final firewall_setup() call in spl_s10.c. Please apply that series before this one. See the latest version at:
https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/

v2->v3:
--------
- Drop patch 4/8 (enable required configs for DDR retention): moved to a separate series for DDR retention support
- Patch 3: Fix CONFIG_CMD_MTD position in defconfig (between CMD_MMC and CMD_SPI per canonical savedefconfig ordering); drop CONFIG_SPL_ALTERA_SDRAM (auto-selected by Kconfig for N5X)
- Patch 4 (was 5/8): Fix CONFIG_SPI_FLASH_ISSI position in defconfig (before CONFIG_SPI_FLASH_SPANSION per canonical savedefconfig order)
- Patch 5 (was 6/8): Extend to fully remove firewall_setup(): delete firewall.c, remove firewall.o from Makefile, remove declaration and unused struct/macro definitions from firewall.h, drop stale include from spl_n5x.c
- Patch 6 (was 7/8): Fix CONFIG_OF_UPSTREAM position in defconfig (after CONFIG_CMD_FS_GENERIC per canonical savedefconfig ordering)

v1->v2:
--------
- Fix patch series submission
- Clean up redundant DTS override

History:
--------
[v1] https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
[v2] https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/

Chen Huei Lok (7):
configs: socfpga: n5x: consolidate ATF defconfig and simplify VAB
arm: dts: socfpga: n5x: update GMAC nodes and DT register settings
configs: socfpga: n5x: enable CMD_MTD
configs: socfpga: n5x: enable ISSI QSPI
arm: socfpga: n5x: switch firewall setup to driver model
arch: arm: dts: n5x: switch to using upstream Linux DT config
arm: socfpga: n5x: update SPL data save and restore implementation

 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/socfpga_n5x-u-boot.dtsi          |  55 ++++++++-
 arch/arm/dts/socfpga_n5x_socdk-u-boot.dtsi    |  18 +--
 arch/arm/mach-socfpga/Makefile                |   1 -
 arch/arm/mach-socfpga/firewall.c              | 107 ------------------
 arch/arm/mach-socfpga/include/mach/firewall.h |  69 -----------
 arch/arm/mach-socfpga/spl_n5x.c               |  31 ++++-
 configs/socfpga_n5x_atf_defconfig             |  89 ---------------
 configs/socfpga_n5x_defconfig                 |  26 +++--
 configs/socfpga_n5x_vab_defconfig             |  90 +--------------
 10 files changed, 112 insertions(+), 377 deletions(-)
 delete mode 100644 arch/arm/mach-socfpga/firewall.c
 delete mode 100644 configs/socfpga_n5x_atf_defconfig

--
2.43.7

#1 lore raw

PATCH v3 1/7 configs: socfpga: n5x: consolidate ATF defconfig and simplify VAB

Replace socfpga_n5x_defconfig with the configuration from socfpga_n5x_atf_defconfig and remove the latter, making the ATF-based configuration the default for N5X.

Add # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set to disable raw image support in SPL.

Add # CONFIG_TOOLS_MKEFICAPSULE is not set to disable building the mkeficapsule tool and prevent build errors on hosts without GnuTLS.

Also update socfpga_n5x_vab_defconfig to align with the new ATF-based socfpga_n5x_defconfig baseline. CONFIG_SOCFPGA_SECURE_VAB_AUTH is the only VAB-variant-specific addition; all other settings are shared with socfpga_n5x_defconfig.

---
 configs/socfpga_n5x_atf_defconfig | 89 ------------------------------
 configs/socfpga_n5x_defconfig     | 20 ++++---
 configs/socfpga_n5x_vab_defconfig | 90 +------------------------------
 3 files changed, 14 insertions(+), 185 deletions(-)
 delete mode 100644 configs/socfpga_n5x_atf_defconfig
configs/socfpga_n5x_atf_defconfig deleted +0 -89
deleted file mode 100644
index 674ba744614..00000000000
@@ -1,89 +0,0 @@
-CONFIG_ARM=y
-CONFIG_COUNTER_FREQUENCY=400000000
-CONFIG_ARCH_SOCFPGA=y
-CONFIG_TEXT_BASE=0x200000
-CONFIG_SYS_MALLOC_LEN=0x500000
-CONFIG_NR_DRAM_BANKS=2
-CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
-CONFIG_SF_DEFAULT_MODE=0x2003
-CONFIG_ENV_SIZE=0x1000
-CONFIG_ENV_OFFSET=0x200
-CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="socfpga_n5x_socdk"
-CONFIG_DM_RESET=y
-CONFIG_SPL_STACK=0xffe3f000
-CONFIG_SPL_TEXT_BASE=0xFFE00000
-CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x3ff00000
-CONFIG_SPL_BSS_MAX_SIZE=0x100000
-CONFIG_SYS_BOOTM_LEN=0x2000000
-CONFIG_TARGET_SOCFPGA_N5X_SOCDK=y
-CONFIG_IDENT_STRING="socfpga_n5x"
-CONFIG_SPL_FS_FAT=y
-CONFIG_REMAKE_ELF=y
-CONFIG_FIT=y
-CONFIG_SPL_FIT_SIGNATURE=y
-CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
-CONFIG_BOOTDELAY=5
-CONFIG_USE_BOOTARGS=y
-CONFIG_BOOTARGS="earlycon panic=-1 earlyprintk=ttyS0,115200"
-CONFIG_USE_BOOTCOMMAND=y
-CONFIG_BOOTCOMMAND="run fatscript; run mmcfitload; run mmcfitboot"
-CONFIG_SYS_PBSIZE=2079
-CONFIG_SPL_MAX_SIZE=0x40000
-# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SPL_HAVE_INIT_STACK=y
-CONFIG_SPL_SYS_MALLOC=y
-CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
-CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x3fa00000
-CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
-CONFIG_SPL_CACHE=y
-CONFIG_SPL_SPI_LOAD=y
-CONFIG_SYS_SPI_U_BOOT_OFFS=0x02000000
-CONFIG_SPL_ATF=y
-CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
-CONFIG_SPL_TARGET="spl/u-boot-spl-dtb.hex"
-CONFIG_HUSH_PARSER=y
-CONFIG_SYS_PROMPT="SOCFPGA_N5X # "
-CONFIG_CMD_MEMTEST=y
-CONFIG_CMD_GPIO=y
-CONFIG_CMD_I2C=y
-CONFIG_CMD_MMC=y
-CONFIG_CMD_SPI=y
-CONFIG_CMD_USB=y
-CONFIG_CMD_WDT=y
-CONFIG_CMD_DHCP=y
-CONFIG_CMD_MII=y
-CONFIG_CMD_PING=y
-CONFIG_CMD_CACHE=y
-CONFIG_CMD_EXT4=y
-CONFIG_CMD_FAT=y
-CONFIG_CMD_FS_GENERIC=y
-CONFIG_ENV_IS_IN_MMC=y
-CONFIG_NET_RANDOM_ETHADDR=y
-CONFIG_SPL_DM_SEQ_ALIAS=y
-CONFIG_DWAPB_GPIO=y
-CONFIG_DM_I2C=y
-CONFIG_SYS_I2C_DW=y
-CONFIG_SYS_MMC_MAX_BLK_COUNT=256
-CONFIG_MMC_DW=y
-CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_SPI_FLASH_STMICRO=y
-CONFIG_ETH_DESIGNWARE=y
-CONFIG_MII=y
-CONFIG_PHY_MICREL=y
-CONFIG_PHY_MICREL_KSZ90X1=y
-CONFIG_SYS_NS16550_MEM32=y
-CONFIG_SPI=y
-CONFIG_CADENCE_QSPI=y
-CONFIG_DESIGNWARE_SPI=y
-CONFIG_USB=y
-CONFIG_USB_DWC2=y
-CONFIG_USB_STORAGE=y
-CONFIG_DESIGNWARE_WATCHDOG=y
-CONFIG_WDT=y
-# CONFIG_SPL_USE_TINY_PRINTF is not set
-CONFIG_PANIC_HANG=y
-CONFIG_SPL_CRC32=y
configs/socfpga_n5x_defconfig +12 -8
index 3b3916e676d..97c90656e7d 100644
@@ -1,11 +1,11 @@
 CONFIG_ARM=y
 CONFIG_COUNTER_FREQUENCY=400000000
 CONFIG_ARCH_SOCFPGA=y
-CONFIG_TEXT_BASE=0x1000
+CONFIG_TEXT_BASE=0x200000
 CONFIG_SYS_MALLOC_LEN=0x500000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x101000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
 CONFIG_SF_DEFAULT_MODE=0x2003
 CONFIG_ENV_SIZE=0x1000
 CONFIG_ENV_OFFSET=0x200
@@ -21,15 +21,19 @@ CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_TARGET_SOCFPGA_N5X_SOCDK=y
 CONFIG_IDENT_STRING="socfpga_n5x"
 CONFIG_SPL_FS_FAT=y
-# CONFIG_PSCI_RESET is not set
 CONFIG_REMAKE_ELF=y
+CONFIG_FIT=y
+CONFIG_SPL_FIT_SIGNATURE=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="earlycon panic=-1 earlyprintk=ttyS0,115200"
 CONFIG_USE_BOOTCOMMAND=y
-CONFIG_BOOTCOMMAND="run fatscript; run mmcload; run linux_qspi_enable; run mmcboot"
+CONFIG_BOOTCOMMAND="run fatscript; run mmcfitload; run mmcfitboot"
 CONFIG_SYS_PBSIZE=2079
 CONFIG_SPL_MAX_SIZE=0x40000
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_HAVE_INIT_STACK=y
 CONFIG_SPL_SYS_MALLOC=y
@@ -38,7 +42,9 @@ CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x3fa00000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 CONFIG_SPL_CACHE=y
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_SYS_SPI_U_BOOT_OFFS=0x3c00000
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x02000000
+CONFIG_SPL_ATF=y
+CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_SPL_TARGET="spl/u-boot-spl-dtb.hex"
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="SOCFPGA_N5X # "
@@ -56,10 +62,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
-# CONFIG_CMD_MTDPARTS is not set
 CONFIG_ENV_IS_IN_MMC=y
-CONFIG_USE_BOOTFILE=y
-CONFIG_BOOTFILE="Image"
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_DWAPB_GPIO=y
@@ -85,3 +88,4 @@ CONFIG_WDT=y
 # CONFIG_SPL_USE_TINY_PRINTF is not set
 CONFIG_PANIC_HANG=y
 CONFIG_SPL_CRC32=y
+# CONFIG_TOOLS_MKEFICAPSULE is not set
configs/socfpga_n5x_vab_defconfig +2 -88

91 lines not on this page · raw message

Signature · 1 line
2.43.7
#2 lore raw

PATCH v3 2/7 arm: dts: socfpga: n5x: update GMAC nodes and DT register settings

In reply to Chen Huei Lok

Enable register settings in the N5X U-Boot device tree by adding firewall configuration nodes under the L3 interconnect firewall. These settings disable OCRAM security at the CCU and relax MPFE firewall restrictions required during early boot.

Update the GMAC nodes to include proper compatible, reset-names, and clock-names properties, explicitly setting their status.

Remove the clocks property from the QSPI node in socfpga_n5x_socdk-u-boot.dtsi. The QSPI controller clock is obtained via cm_get_qspi_controller_clk_hz(), so the device tree clock reference is unnecessary.

Additionally, include socfpga_soc64_u-boot.dtsi and rename the soc node to soc@0 in socfpga_n5x-u-boot.dtsi to align with the common SoCFPGA DT layout.

---
 arch/arm/dts/socfpga_n5x-u-boot.dtsi       | 38 +++++++++++++++++++++-
 arch/arm/dts/socfpga_n5x_socdk-u-boot.dtsi |  5 +++
 2 files changed, 42 insertions(+), 1 deletion(-)
arch/arm/dts/socfpga_n5x-u-boot.dtsi +37 -1
index e27a64651e1..dbfd2abfd59 100644
@@ -5,6 +5,7 @@
  * Copyright (C) 2020-2021 Intel Corporation <www.intel.com>
  */
 
+#include "socfpga_soc64_u-boot.dtsi"
 #include "socfpga_soc64_fit-u-boot.dtsi"
 #include <dt-bindings/clock/n5x-clock.h>
 
@@ -15,7 +16,7 @@
 		bootph-all;
 	};
 
-	soc {
+	soc@0 {
 		bootph-all;
 
 		ccu: cache-controller@f7000000 {
@@ -46,17 +47,29 @@
 };
 
 &gmac0 {
+	compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
+	reset-names = "stmmaceth", "stmmaceth-ocp";
 	clocks = <&clkmgr N5X_EMAC0_CLK>;
+	clock-names = "stmmaceth";
+	status = "disabled";
 };
 
 &gmac1 {
+	compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
+	reset-names = "stmmaceth", "stmmaceth-ocp";
 	altr,sysmgr-syscon = <&sysmgr 0x48 0>;
 	clocks = <&clkmgr N5X_EMAC1_CLK>;
+	clock-names = "stmmaceth";
+	status = "disabled";
 };
 
 &gmac2 {
+	compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
+	reset-names = "stmmaceth", "stmmaceth-ocp";
 	altr,sysmgr-syscon = <&sysmgr 0x4c 0>;
 	clocks = <&clkmgr N5X_EMAC2_CLK>;
+	clock-names = "stmmaceth";
+	status = "disabled";
 };
 
 &i2c0 {
@@ -132,6 +145,29 @@
 	clocks = <&clkmgr N5X_L4_MAIN_CLK>;
 };
 
+&socfpga_l3interconnect_firewall {
+	ocram-firewall@f7100200 {
+		reg = <0xf7100200 0x00000014>;
+		intel,offset-settings =
+			/* Disable ocram security at CCU for non secure access */
+			<0x00000004 0x8000ffff 0xe007ffff>,
+			<0x00000008 0x8000ffff 0xe007ffff>,
+			<0x0000000c 0x8000ffff 0xe007ffff>,
+			<0x00000010 0x8000ffff 0xe007ffff>;
+		bootph-all;
+	};
+
+	mpfe-firewall@f8020000 {
+		reg = <0xf8020000 0x0000001c>;
+		intel,offset-settings =
+			/* Disable MPFE firewall for SMMU */
+			<0x00000000 0x00010101 0x00010101>,
+			/* Disable MPFE firewall for HMC adapter */
+			<0x00000004 0x00000001 0x00010101>;
+		bootph-all;
+	};
+};
+
 &sysmgr {
 	compatible = "altr,sys-mgr", "syscon";
 	bootph-all;
arch/arm/dts/socfpga_n5x_socdk-u-boot.dtsi +5 -0
index 840537c9d0b..1f7e31bcae3 100644
@@ -44,6 +44,10 @@
 	bootph-all;
 };
 
+&gmac0 {
+	status = "okay";
+};
+
 &i2c1 {
 	status = "okay";
 };
@@ -55,6 +59,7 @@
 };
 
 &qspi {
+	/delete-property/ clocks;
 	status = "okay";
 };
 
Signature · 1 line
2.43.7
#3 lore raw

PATCH v3 3/7 configs: socfpga: n5x: enable CMD_MTD

In reply to Chen Huei Lok

Enable MTD command support for the N5X platform.
- Enable CONFIG_CMD_MTD to allow MTD operations from the U-Boot shell

This option aligns N5X configuration with other SoCFPGA platforms that use the same MTD framework.

---

Changes in v3:
- Drop CONFIG_SPL_ALTERA_SDRAM: auto-selected by Kconfig for N5X, no explicit defconfig entry needed
- Fix CONFIG_CMD_MTD position: correctly placed between CONFIG_CMD_MMC and CONFIG_CMD_SPI per canonical savedefconfig ordering (was misplaced after CONFIG_CMD_WDT in v2)
- Rename commit from "enable CMD_MTD and SPL SDRAM support" to "enable CMD_MTD" to reflect actual change

 configs/socfpga_n5x_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/socfpga_n5x_defconfig +1 -0
index 97c90656e7d..9159fa0c859 100644
@@ -52,6 +52,7 @@ CONFIG_CMD_MEMTEST=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_WDT=y
Signature · 1 line
2.43.7
#4 lore raw

PATCH v3 4/7 configs: socfpga: n5x: enable ISSI QSPI

In reply to Chen Huei Lok

Enable ISSI SPI flash support in the N5X device.

---

Changes in v3:
- Renumber from 5/8 to 4/7 following the removal of the DDR retention patch from this series
- Fix CONFIG_SPI_FLASH_ISSI position: correctly placed before CONFIG_SPI_FLASH_SPANSION per canonical savedefconfig ordering

 configs/socfpga_n5x_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/socfpga_n5x_defconfig +1 -0
index 9159fa0c859..fc988ed3da2 100644
@@ -71,6 +71,7 @@ CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DW=y
 CONFIG_SYS_MMC_MAX_BLK_COUNT=256
 CONFIG_MMC_DW=y
+CONFIG_SPI_FLASH_ISSI=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_ETH_DESIGNWARE=y
Signature · 1 line
2.43.7
#5 lore raw

PATCH v3 5/7 arm: socfpga: n5x: switch firewall setup to driver model

In reply to Chen Huei Lok

Move the system manager and L3 interconnect firewall configuration from a dedicated firewall_setup() function to the driver model, using uclass_get_device_by_name(). This removes hardcoded firewall setup in SPL and relies on the driver model, making the code more maintainable and aligned with upstream practices.

With spl_n5x.c migrated, no in-tree SoC64 SPL file calls firewall_setup() directly any longer. Remove the function and its private helpers from firewall.c, drop firewall.c from the Makefile, remove the now-unused declaration from firewall.h, and drop the stale firewall.h include from spl_n5x.c.

---

Changes in v3:
- Extend to fully remove the now-dead firewall_setup() implementation:
delete arch/arm/mach-socfpga/firewall.c, remove firewall.o from Makefile, remove the void firewall_setup(void) declaration from firewall.h, drop the now-unused struct socfpga_firwall_l4_per, socfpga_firwall_l4_sys, FIREWALL_L4_DISABLE_ALL, and FIREWALL_BRIDGE_DISABLE_ALL from firewall.h, remove stale #include <asm/arch/firewall.h> from spl_n5x.c

 arch/arm/mach-socfpga/Makefile                |   1 -
 arch/arm/mach-socfpga/firewall.c              | 107 ------------------
 arch/arm/mach-socfpga/include/mach/firewall.h |  69 -----------
 arch/arm/mach-socfpga/spl_n5x.c               |  13 ++-
 4 files changed, 11 insertions(+), 179 deletions(-)
 delete mode 100644 arch/arm/mach-socfpga/firewall.c
arch/arm/mach-socfpga/Makefile +0 -1
index 962dce67c64..5e57d23657c 100644
@@ -114,7 +114,6 @@ obj-y	+= wrap_pinmux_config.o
 obj-y	+= wrap_sdram_config.o
 endif
 ifdef CONFIG_ARCH_SOCFPGA_SOC64
-obj-y	+= firewall.o
 obj-y	+= spl_soc64.o
 endif
 ifdef CONFIG_ARCH_SOCFPGA_ARRIA10
arch/arm/mach-socfpga/firewall.c deleted +0 -107

107 lines not on this page · raw message

arch/arm/mach-socfpga/include/mach/firewall.h +0 -69

79 lines not on this page · raw message

arch/arm/mach-socfpga/spl_n5x.c +11 -2
index a49be837921..0a8dd6d0fee 100644
@@ -5,7 +5,6 @@
  */
 
 #include <asm/arch/clock_manager.h>
-#include <asm/arch/firewall.h>
 #include <asm/arch/mailbox_s10.h>
 #include <asm/arch/misc.h>
 #include <asm/arch/reset_manager.h>
@@ -69,7 +68,17 @@ void board_init_f(ulong dummy)
 	print_reset_info();
 	cm_print_clock_quick_summary();
 
-	firewall_setup();
+	ret = uclass_get_device_by_name(UCLASS_NOP, "socfpga-system-mgr-firewall", &dev);
+	if (ret) {
+		printf("System manager firewall configuration failed: %d\n", ret);
+		hang();
+	}
+
+	ret = uclass_get_device_by_name(UCLASS_NOP, "socfpga-l3interconnect-firewall", &dev);
+	if (ret) {
+		printf("L3 interconnect firewall configuration failed: %d\n", ret);
+		hang();
+	}
 
 	ret = uclass_get_device(UCLASS_CACHE, 0, &dev);
 	if (ret) {
Signature · 1 line
2.43.7
#6 lore raw

PATCH v3 6/7 arch: arm: dts: n5x: switch to using upstream Linux DT config

In reply to Chen Huei Lok

Migrate the legacy n5x platform to use the upstream Linux device tree configuration. This helps reduce maintenance overhead and aligns U-Boot with the Linux kernel's DTS hierarchy and naming conventions.

This change improves consistency between U-Boot and Linux by removing custom/legacy DTS handling and instead relying on the standardized definitions provided by the upstream Linux DTS.

---

Changes in v3:
- Fix CONFIG_OF_UPSTREAM position in defconfig: correctly placed after CONFIG_CMD_FS_GENERIC per canonical savedefconfig ordering (was placed at end of file in v2)

 arch/arm/dts/Makefile                      |  3 +--
 arch/arm/dts/socfpga_n5x-u-boot.dtsi       | 17 +++++++++++++++--
 arch/arm/dts/socfpga_n5x_socdk-u-boot.dtsi | 13 ++++++-------
 configs/socfpga_n5x_defconfig              |  3 ++-
 4 files changed, 24 insertions(+), 12 deletions(-)
arch/arm/dts/Makefile +1 -2
index cbb58180814..c753564f134 100644
@@ -452,8 +452,7 @@ dtb-$(CONFIG_ARCH_SOCFPGA) +=				\
 	socfpga_cyclone5_sr1500.dtb			\
 	socfpga_cyclone5_vining_fpga.dtb		\
 	socfpga_cyclone5_ac501soc.dtb			\
-	socfpga_cyclone5_ac550soc.dtb			\
-	socfpga_n5x_socdk.dtb
+	socfpga_cyclone5_ac550soc.dtb
 
 dtb-$(CONFIG_TARGET_DRA7XX_EVM) += dra72-evm.dtb dra7-evm.dtb	\
 	dra72-evm-revc.dtb dra71-evm.dtb dra76-evm.dtb
arch/arm/dts/socfpga_n5x-u-boot.dtsi +15 -2
index dbfd2abfd59..16b92ef48f4 100644
@@ -10,7 +10,13 @@
 #include <dt-bindings/clock/n5x-clock.h>
 
 /{
-	memory {
+	aliases {
+		spi0 = &qspi;
+		i2c0 = &i2c1;
+	};
+
+	memory@0 {
+		device_type = "memory";
 		#address-cells = <2>;
 		#size-cells = <2>;
 		bootph-all;
@@ -121,6 +127,14 @@
 
 &qspi {
 	bootph-all;
+	compatible = "cdns,qspi-nor";
+	flash0: flash@0 {
+	};
+};
+
+&flash0 {
+	#address-cells = <1>;
+	#size-cells = <1>;
 };
 
 &rst {
@@ -200,7 +214,6 @@
 
 &usb0 {
 	clocks = <&clkmgr N5X_USB_CLK>;
-	disable-over-current;
 	bootph-all;
 };
 
arch/arm/dts/socfpga_n5x_socdk-u-boot.dtsi +6 -7
index 1f7e31bcae3..1bed87c1231 100644
@@ -8,12 +8,11 @@
 #include "socfpga_n5x-u-boot.dtsi"
 
 /{
-	aliases {
-		spi0 = &qspi;
-		i2c0 = &i2c1;
+	chosen {
+		u-boot,spl-boot-order = &mmc;
 	};
 
-	memory {
+	memory@0 {
 		/*
 		 * Memory type: DDR4 (non-interleaving mode)
 		 * 16GB
@@ -38,10 +37,10 @@
 };
 
 &flash0 {
-	compatible = "jedec,spi-nor";
-	spi-tx-bus-width = <4>;
-	spi-rx-bus-width = <4>;
 	bootph-all;
+	cdns,page-size = <256>;
+	cdns,block-size = <16>;
+	/delete-property/ cdns,read-delay;
 };
 
 &gmac0 {
configs/socfpga_n5x_defconfig +2 -1
index fc988ed3da2..d706366337f 100644
@@ -10,7 +10,7 @@ CONFIG_SF_DEFAULT_MODE=0x2003
 CONFIG_ENV_SIZE=0x1000
 CONFIG_ENV_OFFSET=0x200
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="socfpga_n5x_socdk"
+CONFIG_DEFAULT_DEVICE_TREE="intel/socfpga_n5x_socdk"
 CONFIG_DM_RESET=y
 CONFIG_SPL_STACK=0xffe3f000
 CONFIG_SPL_TEXT_BASE=0xFFE00000
@@ -63,6 +63,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
+CONFIG_OF_UPSTREAM=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
Signature · 1 line
2.43.7
#7 lore raw

Re: [PATCH v3 6/7] arch: arm: dts: n5x: switch to using upstream Linux DT config

Hi Lok,

Quoted 27 lines · Chen Huei Lok

Migrate the legacy n5x platform to use the upstream Linux device tree configuration. This helps reduce maintenance overhead and aligns U-Boot with the Linux kernel's DTS hierarchy and naming conventions.

This change improves consistency between U-Boot and Linux by removing custom/legacy DTS handling and instead relying on the standardized definitions provided by the upstream Linux DTS.

---

Changes in v3:
- Fix CONFIG_OF_UPSTREAM position in defconfig: correctly placed after CONFIG_CMD_FS_GENERIC per canonical savedefconfig ordering (was placed at end of file in v2)

  arch/arm/dts/Makefile                      |  3 +--
  arch/arm/dts/socfpga_n5x-u-boot.dtsi       | 17 +++++++++++++++--
  arch/arm/dts/socfpga_n5x_socdk-u-boot.dtsi | 13 ++++++-------
  configs/socfpga_n5x_defconfig              |  3 ++-
  4 files changed, 24 insertions(+), 12 deletions(-)
arch/arm/dts/Makefile +0 -0
index cbb58180814..c753564f134 100644

arch/arm/dts/Makefile dtb-$(CONFIG_ARCH_SOCFPGA) += \ · line 455

Quoted 6 lines
arch/arm/dts/Makefile +1 -2
@@ -452,8 +452,7 @@ dtb-$(CONFIG_ARCH_SOCFPGA) +=				\
  	socfpga_cyclone5_sr1500.dtb			\
  	socfpga_cyclone5_vining_fpga.dtb		\
  	socfpga_cyclone5_ac501soc.dtb			\
-	socfpga_cyclone5_ac550soc.dtb			\
-	socfpga_n5x_socdk.dtb
+	socfpga_cyclone5_ac550soc.dtb

P6 removes:  arch/arm/dts/Makefile entry socfpga_n5x_socdk.dtb P6 changes:  CONFIG_DEFAULT_DEVICE_TREE → intel/socfpga_n5x_socdk Still present: arch/arm/dts/socfpga_n5x_socdk.dts Upstream:    dts/upstream/src/arm64/intel/socfpga_n5x_socdk.dts

Runtime build no longer uses the in-tree vendor socfpga_n5x_socdk.dts once OF_UPSTREAM is enabled. Leaving it creates a stale duplicate that may confuse reviewers.

Best regards,

Tien Fong

#8 lore raw

Re: [PATCH v3 6/7] arch: arm: dts: n5x: switch to using upstream Linux DT config

Hi Tien Fong,

Quoted 3 lines · Tien Fong Chee
Quoted 3 lines

Migrate the legacy n5x platform to use the upstream Linux device tree configuration. This helps reduce maintenance overhead and aligns U-Boot with the Linux kernel's DTS hierarchy and naming conventions.

[...]

Quoted 3 lines

Runtime build no longer uses the in-tree vendor socfpga_n5x_socdk.dts once OF_UPSTREAM is enabled. Leaving it creates a stale duplicate that may confuse reviewers.

Agreed. The in-tree vendor arch/arm/dts/socfpga_n5x_socdk.dts is no longer used once OF_UPSTREAM is enabled.

I'll remove it in v4 and fold the deletion into this same patch.

Best regards,
Lok

#9 lore raw

PATCH v3 7/7 arm: socfpga: n5x: update SPL data save and restore implementation

In reply to Chen Huei Lok

Enable backup for data section to support warm reset as no SPL image would be reloaded in warm reset.

---
 arch/arm/mach-socfpga/spl_n5x.c | 18 ++++++++++++++++++
 configs/socfpga_n5x_defconfig   |  1 +
 2 files changed, 19 insertions(+)
arch/arm/mach-socfpga/spl_n5x.c +18 -0
index 0a8dd6d0fee..8b03d047f33 100644
@@ -18,11 +18,29 @@
 #include <spl.h>
 #include <watchdog.h>
 
+u32 reset_flag(u32 flag)
+{
+	/* Check rstmgr.stat for warm reset status */
+	u32 status = readl(SOCFPGA_RSTMGR_ADDRESS);
+
+	/* Check whether any L4 watchdogs or SDM had triggered warm reset */
+	u32 warm_reset_mask = RSTMGR_L4WD_MPU_WARMRESET_MASK;
+
+	if (status & warm_reset_mask)
+		return 0;
+
+	return 1;
+}
+
 void board_init_f(ulong dummy)
 {
 	int ret;
 	struct udevice *dev;
 
+#if defined(CONFIG_XPL_BUILD) && defined(CONFIG_SPL_RECOVER_DATA_SECTION)
+	spl_save_restore_data();
+#endif
+
 	ret = spl_early_init();
 	if (ret)
 		hang();
configs/socfpga_n5x_defconfig +1 -0
index d706366337f..8f4723398df 100644
@@ -21,6 +21,7 @@ CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_TARGET_SOCFPGA_N5X_SOCDK=y
 CONFIG_IDENT_STRING="socfpga_n5x"
 CONFIG_SPL_FS_FAT=y
+CONFIG_SPL_RECOVER_DATA_SECTION=y
 CONFIG_REMAKE_ELF=y
 CONFIG_FIT=y
 CONFIG_SPL_FIT_SIGNATURE=y
Signature · 1 line
2.43.7