Skip to contentSkip to conversation

socfpga: n5x: Update Boot Support for N5X

PATCH In review Chen Huei Lok 2 participants 15 messages Jun 23 – Jul 8

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 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]/

v3->v4:
--------
- Patch 6: Remove the now-unused in-tree vendor arch/arm/dts/socfpga_n5x_socdk.dts. Once OF_UPSTREAM is enabled the runtime build uses dts/upstream/src/arm64/intel/socfpga_n5x_socdk.dts, so the in-tree copy is a stale duplicate (matches the Stratix10 DT-switch patch). No other patches changed.

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]/
[v3] 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/dts/socfpga_n5x_socdk.dts            | 122 ------------------
 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 +------------
 11 files changed, 112 insertions(+), 499 deletions(-)
 delete mode 100644 arch/arm/dts/socfpga_n5x_socdk.dts
 delete mode 100644 arch/arm/mach-socfpga/firewall.c
 delete mode 100644 configs/socfpga_n5x_atf_defconfig
Signature · 1 line
2.43.7
#1 lore raw

PATCH v4 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
Reviewed-by on v4 1/7
#2 lore raw

Re: [PATCH v4 1/7] configs: socfpga: n5x: consolidate ATF defconfig and simplify VAB

Quoted 271 lines · Chen Huei Lok

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 -78
index 817a01bbf51..3fe74846d01 100644
@@ -1,89 +1,3 @@
-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
+#include <configs/socfpga_n5x_defconfig>
+
  CONFIG_SOCFPGA_SECURE_VAB_AUTH=y
-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

configs/socfpga_n5x_vab_defconfig line 89

Quoted 10 lines
configs/socfpga_n5x_vab_defconfig +0 -10
-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

Best regards,
Tien Fong

#3 lore raw

PATCH v4 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
Reviewed-by on v4 2/7
#4 lore raw

Re: [PATCH v4 2/7] arm: dts: socfpga: n5x: update GMAC nodes and DT register settings

Quoted 123 lines · 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 +4 -0
index 840537c9d0b..1f7e31bcae3 100644
@@ -44,6 +44,10 @@
  	bootph-all;
  };
 
+&gmac0 {
+	status = "okay";
+};
+
  &i2c1 {
  	status = "okay";
  };

arch/arm/dts/socfpga_n5x_socdk-u-boot.dtsi line 65

Quoted 7 lines
arch/arm/dts/socfpga_n5x_socdk-u-boot.dtsi +1 -0
@@ -55,6 +59,7 @@
  };
 
  &qspi {
+	/delete-property/ clocks;
  	status = "okay";
  };
 

Best regards,
Tien Fong

#5 lore raw

PATCH v4 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
Reviewed-by on v4 3/7
#6 lore raw

Re: [PATCH v4 3/7] configs: socfpga: n5x: enable CMD_MTD

Quoted 27 lines · 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 +0 -0
index 97c90656e7d..9159fa0c859 100644

configs/socfpga_n5x_defconfig CONFIG_CMD_MEMTEST=y · line 58

Quoted 7 lines
configs/socfpga_n5x_defconfig +1 -0
@@ -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

Best regards,
Tien Fong

#7 lore raw

PATCH v4 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
Reviewed-by on v4 4/7
#8 lore raw

Re: [PATCH v4 4/7] configs: socfpga: n5x: enable ISSI QSPI

Quoted 20 lines · 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 +0 -0
index 9159fa0c859..fc988ed3da2 100644

configs/socfpga_n5x_defconfig CONFIG_DM_I2C=y · line 77

Quoted 7 lines
configs/socfpga_n5x_defconfig +1 -0
@@ -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

Best regards,
Tien Fong

#9 lore raw

PATCH v4 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
Reviewed-by on v4 5/7
#10 lore raw

Re: [PATCH v4 5/7] arm: socfpga: n5x: switch firewall setup to driver model

