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.

Signed-off-by: Chen Huei Lok <[email protected]>
---

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(-)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index cbb58180814..c753564f134 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -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
diff --git a/arch/arm/dts/socfpga_n5x-u-boot.dtsi 
b/arch/arm/dts/socfpga_n5x-u-boot.dtsi
index dbfd2abfd59..16b92ef48f4 100644
--- a/arch/arm/dts/socfpga_n5x-u-boot.dtsi
+++ b/arch/arm/dts/socfpga_n5x-u-boot.dtsi
@@ -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;
 };
 
diff --git a/arch/arm/dts/socfpga_n5x_socdk-u-boot.dtsi 
b/arch/arm/dts/socfpga_n5x_socdk-u-boot.dtsi
index 1f7e31bcae3..1bed87c1231 100644
--- a/arch/arm/dts/socfpga_n5x_socdk-u-boot.dtsi
+++ b/arch/arm/dts/socfpga_n5x_socdk-u-boot.dtsi
@@ -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 {
diff --git a/configs/socfpga_n5x_defconfig b/configs/socfpga_n5x_defconfig
index fc988ed3da2..d706366337f 100644
--- a/configs/socfpga_n5x_defconfig
+++ b/configs/socfpga_n5x_defconfig
@@ -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
-- 
2.43.7

Reply via email to