lantiq: more conversions to nvmem
authorRosen Penev <[email protected]>
Wed, 4 Sep 2024 00:07:49 +0000 (17:07 -0700)
committerHauke Mehrtens <[email protected]>
Fri, 28 Nov 2025 00:20:33 +0000 (01:20 +0100)
Now that NVMEM in UBI is supported, more handling can be moved.

Signed-off-by: Rosen Penev <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/16376
Signed-off-by: Hauke Mehrtens <[email protected]>
18 files changed:
target/linux/lantiq/ase/base-files/etc/board.d/02_network
target/linux/lantiq/config-6.12
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/amazonse_allnet_all0333cj.dts
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube_arcadyan_arv4510pw.dts
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube_bt_homehub-v2b.dts
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_alphanetworks_asl56026.dts
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_arcadyan_vg3503j.dts
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_buffalo_wbmr-300hpd.dts
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920-nand.dts
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920-nor.dts
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920.dtsi
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f3.dts
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-fx.dtsi
target/linux/lantiq/xrx200/base-files/etc/board.d/02_network
target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/02_network
target/linux/lantiq/xway/base-files/etc/board.d/02_network

index a088c62aa0a7b447815e6c8f96a43c127ec1a1cb..afb1bfacf05c7ef4309e36db8505f3e6e1e11027 100644 (file)
@@ -36,8 +36,7 @@ lantiq_setup_macs()
 
        case "$board" in
        allnet,all0333cj)
-               lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
-               wan_mac=$(macaddr_add "$lan_mac" 1)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1)
                ;;
        esac
 
index cd58233f35251a5bfd418a70a26d3b57acf0f754..19d5dc0da1f8f2578f696154fe76582959e36859 100644 (file)
@@ -127,6 +127,7 @@ CONFIG_NO_EXCEPT_FILL=y
 CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
 CONFIG_NVMEM=y
 CONFIG_NVMEM_LAYOUTS=y
+CONFIG_NVMEM_LAYOUT_U_BOOT_ENV=y
 CONFIG_OF=y
 CONFIG_OF_ADDRESS=y
 CONFIG_OF_EARLY_FLATTREE=y
