From 8883319b000df16c0dfdab8e2640ea77fa6f8fc1 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 16 Sep 2024 18:28:53 +0800 Subject: [PATCH] mediatek: convert eeprom to nvmem format for livinet zr3020 Signed-off-by: Tianling Shen --- .../mediatek/dts/mt7981b-livinet-zr-3020.dts | 94 ++++++++----------- .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 - 2 files changed, 40 insertions(+), 59 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-livinet-zr-3020.dts b/target/linux/mediatek/dts/mt7981b-livinet-zr-3020.dts index c160766572..f865590603 100644 --- a/target/linux/mediatek/dts/mt7981b-livinet-zr-3020.dts +++ b/target/linux/mediatek/dts/mt7981b-livinet-zr-3020.dts @@ -25,7 +25,7 @@ stdout-path = "serial0:115200n8"; }; - memory { + memory@40000000 { reg = <0 0x40000000 0 0x10000000>; }; @@ -146,7 +146,7 @@ partition@0 { label = "BL2"; - reg = <0x00000 0x100000>; + reg = <0x0 0x100000>; read-only; }; @@ -155,9 +155,20 @@ reg = <0x100000 0x80000>; }; - factory: partition@180000 { + partition@180000 { label = "Factory"; reg = <0x180000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + }; }; partition@380000 { @@ -185,12 +196,23 @@ reg = <0x6680000 0x100000>; read-only; - compatible = "nvmem-cells"; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; + macaddr_config_5060a: macaddr@5060a { + compatible = "mac-base"; + reg = <0x5060a 0x11>; + #nvmem-cell-cells = <1>; + }; + + macaddr_config_5068a: macaddr@5068a { + compatible = "mac-base"; + reg = <0x5068a 0x11>; + #nvmem-cell-cells = <1>; + }; + macaddr_config_50707: macaddr@50707 { compatible = "mac-base"; reg = <0x50707 0x11>; @@ -251,41 +273,6 @@ }; &pio { - i2c_pins: i2c-pins-g0 { - mux { - function = "i2c"; - groups = "i2c0_0"; - }; - }; - - pcm_pins: pcm-pins-g0 { - mux { - function = "pcm"; - groups = "pcm"; - }; - }; - - pwm0_pin: pwm0-pin-g0 { - mux { - function = "pwm"; - groups = "pwm0_0"; - }; - }; - - pwm1_pin: pwm1-pin-g0 { - mux { - function = "pwm"; - groups = "pwm1_0"; - }; - }; - - pwm2_pin: pwm2-pin { - mux { - function = "pwm"; - groups = "pwm2"; - }; - }; - spi0_flash_pins: spi0-pins { mux { function = "spi"; @@ -304,20 +291,6 @@ bias-pull-down = ; }; }; - - uart1_pins: uart1-pins-g1 { - mux { - function = "uart"; - groups = "uart1_1"; - }; - }; - - uart2_pins: uart2-pins-g1 { - mux { - function = "uart"; - groups = "uart2_1"; - }; - }; }; &uart0 { @@ -329,7 +302,20 @@ }; &wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; status = "okay"; - mediatek,mtd-eeprom = <&factory 0x0>; + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_config_5068a 0>; + nvmem-cell-names = "mac-address"; + + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_config_5060a 0>; + nvmem-cell-names = "mac-address"; + }; }; diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 05217f90b9..8159132522 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -112,11 +112,6 @@ case "$board" in jdcloud,re-cp-03) [ "$PHYNBR" = "1" ] && mmc_get_mac_binary factory 0xa > /sys${DEVPATH}/macaddress ;; - livinet,zr-3020|\ - livinet,zr-3020-ubootmod) - [ "$PHYNBR" = "0" ] && mtd_get_mac_ascii config2 wifi2gmac > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && mtd_get_mac_ascii config2 wifi5gmac > /sys${DEVPATH}/macaddress - ;; mercusys,mr90x-v1|\ tplink,re6000xd) addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0)