mediatek: convert eeprom to nvmem format for livinet zr3020

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2024-09-16 18:28:53 +08:00
parent 44b441fab2
commit 8883319b00
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 40 additions and 59 deletions

View File

@ -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 = <MTK_PUPD_SET_R1R0_11>;
};
};
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";
};
};

View File

@ -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)