index e543ab29aa51e0334dcf55db3da72e77298a903f..89fee57a5615a5f3d9a0a98facb284e55d100c28 100644 (file)
@@ -73,6 +73,9 @@
 
 &gsw {
        phy-mode = "mii";
+
+       nvmem-cells = <&macaddr_uboot_ethaddr 0>;
+       nvmem-cell-names = "mac-address";
 };
 
 &localbus {
                                label = "u-boot-env";
                                reg = <0x3ff200 0xc00>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "u-boot,env";
+
+                                       macaddr_uboot_ethaddr: ethaddr {
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
 
                        partition@3ffe00 {
index 13ce8423ef326927ba86833bc0506929a3730934..94fc80b54eafca348673e7514a3b9d3f5c2e1f8d 100644 (file)
 
 &gsw {
        phy-mode = "rmii";
+
+       nvmem-cells = <&macaddr_uboot_ethaddr 0>;
+       nvmem-cell-names = "mac-address";
+};
+
+&ppe {
+       nvmem-cells = <&macaddr_uboot_ethaddr 1>;
+       nvmem-cell-names = "mac-address";
 };
 
 &localbus {
                                label = "u-boot-env";
                                reg = <0x40000 0x20000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "u-boot,env";
+
+                                       macaddr_uboot_ethaddr: ethaddr {
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
 
                        partition@60000 {
index 1811c7f5874026ea2836f25ad1dd96695bcf5a88..3304a4c37ab666b6b04d84b9ac5f951b9cd5c3c0 100644 (file)
 
 &gsw {
        phy-mode = "rmii";
+
+       nvmem-cells = <&macaddr_uboot_ethaddr 0>;
+       nvmem-cell-names = "mac-address";
+};
+
+&ppe {
+       nvmem-cells = <&macaddr_uboot_ethaddr 1>;
+       nvmem-cell-names = "mac-address";
 };
 
 &localbus {
                        partition@40000 {
                                label = "u-boot-env";
                                reg = <0x40000 0x10000>; /* 64KB */
+
+                               nvmem-layout {
+                                       compatible = "u-boot,env";
+
+                                       macaddr_uboot_ethaddr: ethaddr {
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
 
                        partition@50000 {
                compatible = "pci168c,0027";
                reg = <0x7000 0 0 0 0>;
                qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */
+
+               nvmem-cells = <&macaddr_uboot_ethaddr 2>;
+               nvmem-cell-names = "mac-address";
        };
 };
 
index 59e32dc5ea56a7e06c63f33c577e8c696efbe2c9..1685a9fe17357d1a4841f8d3f41267d7794ecf84 100644 (file)
        };
 };
 
+&eth0 {
+       nvmem-cells = <&macaddr_uboot_ethaddr 0>;
+       nvmem-cell-names = "mac-address";
+};
+
 &gphy0 {
        lantiq,gphy-mode = <GPHY_MODE_FE>;
 };
                        partition@30000 {
                                label = "u-boot-env";
                                reg = <0x30000 0x10000>;
+
+                               nvmem-layout {
+                                       compatible = "u-boot,env";
+
+                                       macaddr_uboot_ethaddr: ethaddr {
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
 
                        partition@40000 {
index 5c5f533dbc2f0a9bfc1ff74411cc525696c73544..4a673801588300a906ff618a12c1a2230a515862 100644 (file)
@@ -69,6 +69,8 @@
        pinctrl-0 = <&gphy0_led0_pins>, <&gphy0_led1_pins>, <&gphy0_led2_pins>,
                    <&gphy1_led0_pins>, <&gphy1_led1_pins>, <&gphy1_led2_pins>;
        pinctrl-names = "default";
+       nvmem-cells = <&macaddr_uboot_ethaddr 0>;
+       nvmem-cell-names = "mac-address";
 };
 
 &gswip_mdio {
                        partition@7f0000 {
                                label = "u-boot-env";
                                reg = <0x7f0000 0x10000>;
+
+                               nvmem-layout {
+                                       compatible = "u-boot,env";
+
+                                       macaddr_uboot_ethaddr: ethaddr {
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
                };
        };
index 30adbc6e6f3fe9835c86c55ae2c01f8fa1c42a49..2d31e40f423730ecb0540fbde9491cb7962e2044 100644 (file)
 };
 
 &ppe {
-       nvmem-cells = <&macaddr_caldata_110c 5>;
+       nvmem-cells = <&macaddr_caldata_110c 4>;
        nvmem-cell-names = "mac-address";
 };
 
index 6a23794c7be8171b50f0531a553475aac6b5fd21..d3f6cfa209ed3d0e5439a7518ec7a246eddf7a5e 100644 (file)
        };
 };
 
+&eth0 {
+       nvmem-cells = <&macaddr_uboot_ethaddr 0>;
+       nvmem-cell-names = "mac-address";
+};
+
+&ppe {
+       nvmem-cells = <&macaddr_uboot_ethaddr 1>;
+       nvmem-cell-names = "mac-address";
+};
+
 &gphy0 {
        lantiq,gphy-mode = <GPHY_MODE_FE>;
 };
                        partition@ff0000 {
                                reg = <0xff0000 0x2000>;
                                label = "u-boot-env";
+
+                               nvmem-layout {
+                                       compatible = "u-boot,env";
+
+                                       macaddr_uboot_ethaddr: ethaddr {
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
 
                        partition@ff3000 {
index 82f72022c99ba2f0bf052583297387ae74033745..69dea689af7984138af129d76f647fa943aa0253 100644 (file)
                        partition@100000 {
                                label = "u-boot-env";
                                reg = <0x100000 0x40000>; /* 256 KB */
+
+                               nvmem-layout {
+                                       compatible = "u-boot,env";
+
+                                       macaddr_uboot_ethaddr: ethaddr {
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
 
                        partition@140000 {
index b0977b35c5edf0ee4ec28e40958c3805758edfe2..8ad7539f22159b26d9e19272c55817869db73804 100644 (file)
                        partition@10000 {
                                label = "u-boot-env";
                                reg = <0x10000 0x10000>;
+
+                               nvmem-layout {
+                                       compatible = "u-boot,env";
+
+                                       macaddr_uboot_ethaddr: ethaddr {
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
 
                        partition@20000 {
index f477ad8db28030564cc2d1a957ddaa1926241dcf..4d685bee66127130798bc9a05ca316e4d83333df 100644 (file)
        };
 };
 
+&eth0 {
+       nvmem-cells = <&macaddr_uboot_ethaddr 0>;
+       nvmem-cell-names = "mac-address";
+};
+
 &gphy0 {
        lantiq,gphy-mode = <GPHY_MODE_GE>;
 };
                label = "wan";
                phy-mode = "rgmii";
                phy-handle = <&phy5>;
+               nvmem-cells = <&macaddr_uboot_ethaddr 1>;
+               nvmem-cell-names = "mac-address";
        };
 };
 
index e3bc666d415ecf35c9854ea151012f794f8b29f6..74858ec118df48e988a624e18c74715c31c3f850 100644 (file)
                        partition@40000 {
                                label = "u-boot-env";
                                reg = <0x40000 0x20000>;
+
+                               nvmem-layout {
+                                       compatible = "u-boot,env";
+
+                                       macaddr_uboot_ethaddr: ethaddr {
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
                        partition@60000 {
                                label = "kernel";
index 59dcac56813278edc6802855957e1170f4b4aef6..57284034d37cab3085a8e3be0b9d85c1286d1ff3 100644 (file)
                        partition@50000 {
                                label = "u-boot-env";
                                reg = <0x50000 0x10000>;
+
+                               nvmem-layout {
+                                       compatible = "u-boot,env";
+
+                                       macaddr_uboot_ethaddr: ethaddr {
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
                        partition@60000 {
                                label = "unused";
index 2b8dc285cbd03bf0829791ae7057ed77ca718637..9d4a4e7e92902aaa5f5568ac5ee3e3c68a191ee3 100644 (file)
                    <&gphy0_led1_pins>, <&gphy0_led2_pins>,
                    <&gphy1_led1_pins>, <&gphy1_led2_pins>;
        pinctrl-names = "default";
+       nvmem-cells = <&macaddr_uboot_ethaddr 0>;
+       nvmem-cell-names = "mac-address";
 };
 
 &gswip_mdio {
                label = "wan";
                phy-mode = "rgmii";
                phy-handle = <&phy5>;
+               nvmem-cells = <&macaddr_uboot_ethaddr 1>;
+               nvmem-cell-names = "mac-address";
        };
 };
 
index ca40c9cbd688f68a21498d0adbe5b2221f4adcf0..d6377140b35025fc9b48c3f8bb5374c8a5ed00a8 100644 (file)
@@ -93,8 +93,7 @@ lantiq_setup_macs()
        lantiq,easy80920-nor|\
        zyxel,p-2812hnu-f1|\
        zyxel,p-2812hnu-f3)
-               lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
-               wan_mac=$(macaddr_add "$lan_mac" 1)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1)
                ;;
        arcadyan,vgv7519-brn|\
        arcadyan,vgv7519-nor|\
@@ -131,8 +130,7 @@ lantiq_setup_macs()
                wan_mac=$(macaddr_add "$(mtd_get_mac_binary_ubi caldata 0x110c)" 5)
                ;;
        buffalo,wbmr-300hpd)
-               lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
-               wan_mac="$lan_mac"
+               wan_mac="$(mtd_get_mac_ascii u-boot-env ethaddr)"
                ;;
        tplink,vr200|\
        tplink,vr200v)
index 9088de86b10cbf17462038ca3aff0593a8126831..edb2a04b3321b4c6963406054048db876d017947 100644 (file)
@@ -44,16 +44,13 @@ lantiq_setup_macs()
 
        case "$board" in
        alphanetworks,asl56026)
-               lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
                wan_mac=$(mtd_get_mac_ascii u-boot-env wanmac)
                ;;
        arcadyan,vg3503j)
-               lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
-               wan_mac=$(macaddr_add "$lan_mac" 1)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1)
                ;;
        netgear,dm200)
-               lan_mac=$(mtd_get_mac_binary ART 0x0)
-               wan_mac=$(macaddr_add "$lan_mac" 1)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary ART 0x0)" 1)
                ;;
        tplink,tdw8970|\
        tplink,tdw8980)
index d924b0053c99f28c3f8be1a4cb5e64c2b048fc78..dd1de6846d7303412b8b15ec7051fb6c45cb5b4a 100644 (file)
@@ -89,8 +89,7 @@ lantiq_setup_macs()
        bt,homehub-v3a|\
        netgear,dgn3500|\
        netgear,dgn3500b)
-               lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
-               wan_mac=$(macaddr_add "$lan_mac" 1)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1)
                ;;
        arcadyan,arv7506pw11)
                wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2)