From eed995d4f934943fb98bb51044dad1f8dd5bba8f Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 3 Sep 2024 17:07:49 -0700 Subject: [PATCH] lantiq: more conversions to nvmem Now that NVMEM in UBI is supported, more handling can be moved. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16376 Signed-off-by: Hauke Mehrtens --- .../ase/base-files/etc/board.d/02_network | 3 +-- target/linux/lantiq/config-6.12 | 1 + .../dts/lantiq/amazonse_allnet_all0333cj.dts | 11 +++++++++++ .../dts/lantiq/danube_arcadyan_arv4510pw.dts | 16 ++++++++++++++++ .../boot/dts/lantiq/danube_bt_homehub-v2b.dts | 19 +++++++++++++++++++ .../dts/lantiq/vr9_alphanetworks_asl56026.dts | 13 +++++++++++++ .../boot/dts/lantiq/vr9_arcadyan_vg3503j.dts | 10 ++++++++++ .../boot/dts/lantiq/vr9_bt_homehub-v5a.dts | 2 +- .../dts/lantiq/vr9_buffalo_wbmr-300hpd.dts | 18 ++++++++++++++++++ .../dts/lantiq/vr9_lantiq_easy80920-nand.dts | 8 ++++++++ .../dts/lantiq/vr9_lantiq_easy80920-nor.dts | 8 ++++++++ .../boot/dts/lantiq/vr9_lantiq_easy80920.dtsi | 7 +++++++ .../dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts | 8 ++++++++ .../dts/lantiq/vr9_zyxel_p-2812hnu-f3.dts | 8 ++++++++ .../dts/lantiq/vr9_zyxel_p-2812hnu-fx.dtsi | 4 ++++ .../xrx200/base-files/etc/board.d/02_network | 6 ++---- .../base-files/etc/board.d/02_network | 7 ++----- .../xway/base-files/etc/board.d/02_network | 3 +-- 18 files changed, 138 insertions(+), 14 deletions(-) diff --git a/target/linux/lantiq/ase/base-files/etc/board.d/02_network b/target/linux/lantiq/ase/base-files/etc/board.d/02_network index a088c62aa0..afb1bfacf0 100644 --- a/target/linux/lantiq/ase/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/ase/base-files/etc/board.d/02_network @@ -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 diff --git a/target/linux/lantiq/config-6.12 b/target/linux/lantiq/config-6.12 index cd58233f35..19d5dc0da1 100644 --- a/target/linux/lantiq/config-6.12 +++ b/target/linux/lantiq/config-6.12 @@ -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 diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/amazonse_allnet_all0333cj.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/amazonse_allnet_all0333cj.dts index e543ab29aa..89fee57a56 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/amazonse_allnet_all0333cj.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/amazonse_allnet_all0333cj.dts @@ -73,6 +73,9 @@ &gsw { phy-mode = "mii"; + + nvmem-cells = <&macaddr_uboot_ethaddr 0>; + nvmem-cell-names = "mac-address"; }; &localbus { @@ -101,6 +104,14 @@ 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 { diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube_arcadyan_arv4510pw.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube_arcadyan_arv4510pw.dts index 13ce8423ef..94fc80b54e 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube_arcadyan_arv4510pw.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube_arcadyan_arv4510pw.dts @@ -154,6 +154,14 @@ &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 { @@ -179,6 +187,14 @@ 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 { diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube_bt_homehub-v2b.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube_bt_homehub-v2b.dts index 1811c7f587..3304a4c37a 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube_bt_homehub-v2b.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube_bt_homehub-v2b.dts @@ -136,6 +136,14 @@ &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 { @@ -158,6 +166,14 @@ 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 { @@ -225,6 +241,9 @@ 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"; }; }; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_alphanetworks_asl56026.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_alphanetworks_asl56026.dts index 59e32dc5ea..1685a9fe17 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_alphanetworks_asl56026.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_alphanetworks_asl56026.dts @@ -71,6 +71,11 @@ }; }; +ð0 { + nvmem-cells = <&macaddr_uboot_ethaddr 0>; + nvmem-cell-names = "mac-address"; +}; + &gphy0 { lantiq,gphy-mode = ; }; @@ -124,6 +129,14 @@ 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 { diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_arcadyan_vg3503j.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_arcadyan_vg3503j.dts index 5c5f533dbc..4a67380158 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_arcadyan_vg3503j.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_arcadyan_vg3503j.dts @@ -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 { @@ -157,6 +159,14 @@ partition@7f0000 { label = "u-boot-env"; reg = <0x7f0000 0x10000>; + + nvmem-layout { + compatible = "u-boot,env"; + + macaddr_uboot_ethaddr: ethaddr { + #nvmem-cell-cells = <1>; + }; + }; }; }; }; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts index 30adbc6e6f..2d31e40f42 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts @@ -227,7 +227,7 @@ }; &ppe { - nvmem-cells = <&macaddr_caldata_110c 5>; + nvmem-cells = <&macaddr_caldata_110c 4>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_buffalo_wbmr-300hpd.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_buffalo_wbmr-300hpd.dts index 6a23794c7b..d3f6cfa209 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_buffalo_wbmr-300hpd.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_buffalo_wbmr-300hpd.dts @@ -155,6 +155,16 @@ }; }; +ð0 { + 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 = ; }; @@ -267,6 +277,14 @@ 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 { diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920-nand.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920-nand.dts index 82f72022c9..69dea689af 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920-nand.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920-nand.dts @@ -34,6 +34,14 @@ 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 { diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920-nor.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920-nor.dts index b0977b35c5..8ad7539f22 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920-nor.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920-nor.dts @@ -24,6 +24,14 @@ 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 { diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920.dtsi index f477ad8db2..4d685bee66 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920.dtsi @@ -101,6 +101,11 @@ }; }; +ð0 { + nvmem-cells = <&macaddr_uboot_ethaddr 0>; + nvmem-cell-names = "mac-address"; +}; + &gphy0 { lantiq,gphy-mode = ; }; @@ -190,6 +195,8 @@ label = "wan"; phy-mode = "rgmii"; phy-handle = <&phy5>; + nvmem-cells = <&macaddr_uboot_ethaddr 1>; + nvmem-cell-names = "mac-address"; }; }; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts index e3bc666d41..74858ec118 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts @@ -44,6 +44,14 @@ 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"; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f3.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f3.dts index 59dcac5681..57284034d3 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f3.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f3.dts @@ -35,6 +35,14 @@ 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"; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-fx.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-fx.dtsi index 2b8dc285cb..9d4a4e7e92 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-fx.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-fx.dtsi @@ -157,6 +157,8 @@ <&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 { @@ -207,6 +209,8 @@ label = "wan"; phy-mode = "rgmii"; phy-handle = <&phy5>; + nvmem-cells = <&macaddr_uboot_ethaddr 1>; + nvmem-cell-names = "mac-address"; }; }; diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network index ca40c9cbd6..d6377140b3 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network @@ -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) diff --git a/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/02_network index 9088de86b1..edb2a04b33 100644 --- a/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/02_network @@ -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) diff --git a/target/linux/lantiq/xway/base-files/etc/board.d/02_network b/target/linux/lantiq/xway/base-files/etc/board.d/02_network index d924b0053c..dd1de6846d 100644 --- a/target/linux/lantiq/xway/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xway/base-files/etc/board.d/02_network @@ -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) -- 2.30.2