ramips: fix mac for jdcloud re-sp-01b 128g emmc version

The MAC address offset in 128G version is 0x442a (+1 compared to 64g
version). As the mac stored in config partition is plain text format
so simply call mtd_get_mac_ascii to work on both version.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2024-11-13 23:13:17 +08:00
parent f32cd19e9d
commit c0c480daa7
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
3 changed files with 12 additions and 24 deletions

View File

@ -60,18 +60,10 @@
/delete-property/ interrupts;
};
&gmac0 {
nvmem-cells = <&macaddr_config_4429 0>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
status = "okay";
label = "wan";
phy-handle = <&ethphy0>;
nvmem-cells = <&macaddr_config_4429 0>;
nvmem-cell-names = "mac-address";
};
&sdhci {
@ -101,19 +93,6 @@
label = "config";
reg = <0x30000 0x10000>;
read-only;
compatible = "nvmem-cells";
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
macaddr_config_4429: macaddr@4429 {
compatible = "mac-base";
reg = <0x4429 0x11>;
#nvmem-cell-cells = <1>;
};
};
};
partition@40000 {
@ -121,7 +100,6 @@
reg = <0x40000 0x10000>;
read-only;
compatible = "nvmem-cells";
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
@ -187,8 +165,8 @@
&pcie1 {
wifi@0,0 {
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&eeprom_factory_8000>, <&macaddr_config_4429 0x800000>;
nvmem-cell-names = "eeprom", "mac-address";
nvmem-cells = <&eeprom_factory_8000>;
nvmem-cell-names = "eeprom";
ieee80211-freq-limit = <5000000 6000000>;
};
};

View File

@ -285,6 +285,11 @@ ramips_setup_macs()
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
wan_mac=$(macaddr_add "$lan_mac" 1)
;;
jdcloud,re-sp-01b)
lan_mac=$(mtd_get_mac_ascii config mac)
wan_mac=$lan_mac
label_mac=$lan_mac
;;
linksys,e5600|\
linksys,ea6350-v4|\
linksys,ea7300-v1|\

View File

@ -126,6 +126,11 @@ case "$board" in
[ "$PHYNBR" = "1" ] && \
macaddr_setbit_la "$(mtd_get_mac_binary Factory 0x4)" > /sys${DEVPATH}/macaddress
;;
jdcloud,re-sp-01b)
addr=$(mtd_get_mac_ascii config mac)
[ "$PHYNBR" = "0" ] && echo $addr > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $addr 0x800000 > /sys${DEVPATH}/macaddress
;;
keenetic,kn-3510)
[ "$PHYNBR" = "1" ] && \
macaddr_setbit_la "$(mtd_get_mac_binary rf-eeprom 0x4)" > /sys${DEVPATH}/macaddress