Quoted 263 lines · 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
deleted file mode 100644
index 4dec47b8e96..00000000000
@@ -1,107 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2016-2019 Intel Corporation <www.intel.com>
- *
- */
-
-#include <mach/base_addr_soc64.h>
-#include <asm/io.h>
-#include <asm/arch/firewall.h>
-#include <asm/arch/system_manager.h>
-
-static void firewall_l4_per_disable(void)
-{
-	const struct socfpga_firwall_l4_per *firwall_l4_per_base =
-		(struct socfpga_firwall_l4_per *)SOCFPGA_FIREWALL_L4_PER;
-	u32 i;
-	const u32 *addr[] = {
-			&firwall_l4_per_base->nand,
-			&firwall_l4_per_base->nand_data,
-			&firwall_l4_per_base->usb0,
-			&firwall_l4_per_base->usb1,
-			&firwall_l4_per_base->spim0,
-			&firwall_l4_per_base->spim1,
-			&firwall_l4_per_base->emac0,
-			&firwall_l4_per_base->emac1,
-			&firwall_l4_per_base->emac2,
-			&firwall_l4_per_base->sdmmc,
-			&firwall_l4_per_base->gpio0,
-			&firwall_l4_per_base->gpio1,
-			&firwall_l4_per_base->i2c0,
-			&firwall_l4_per_base->i2c1,
-			&firwall_l4_per_base->i2c2,
-			&firwall_l4_per_base->i2c3,
-			&firwall_l4_per_base->i2c4,
-			&firwall_l4_per_base->timer0,
-			&firwall_l4_per_base->timer1,
-			&firwall_l4_per_base->uart0,
-			&firwall_l4_per_base->uart1
-			};
-
-	/*
-	 * The following lines of code will enable non-secure access
-	 * to nand, usb, spi, emac, sdmmc, gpio, i2c, timers and uart. This
-	 * is needed as most OS run in non-secure mode. Thus we need to
-	 * enable non-secure access to these peripherals in order for the
-	 * OS to use these peripherals.
-	 */
-	for (i = 0; i < ARRAY_SIZE(addr); i++)
-		writel(FIREWALL_L4_DISABLE_ALL, addr[i]);
-}
-
-static void firewall_l4_sys_disable(void)
-{
-	const struct socfpga_firwall_l4_sys *firwall_l4_sys_base =
-		(struct socfpga_firwall_l4_sys *)SOCFPGA_FIREWALL_L4_SYS;
-	u32 i;
-	const u32 *addr[] = {
-			&firwall_l4_sys_base->dma_ecc,
-			&firwall_l4_sys_base->emac0rx_ecc,
-			&firwall_l4_sys_base->emac0tx_ecc,
-			&firwall_l4_sys_base->emac1rx_ecc,
-			&firwall_l4_sys_base->emac1tx_ecc,
-			&firwall_l4_sys_base->emac2rx_ecc,
-			&firwall_l4_sys_base->emac2tx_ecc,
-			&firwall_l4_sys_base->nand_ecc,
-			&firwall_l4_sys_base->nand_read_ecc,
-			&firwall_l4_sys_base->nand_write_ecc,
-			&firwall_l4_sys_base->ocram_ecc,
-			&firwall_l4_sys_base->sdmmc_ecc,
-			&firwall_l4_sys_base->usb0_ecc,
-			&firwall_l4_sys_base->usb1_ecc,
-			&firwall_l4_sys_base->clock_manager,
-			&firwall_l4_sys_base->io_manager,
-			&firwall_l4_sys_base->reset_manager,
-			&firwall_l4_sys_base->system_manager,
-			&firwall_l4_sys_base->watchdog0,
-			&firwall_l4_sys_base->watchdog1,
-			&firwall_l4_sys_base->watchdog2,
-			&firwall_l4_sys_base->watchdog3
-		};
-
-	for (i = 0; i < ARRAY_SIZE(addr); i++)
-		writel(FIREWALL_L4_DISABLE_ALL, addr[i]);
-}
-
-static void firewall_bridge_disable(void)
-{
-	/* disable lwsocf2fpga and soc2fpga bridge security */
-	writel(FIREWALL_BRIDGE_DISABLE_ALL, SOCFPGA_FIREWALL_SOC2FPGA);
-	writel(FIREWALL_BRIDGE_DISABLE_ALL, SOCFPGA_FIREWALL_LWSOC2FPGA);
-}
-
-void firewall_setup(void)
-{
-	firewall_l4_per_disable();
-	firewall_l4_sys_disable();
-	firewall_bridge_disable();
-
-	/* disable SMMU security */
-	writel(FIREWALL_L4_DISABLE_ALL, SOCFPGA_FIREWALL_TCU);
-
-	/* enable non-secure interface to DMA330 DMA and peripherals */
-	writel(SYSMGR_DMA_IRQ_NS | SYSMGR_DMA_MGR_NS,
-	       socfpga_get_sysmgr_addr() + SYSMGR_SOC64_DMA);
-	writel(SYSMGR_DMAPERIPH_ALL_NS,
-	       socfpga_get_sysmgr_addr() + SYSMGR_SOC64_DMA_PERIPH);
-}
arch/arm/mach-socfpga/include/mach/firewall.h +0 -69
index b47b577ae75..8f3b7d90ad1 100644
@@ -10,73 +10,6 @@
 
  #include <linux/bitops.h>
 
