From dac466452be99b29e6fca6f28ca63a8b06c8d69d Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Fri, 7 Nov 2025 16:59:10 +0000 Subject: [PATCH] econet: standardize partitions in DTS files In preparation for the introduction of ethernet, this patch normalizes the partitions in the devices in DT so that the partition to upgrade will always be called tclinux, no matter what it is called from the factory. Also fix a math error in Nokia G240G-E partition table and remove leading zeros from paritition offsets. Finally, add NVMEM mac-address entries where they are left by the factory. In preparation for the introduction of Ethernet and Wifi support. Signed-off-by: Caleb James DeLisle Link: https://github.com/openwrt/openwrt/pull/20685 Signed-off-by: Hauke Mehrtens --- .../econet/dts/en751221_nokia_g240g-e.dts | 60 ++++++++++--------- .../dts/en751221_smartfiber_xp8421-b.dts | 32 ++++++++-- .../dts/en751221_tplink_archer-vr1200v-v2.dts | 49 +++++++++++---- target/linux/econet/en751221/config-6.12 | 5 +- 4 files changed, 102 insertions(+), 44 deletions(-) diff --git a/target/linux/econet/dts/en751221_nokia_g240g-e.dts b/target/linux/econet/dts/en751221_nokia_g240g-e.dts index 7d82b566cc..bea569cdbc 100644 --- a/target/linux/econet/dts/en751221_nokia_g240g-e.dts +++ b/target/linux/econet/dts/en751221_nokia_g240g-e.dts @@ -29,95 +29,97 @@ partition@0 { label = "bootloader"; - reg = <0x00000000 0x00040000>; + reg = <0x0 0x40000>; read-only; }; partition@40000 { - // Unused label = "romfile"; - reg = <0x00040000 0x00040000>; + reg = <0x40000 0x40000>; }; partition@80000 { - // trx - OpenWRT kernel is 4MB, factory is 3MB - label = "kernel"; - reg = <0x00080000 0x00400000>; + label = "tclinux"; + reg = <0x80000 0x2200000>; + econet,enable-remap; }; - partition@380000 { - // squashfs + partition@480000 { label = "rootfs"; - reg = <0x00480000 0x01F00000>; + reg = <0x480000 0x1e00000>; linux,rootfs; }; partition@2280000 { - // trx label = "kernel_slave"; - reg = <0x02280000 0x00300000>; + reg = <0x2280000 0x300000>; }; partition@2580000 { - // squashfs label = "rootfs_slave"; - reg = <0x02580000 0x01F00000>; + reg = <0x2580000 0x1f00000>; }; partition@4480000 { - // trx label = "kernel_oflt"; - reg = <0x04480000 0x00300000>; + reg = <0x4480000 0x300000>; }; partition@4780000 { - // squashfs label = "rootfs_oflt"; - reg = <0x04780000 0x00C00000>; + reg = <0x4780000 0xc00000>; }; partition@5380000 { - // UBI label = "config"; - reg = <0x05380000 0x00800000>; + reg = <0x5380000 0x800000>; }; partition@5b80000 { - // UBI label = "log"; - reg = <0x05b80000 0x00C00000>; + reg = <0x5b80000 0xc00000>; }; partition@6780000 { - // UBI / unused label = "extfs"; - reg = <0x06780000 0x00600000>; + reg = <0x6780000 0x600000>; }; partition@6d80000 { - // binary label = "bosa"; - reg = <0x06d80000 0x00040000>; + reg = <0x6d80000 0x40000>; }; partition@6dc0000 { label = "flag"; - reg = <0x06dc0000 0x00040000>; + reg = <0x6dc0000 0x40000>; }; partition@6e00000 { label = "flagback"; - reg = <0x06e00000 0x00040000>; + reg = <0x6e00000 0x40000>; }; partition@6e40000 { label = "ri"; - reg = <0x06e40000 0x00040000>; + reg = <0x6e40000 0x40000>; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_ri_3e: macaddr@3e { + compatible = "mac-base"; + reg = <0x3e 0x6>; + #nvmem-cell-cells = <1>; + }; + }; }; partition@6e80000 { label = "riback"; - reg = <0x06e80000 0x00040000>; + reg = <0x6e80000 0x40000>; }; }; }; diff --git a/target/linux/econet/dts/en751221_smartfiber_xp8421-b.dts b/target/linux/econet/dts/en751221_smartfiber_xp8421-b.dts index 45654492a8..314c98fc5e 100644 --- a/target/linux/econet/dts/en751221_smartfiber_xp8421-b.dts +++ b/target/linux/econet/dts/en751221_smartfiber_xp8421-b.dts @@ -31,27 +31,35 @@ label = "bootloader"; reg = <0x0 0x40000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bootloader_ff48: macaddr@ff48 { + compatible = "mac-base"; + reg = <0xff48 0x6>; + #nvmem-cell-cells = <1>; + }; + }; }; partition@40000 { label = "romfile"; reg = <0x40000 0x40000>; - read-only; }; partition@80000 { label = "tclinux"; reg = <0x80000 0x1400000>; - read-only; econet,enable-remap; }; - /* Nested inside of tclinux */ partition@480000 { label = "rootfs"; reg = <0x480000 0xf80000>; linux,rootfs; - read-only; }; partition@1480000 { @@ -77,6 +85,22 @@ partition@de40000 { label = "reservearea"; reg = <0xde40000 0x1c0000>; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_reserve_140000: eeprom@140000 { + /* MT7592 */ + reg = <0x140000 0x200>; + }; + + eeprom_reserve_180040: eeprom@180040 { + /* MT7612E */ + reg = <0x180040 0x600>; + }; + }; }; }; }; diff --git a/target/linux/econet/dts/en751221_tplink_archer-vr1200v-v2.dts b/target/linux/econet/dts/en751221_tplink_archer-vr1200v-v2.dts index 1866b446fd..56dec97c27 100644 --- a/target/linux/econet/dts/en751221_tplink_archer-vr1200v-v2.dts +++ b/target/linux/econet/dts/en751221_tplink_archer-vr1200v-v2.dts @@ -29,34 +29,63 @@ partition@0 { label = "bootloader"; - reg = <0x0 0x00080000>; + reg = <0x0 0x80000>; read-only; }; + partition@80000 { label = "misc"; - reg = <0x00080000 0x140000>; + reg = <0x80000 0x140000>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_misc_80000: eeprom@80000 { + /* MT7592 */ + reg = <0x80000 0x200>; + }; + + eeprom_misc_a0000: eeprom@a0000 { + /* MT7613BE */ + reg = <0xa0000 0x600>; + }; + + macaddr_misc_8f100: macaddr@8f100 { + compatible = "mac-base"; + reg = <0x4f100 0x6>; + #nvmem-cell-cells = <1>; + }; + }; }; - partition@1c0200 { - label = "kernel"; - reg = <0x001c0000 0x400000>; + + partition@1c0000 { + label = "tclinux"; + reg = <0x1c0000 0x1e40000>; + econet,enable-remap; }; + partition@5c0000 { label = "rootfs"; - reg = <0x005c0000 0x1a40000>; + reg = <0x5c0000 0x1a40000>; linux,rootfs; }; - partition@1c0000 { - label = "firmware"; - reg = <0x001c0000 0x1e40000>; - }; + partition@2000000 { label = "firmware_factory"; reg = <0x2000000 0x1e40000>; }; + + partition@3e40000 { + label = "unused"; + reg = <0x3e40000 0x1a0000>; + }; + partition@3fe0000 { label = "reserve"; reg = <0x3fe0000 0x20000>; }; + partition@4000000 { label = "openwrt_ubi"; /* From the factory this is unallocated space, so it's ours for the taking. diff --git a/target/linux/econet/en751221/config-6.12 b/target/linux/econet/en751221/config-6.12 index 653019f9c5..86991c3963 100644 --- a/target/linux/econet/en751221/config-6.12 +++ b/target/linux/econet/en751221/config-6.12 @@ -120,6 +120,9 @@ CONFIG_NET_INGRESS=y CONFIG_NET_XGRESS=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NR_CPUS=2 +CONFIG_NVMEM=y +CONFIG_NVMEM_LAYOUTS=y +CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y @@ -141,6 +144,7 @@ CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y CONFIG_RFS_ACCEL=y CONFIG_RPS=y +CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES=y CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y CONFIG_SGL_ALLOC=y @@ -152,7 +156,6 @@ CONFIG_SPI=y CONFIG_SPI_AIROHA_EN7523=y CONFIG_SPI_MASTER=y CONFIG_SPI_MEM=y -CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_SYS_HAS_CPU_MIPS32_R1=y CONFIG_SYS_HAS_CPU_MIPS32_R2=y -- 2.30.2