From 64b80093dd3d318be93b73de87a882aa5223ff8a Mon Sep 17 00:00:00 2001 From: aiamadeus <2789289348@qq.com> Date: Tue, 16 Jul 2024 23:25:10 +0800 Subject: [PATCH] mediatek: replace mac-address-increment hack --- .../dts/mt7622-buffalo-wsr-2533dhp2.dts | 17 +++++---- .../dts/mt7622-elecom-wrc-x3200gst3.dts | 29 ++++++++------- .../dts/mt7622-xiaomi-redmi-router-ax6s.dts | 17 +++++---- .../mediatek/dts/mt7981b-abt-asr3000.dts | 25 +++++++------ .../mediatek/dts/mt7981b-cetron-ct3003.dts | 20 ++++++----- .../mediatek/dts/mt7981b-glinet-gl-mt3000.dts | 35 +++++++++++-------- .../mediatek/dts/mt7981b-nokia-ea0326gmp.dts | 22 ++++++------ .../mediatek/dts/mt7981b-xiaomi-ax3000t.dts | 16 +-------- .../mediatek/dts/mt7981b-xiaomi-wr30u.dts | 10 +----- .../dts/mt7981b-xiaomi_mi-router.dtsi | 19 +++++++--- .../dts/mt7986a-tplink-tl-xdr-common.dtsi | 25 +++++++------ .../dts/mt7986a-tplink-tl-xtr8488.dts | 18 ++++++---- .../mt7986a-xiaomi-redmi-router-ax6000.dts | 17 +++++---- 13 files changed, 146 insertions(+), 124 deletions(-) diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts index 6d77be532..9783c5a83 100644 --- a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts @@ -218,9 +218,8 @@ phy-connection-type = "2500base-x"; - nvmem-cells = <&macaddr_factory_4>; + nvmem-cells = <&macaddr_factory_4 (-1)>; nvmem-cell-names = "mac-address"; - mac-address-increment = <(-1)>; fixed-link { speed = <2500>; @@ -340,11 +339,15 @@ }; &factory { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; - macaddr_factory_4: macaddr@4 { - reg = <0x4 0x6>; + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; }; }; diff --git a/target/linux/mediatek/dts/mt7622-elecom-wrc-x3200gst3.dts b/target/linux/mediatek/dts/mt7622-elecom-wrc-x3200gst3.dts index fdbcbc18b..2cc8db532 100644 --- a/target/linux/mediatek/dts/mt7622-elecom-wrc-x3200gst3.dts +++ b/target/linux/mediatek/dts/mt7622-elecom-wrc-x3200gst3.dts @@ -327,20 +327,24 @@ reg = <0x1c0000 0x100000>; read-only; - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; - macaddr_factory_4: macaddr@4 { - reg = <0x4 0x6>; - }; + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; - macaddr_factory_7fff4: macaddr@7fff4 { - reg = <0x7fff4 0x6>; - }; + macaddr_factory_7fff4: macaddr@7fff4 { + reg = <0x7fff4 0x6>; + }; - macaddr_factory_7fffa: macaddr@7fffa { - reg = <0x7fffa 0x6>; + macaddr_factory_7fffa: macaddr@7fffa { + reg = <0x7fffa 0x6>; + }; }; }; @@ -395,9 +399,8 @@ reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x5000>; ieee80211-freq-limit = <5000000 6000000>; - nvmem-cells = <&macaddr_factory_4>; + nvmem-cells = <&macaddr_factory_4 1>; nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; }; }; diff --git a/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts b/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts index 9661d0c7f..fccf8348c 100644 --- a/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts +++ b/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts @@ -146,9 +146,8 @@ phy-connection-type = "2500base-x"; - nvmem-cells = <&macaddr_factory_4>; + nvmem-cells = <&macaddr_factory_4 (-1)>; nvmem-cell-names = "mac-address"; - mac-address-increment = <(-1)>; fixed-link { speed = <2500>; @@ -269,12 +268,16 @@ reg = <0x1c0000 0x80000>; read-only; - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; - macaddr_factory_4: macaddr@4 { - reg = <0x4 0x6>; + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; }; }; diff --git a/target/linux/mediatek/dts/mt7981b-abt-asr3000.dts b/target/linux/mediatek/dts/mt7981b-abt-asr3000.dts index b089f3d27..d8aad5b8e 100644 --- a/target/linux/mediatek/dts/mt7981b-abt-asr3000.dts +++ b/target/linux/mediatek/dts/mt7981b-abt-asr3000.dts @@ -64,7 +64,7 @@ reg = <0>; phy-mode = "2500base-x"; - nvmem-cells = <&macaddr_art_0>; + nvmem-cells = <&macaddr_art_0 0>; nvmem-cell-names = "mac-address"; fixed-link { @@ -80,9 +80,8 @@ phy-mode = "gmii"; phy-handle = <&int_gbe_phy>; - nvmem-cells = <&macaddr_art_0>; + nvmem-cells = <&macaddr_art_0 0x500000>; nvmem-cell-names = "mac-address"; - mac-address-increment = <0x500000>; }; }; @@ -138,16 +137,20 @@ reg = <0x0180000 0x0100000>; read-only; - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; - }; + macaddr_art_0: macaddr@0 { + compatible = "mac-base"; + reg = <0x0 0x6>; + #nvmem-cell-cells = <1>; + }; - macaddr_art_6: macaddr@6 { - reg = <0x6 0x6>; + macaddr_art_6: macaddr@6 { + reg = <0x6 0x6>; + }; }; }; diff --git a/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts b/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts index ee77b3768..7bf892eb5 100644 --- a/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts +++ b/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts @@ -12,6 +12,7 @@ aliases { serial0 = &uart0; + label-mac-device = &gmac0; led-boot = &led_status_red; led-failsafe = &led_status_red; led-running = &led_status_green; @@ -65,7 +66,7 @@ reg = <0>; phy-mode = "2500base-x"; - nvmem-cells = <&macaddr_art_0>; + nvmem-cells = <&macaddr_art_0 0>; nvmem-cell-names = "mac-address"; fixed-link { @@ -128,12 +129,16 @@ reg = <0x0180000 0x0100000>; read-only; - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; + macaddr_art_0: macaddr@0 { + compatible = "mac-base"; + reg = <0x0 0x6>; + #nvmem-cell-cells = <1>; + }; }; }; @@ -190,9 +195,8 @@ port@3 { reg = <3>; label = "wan"; - nvmem-cells = <&macaddr_art_0>; + nvmem-cells = <&macaddr_art_0 3>; nvmem-cell-names = "mac-address"; - mac-address-increment = <3>; }; port@6 { diff --git a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts index bc0016684..cf7ad702a 100644 --- a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts +++ b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts @@ -7,10 +7,11 @@ compatible = "glinet,gl-mt3000", "mediatek,mt7981"; aliases { - led-boot = &led_run; - led-failsafe = &led_run; + label-mac-device = &gmac0; + led-boot = &led_lightblue; + led-failsafe = &led_white; led-running = &led_white; - led-upgrade = &led_run; + led-upgrade = &led_lightblue; serial0 = &uart0; }; @@ -39,7 +40,7 @@ leds { compatible = "gpio-leds"; - led_run: run { + led_lightblue: light { label = "blue:run"; gpios = <&pio 31 GPIO_ACTIVE_LOW>; }; @@ -55,7 +56,7 @@ regulator-name = "fan"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&pio 28 GPIO_ACTIVE_HIGH>; + gpios = <&pio 28 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-boot-on; }; @@ -65,7 +66,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&pio 12 GPIO_ACTIVE_HIGH>; + gpios = <&pio 12 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-boot-on; }; @@ -90,7 +91,7 @@ reg = <0>; phy-mode = "2500base-x"; phy-handle = <&phy0>; - nvmem-cells = <&macaddr>; + nvmem-cells = <&macaddr 0>; nvmem-cell-names = "mac-address"; }; @@ -99,9 +100,8 @@ reg = <1>; phy-mode = "gmii"; phy-handle = <&int_gbe_phy>; - nvmem-cells = <&macaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; }; }; @@ -176,18 +176,25 @@ factory: partition@180000 { label = "Factory"; reg = <0x180000 0x0200000>; - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + read-only; - macaddr: macaddr@a { - reg = <0xa 0x6>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr: macaddr@a { + compatible = "mac-base"; + reg = <0xa 0x6>; + #nvmem-cell-cells = <1>; + }; }; }; partition@380000 { label = "FIP"; reg = <0x380000 0x0200000>; + read-only; }; partition@580000 { diff --git a/target/linux/mediatek/dts/mt7981b-nokia-ea0326gmp.dts b/target/linux/mediatek/dts/mt7981b-nokia-ea0326gmp.dts index bab81b1da..754be2ae9 100644 --- a/target/linux/mediatek/dts/mt7981b-nokia-ea0326gmp.dts +++ b/target/linux/mediatek/dts/mt7981b-nokia-ea0326gmp.dts @@ -88,7 +88,7 @@ reg = <0>; phy-mode = "2500base-x"; - nvmem-cells = <&macaddr_factory_28>; + nvmem-cells = <&macaddr_factory_28 0>; nvmem-cell-names = "mac-address"; fixed-link { @@ -104,9 +104,8 @@ phy-mode = "gmii"; phy-handle = <&int_gbe_phy>; - nvmem-cells = <&macaddr_factory_28>; + nvmem-cells = <&macaddr_factory_28 3>; nvmem-cell-names = "mac-address"; - mac-address-increment = <3>; }; }; @@ -269,17 +268,20 @@ status = "okay"; mediatek,mtd-eeprom = <&factory 0x0>; - nvmem-cells = <&macaddr_factory_28>; + nvmem-cells = <&macaddr_factory_28 1>; nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; }; &factory { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; - macaddr_factory_28: macaddr@28 { - reg = <0x28 0x6>; + macaddr_factory_28: macaddr@28 { + compatible = "mac-base"; + reg = <0x28 0x6>; + #nvmem-cell-cells = <1>; + }; }; }; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-ax3000t.dts b/target/linux/mediatek/dts/mt7981b-xiaomi-ax3000t.dts index 96f7680ef..5709dc481 100644 --- a/target/linux/mediatek/dts/mt7981b-xiaomi-ax3000t.dts +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-ax3000t.dts @@ -10,9 +10,8 @@ }; &gmac0 { - nvmem-cells = <&macaddr_factory_4>; nvmem-cell-names = "mac-address"; - mac-address-increment = <(-2)>; + nvmem-cells = <&macaddr_factory_4 (-2)>; }; &i2c0 { @@ -26,19 +25,6 @@ }; }; -&partitions { - partition@600000 { - label = "ubi"; - reg = <0x0600000 0x6400000>; - }; - - partition@6a00000 { - label = "data"; - reg = <0x6a00000 0x0c00000>; - read-only; - }; -}; - &pio { i2c_pins: i2c-pins { mux { diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-wr30u.dts b/target/linux/mediatek/dts/mt7981b-xiaomi-wr30u.dts index f1cfcf1a3..9195ef7a1 100644 --- a/target/linux/mediatek/dts/mt7981b-xiaomi-wr30u.dts +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-wr30u.dts @@ -10,9 +10,8 @@ }; &gmac0 { - nvmem-cells = <&macaddr_factory_4>; nvmem-cell-names = "mac-address"; - mac-address-increment = <(-1)>; + nvmem-cells = <&macaddr_factory_4 (-1)>; }; &leds { @@ -26,10 +25,3 @@ gpios = <&pio 12 GPIO_ACTIVE_LOW>; }; }; - -&partitions { - partition@600000 { - label = "ubi"; - reg = <0x600000 0x7000000>; - }; -}; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi_mi-router.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi_mi-router.dtsi index bb97b5588..3155cb250 100644 --- a/target/linux/mediatek/dts/mt7981b-xiaomi_mi-router.dtsi +++ b/target/linux/mediatek/dts/mt7981b-xiaomi_mi-router.dtsi @@ -129,12 +129,16 @@ reg = <0x0180000 0x0200000>; read-only; - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; - macaddr_factory_4: macaddr@4 { - reg = <0x4 0x6>; + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; }; }; @@ -156,6 +160,11 @@ read-only; }; + partition@600000 { + label = "ubi"; + reg = <0x0600000 0x7000000>; + }; + partition@7600000 { label = "KF"; reg = <0x7600000 0x0040000>; diff --git a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi index 65d0eb51b..b7f29561c 100644 --- a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi +++ b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi @@ -95,7 +95,7 @@ reg = <0>; phy-mode = "2500base-x"; - nvmem-cells = <&macaddr_config_1c>; + nvmem-cells = <&macaddr_config_1c 0>; nvmem-cell-names = "mac-address"; fixed-link { @@ -111,9 +111,8 @@ phy-handle = <&phy7>; phy-mode = "2500base-x"; - nvmem-cells = <&macaddr_config_1c>; + nvmem-cells = <&macaddr_config_1c 1>; nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; }; mdio: mdio-bus { @@ -201,13 +200,13 @@ partition@380000 { label = "fip"; - reg = <0x380000 0x0180000>; + reg = <0x380000 0x0200000>; read-only; }; - partition@500000 { + partition@580000 { label = "ubi"; - reg = <0x500000 0x7300000>; + reg = <0x580000 0x7800000>; }; }; }; @@ -262,11 +261,15 @@ }; &config { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; - macaddr_config_1c: macaddr@1c { - reg = <0x1c 0x6>; + macaddr_config_1c: macaddr@1c { + compatible = "mac-base"; + reg = <0x1c 0x6>; + #nvmem-cell-cells = <1>; + }; }; }; diff --git a/target/linux/mediatek/dts/mt7986a-tplink-tl-xtr8488.dts b/target/linux/mediatek/dts/mt7986a-tplink-tl-xtr8488.dts index 7bfcecdfd..311bfd61c 100644 --- a/target/linux/mediatek/dts/mt7986a-tplink-tl-xtr8488.dts +++ b/target/linux/mediatek/dts/mt7986a-tplink-tl-xtr8488.dts @@ -175,9 +175,8 @@ mediatek,mtd-eeprom = <&factory 0x1000>; ieee80211-freq-limit = <5470000 5875000>; - nvmem-cells = <&macaddr_config_1c>; + nvmem-cells = <&macaddr_config_1c 3>; nvmem-cell-names = "mac-address"; - mac-address-increment = <3>; }; }; }; @@ -215,14 +214,19 @@ &wifi { pinctrl-names = "default"; pinctrl-0 = <&wf_2g_5g_pins>; + ieee80211-freq-limit = <2400000 2500000>, <5170000 5350000>; }; &config { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; - macaddr_config_1c: macaddr@1c { - reg = <0x1c 0x6>; + macaddr_config_1c: macaddr@1c { + compatible = "mac-base"; + reg = <0x1c 0x6>; + #nvmem-cell-cells = <1>; + }; }; }; diff --git a/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dts b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dts index f3f05474e..295acfd11 100644 --- a/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dts +++ b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dts @@ -57,9 +57,8 @@ reg = <0>; phy-mode = "2500base-x"; - nvmem-cells = <&macaddr_factory_4>; + nvmem-cells = <&macaddr_factory_4 (-1)>; nvmem-cell-names = "mac-address"; - mac-address-increment = <(-1)>; fixed-link { speed = <2500>; @@ -177,12 +176,16 @@ reg = <0x180000 0x200000>; read-only; - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; - macaddr_factory_4: macaddr@4 { - reg = <0x4 0x6>; + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; }; };