-struct socfpga_firwall_l4_per {
-	u32	nand;		/* 0x00 */
-	u32	nand_data;
-	u32	_pad_0x8;
-	u32	usb0;
-	u32	usb1;		/* 0x10 */
-	u32	_pad_0x14;
-	u32	_pad_0x18;
-	u32	spim0;
-	u32	spim1;		/* 0x20 */
-	u32	spis0;
-	u32	spis1;
-	u32	emac0;
-	u32	emac1;		/* 0x30 */
-	u32	emac2;
-	u32	_pad_0x38;
-	u32	_pad_0x3c;
-	u32	sdmmc;		/* 0x40 */
-	u32	gpio0;
-	u32	gpio1;
-	u32	_pad_0x4c;
-	u32	i2c0;		/* 0x50 */
-	u32	i2c1;
-	u32	i2c2;
-	u32	i2c3;
-	u32	i2c4;		/* 0x60 */
-	u32	timer0;
-	u32	timer1;
-	u32	uart0;
-	u32	uart1;		/* 0x70 */
-};
-
-struct socfpga_firwall_l4_sys {
-	u32	_pad_0x00;		/* 0x00 */
-	u32	_pad_0x04;
-	u32	dma_ecc;
-	u32	emac0rx_ecc;
-	u32	emac0tx_ecc;		/* 0x10 */
-	u32	emac1rx_ecc;
-	u32	emac1tx_ecc;
-	u32	emac2rx_ecc;
-	u32	emac2tx_ecc;		/* 0x20 */
-	u32	_pad_0x24;
-	u32	_pad_0x28;
-	u32	nand_ecc;
-	u32	nand_read_ecc;		/* 0x30 */
-	u32	nand_write_ecc;
-	u32	ocram_ecc;
-	u32	_pad_0x3c;
-	u32	sdmmc_ecc;		/* 0x40 */
-	u32	usb0_ecc;
-	u32	usb1_ecc;
-	u32	clock_manager;
-	u32	_pad_0x50;		/* 0x50 */
-	u32	io_manager;
-	u32	reset_manager;
-	u32	system_manager;
-	u32	osc0_timer;		/* 0x60 */
-	u32	osc1_timer;
-	u32	watchdog0;
-	u32	watchdog1;
-	u32	watchdog2;		/* 0x70 */
-	u32	watchdog3;
-};
-
-#define FIREWALL_L4_DISABLE_ALL		(BIT(0) | BIT(24) | BIT(16))
-#define FIREWALL_BRIDGE_DISABLE_ALL	(~0)
 
  /* Cache coherency unit (CCU) registers */
  #define CCU_CPU0_MPRT_ADBASE_DDRREG		0x4400
@@ -149,6 +82,4 @@ struct socfpga_firwall_l4_sys {
  	writel(data, SOCFPGA_FW_MPU_DDR_SCR_ADDRESS + (reg))
  #endif
 
-void firewall_setup(void);
-
  #endif /* _FIREWALL_H_ */
arch/arm/mach-socfpga/spl_n5x.c +4 -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();

arch/arm/mach-socfpga/spl_n5x.c void board_init_f(ulong dummy) · line 84

Quoted 10 lines
arch/arm/mach-socfpga/spl_n5x.c +7 -0
+	}
+
+	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) {

Best regards,
Tien Fong

#11 lore raw

PATCH v4 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 v4:
- Remove the now-unused in-tree vendor arch/arm/dts/socfpga_n5x_socdk.dts, superseded by dts/upstream/src/arm64/intel/socfpga_n5x_socdk.dts once OF_UPSTREAM is enabled (matches the Stratix10 DT-switch patch)

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 +--
 arch/arm/dts/socfpga_n5x_socdk.dts         | 122 ---------------------
 configs/socfpga_n5x_defconfig              |   3 +-
 5 files changed, 24 insertions(+), 134 deletions(-)
 delete mode 100644 arch/arm/dts/socfpga_n5x_socdk.dts
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 {
arch/arm/dts/socfpga_n5x_socdk.dts deleted +0 -122

122 lines not on this page · raw message

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
Reviewed-by on v4 6/7
#12 lore raw

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

Quoted 261 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 v4:
- Remove the now-unused in-tree vendor arch/arm/dts/socfpga_n5x_socdk.dts, superseded by dts/upstream/src/arm64/intel/socfpga_n5x_socdk.dts once OF_UPSTREAM is enabled (matches the Stratix10 DT-switch patch)

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 +--
  arch/arm/dts/socfpga_n5x_socdk.dts         | 122 ---------------------
  configs/socfpga_n5x_defconfig              |   3 +-
  5 files changed, 24 insertions(+), 134 deletions(-)

delete mode 100644 arch/arm/dts/socfpga_n5x_socdk.dts

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 {
arch/arm/dts/socfpga_n5x_socdk.dts deleted +0 -122
deleted file mode 100644
index 915b8f6380e..00000000000
@@ -1,122 +0,0 @@
-// SPDX-License-Identifier:     GPL-2.0
-/*
- * Copyright (C) 2020-2021, Intel Corporation
- */
-#include "socfpga_agilex.dtsi"
-
-/ {
-	model = "eASIC N5X SoCDK";
-
-	aliases {
-		serial0 = &uart0;
-		ethernet0 = &gmac0;
-		ethernet1 = &gmac1;
-		ethernet2 = &gmac2;
-	};
-
-	chosen {
-		stdout-path = "serial0:115200n8";
-	};
-
-	memory {
-		device_type = "memory";
-		/* We expect the bootloader to fill in the reg */
-		reg = <0 0 0 0>;
-	};
-
-	soc {
-		clocks {
-			osc1 {
-				clock-frequency = <25000000>;
-			};
-		};
-	};
-};
-
-&gmac0 {
-	status = "okay";
-	phy-mode = "rgmii";
-	phy-handle = <&phy0>;
-	max-frame-size = <9000>;
-
-	mdio0 {
-		#address-cells = <1>;
-		#size-cells = <0>;
-		compatible = "snps,dwmac-mdio";
-		phy0: ethernet-phy@0 {
-			reg = <4>;
-
-			txd0-skew-ps = <0>; /* -420ps */
-			txd1-skew-ps = <0>; /* -420ps */
-			txd2-skew-ps = <0>; /* -420ps */
-			txd3-skew-ps = <0>; /* -420ps */
-			rxd0-skew-ps = <420>; /* 0ps */
-			rxd1-skew-ps = <420>; /* 0ps */
-			rxd2-skew-ps = <420>; /* 0ps */
-			rxd3-skew-ps = <420>; /* 0ps */
-			txen-skew-ps = <0>; /* -420ps */
-			txc-skew-ps = <900>; /* 0ps */
-			rxdv-skew-ps = <420>; /* 0ps */
-			rxc-skew-ps = <1680>; /* 780ps */
-		};
-	};
-};
-
-&gpio1 {
-	status = "okay";
-};
-
-&mmc {
-	status = "okay";
-	cap-sd-highspeed;
-	broken-cd;
-	bus-width = <4>;
-};
-
-&qspi {
-	status = "okay";
-	flash0: flash@0 {
-		#address-cells = <1>;
-		#size-cells = <1>;
-		compatible = "mt25qu02g";
-		reg = <0>;
-		spi-max-frequency = <100000000>;
-
-		m25p,fast-read;
-		cdns,page-size = <256>;
-		cdns,block-size = <16>;
-		cdns,read-delay = <3>;
-		cdns,tshsl-ns = <50>;
-		cdns,tsd2d-ns = <50>;
-		cdns,tchsh-ns = <4>;
-		cdns,tslch-ns = <4>;
-
-		partitions {
-			compatible = "fixed-partitions";
-			#address-cells = <1>;
-			#size-cells = <1>;
-
-			qspi_boot: partition@0 {
-				label = "Boot and fpga data";
-				reg = <0x0 0x034B0000>;
-			};
-
-			qspi_rootfs: partition@34B0000 {
-				label = "Root Filesystem - JFFS2";
-				reg = <0x034B0000 0x0EB50000>;
-			};
-		};
-	};
-};
-
-&uart0 {
-	status = "okay";
-};
-
-&usb0 {
-	status = "okay";
-};
-
-&usb1 {
-	status = "okay";
-};
configs/socfpga_n5x_defconfig +1 -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

configs/socfpga_n5x_defconfig CONFIG_CMD_CACHE=y · line 69

Quoted 7 lines
configs/socfpga_n5x_defconfig +1 -0
@@ -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

Best regards,
Tien Fong

#13 lore raw

PATCH v4 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
Reviewed-by on v4 7/7
#14 lore raw

Re: [PATCH v4 7/7] arm: socfpga: n5x: update SPL data save and restore implementation

Quoted 48 lines · 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 +0 -0
index d706366337f..8f4723398df 100644

configs/socfpga_n5x_defconfig CONFIG_SYS_BOOTM_LEN=0x2000000 · line 27

Quoted 7 lines
configs/socfpga_n5x_defconfig +1 -0
@@ -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

Best regards,
Tien Fong