mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 06:33:41 +00:00
mediatek: use NVMEM framework on all Adtran devices
Use NVMEM framework to assign MAC addresses and WiFi EEPROM data on all Adtran SmartRG devices. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
b6d8297510
commit
3e6de5d77a
@ -14,8 +14,7 @@
|
||||
/ {
|
||||
aliases {
|
||||
serial0 = &uart0;
|
||||
ethernet0 = &gmac0;
|
||||
ethernet1 = &gmac1;
|
||||
label-mac-device = &gmac1;
|
||||
led-boot = &led_status_green;
|
||||
led-failsafe = &led_status_red;
|
||||
led-running = &led_status_white;
|
||||
@ -188,16 +187,17 @@
|
||||
gmac0: mac@0 {
|
||||
compatible = "mediatek,eth-mac";
|
||||
reg = <0>;
|
||||
|
||||
nvmem-cells = <&macaddr 1>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
phy-mode = "2500base-x";
|
||||
};
|
||||
|
||||
gmac1: mac@1 {
|
||||
label = "wan";
|
||||
|
||||
compatible = "mediatek,eth-mac";
|
||||
reg = <1>;
|
||||
|
||||
label = "wan";
|
||||
nvmem-cells = <&macaddr 0>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
phy-mode = "2500base-x";
|
||||
};
|
||||
|
||||
@ -254,6 +254,47 @@
|
||||
no-sd;
|
||||
no-sdio;
|
||||
status = "okay";
|
||||
|
||||
card@0 {
|
||||
compatible = "mmc-card";
|
||||
reg = <0>;
|
||||
|
||||
block {
|
||||
compatible = "block-device";
|
||||
|
||||
partitions {
|
||||
block-partition-factory {
|
||||
partname = "factory";
|
||||
|
||||
nvmem-layout {
|
||||
compatible = "fixed-layout";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
eeprom_factory_0: eeprom@0 {
|
||||
reg = <0x0 0x1000>;
|
||||
};
|
||||
|
||||
eeprom_factory_a0000: eeprom@a0000 {
|
||||
reg = <0xa0000 0x1000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
block-partition-mfginfo {
|
||||
partname = "mfginfo";
|
||||
|
||||
nvmem-layout {
|
||||
compatible = "adtran,mfginfo";
|
||||
|
||||
macaddr: mfg-mac {
|
||||
#nvmem-cell-cells = <1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&pcie {
|
||||
@ -266,6 +307,9 @@
|
||||
|
||||
radio0: mt7915@0,0 {
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
|
||||
nvmem-cells = <&eeprom_factory_a0000>, <&macaddr 4>;
|
||||
nvmem-cell-names = "eeprom", "mac-address";
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -275,9 +319,28 @@
|
||||
};
|
||||
|
||||
&wifi {
|
||||
status = "okay";
|
||||
nvmem-cells = <&eeprom_factory_0>;
|
||||
nvmem-cell-names = "eeprom";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&wf_2g_5g_pins>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
status = "okay";
|
||||
|
||||
band@0 {
|
||||
/* 2.4 GHz */
|
||||
reg = <0>;
|
||||
nvmem-cells = <&macaddr 2>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
band@1 {
|
||||
/* lower 5 GHz */
|
||||
reg = <1>;
|
||||
nvmem-cells = <&macaddr 3>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
};
|
||||
|
||||
&pio {
|
||||
|
@ -15,8 +15,7 @@
|
||||
/ {
|
||||
aliases {
|
||||
serial0 = &uart0;
|
||||
ethernet0 = &gmac0;
|
||||
ethernet1 = &gmac1;
|
||||
label-mac-device = &gmac1;
|
||||
led-boot = &led_sys_green;
|
||||
led-failsafe = &led_sys_blue;
|
||||
led-running = &led_sys_white;
|
||||
@ -250,21 +249,30 @@
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
nvmem-cells = <&macaddr 1>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gmac1 {
|
||||
nvmem-cells = <&macaddr 0>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
label = "wan";
|
||||
status = "okay";
|
||||
phy-mode = "usxgmii";
|
||||
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gmac2 {
|
||||
nvmem-cells = <&macaddr 1>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
label = "lan1";
|
||||
status = "okay";
|
||||
phy-mode = "usxgmii";
|
||||
phy-connection-type = "usxgmii";
|
||||
phy = <&phy8>;
|
||||
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gsw_phy0 {
|
||||
@ -513,6 +521,18 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
block-partition-mfginfo {
|
||||
partname = "mfginfo";
|
||||
|
||||
nvmem-layout {
|
||||
compatible = "adtran,mfginfo";
|
||||
|
||||
macaddr: mfg-mac {
|
||||
#nvmem-cell-cells = <1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -532,6 +552,27 @@
|
||||
nvmem-cells = <&eeprom_factory_0>;
|
||||
nvmem-cell-names = "eeprom";
|
||||
ieee80211-freq-limit = <2400000 2500000>, <5170000 5835000>, <5945000 7125000>;
|
||||
|
||||
band@0 {
|
||||
/* 2.4 GHz */
|
||||
reg = <0>;
|
||||
nvmem-cells = <&macaddr 4>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
band@1 {
|
||||
/* 5 GHz */
|
||||
reg = <1>;
|
||||
nvmem-cells = <&macaddr 10>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
band@2 {
|
||||
/* 6 GHz */
|
||||
reg = <2>;
|
||||
nvmem-cells = <&macaddr 6>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -62,6 +62,8 @@
|
||||
|
||||
&gmac1 {
|
||||
label = "lan";
|
||||
nvmem-cells = <&macaddr 1>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
phy-mode = "internal";
|
||||
phy-connection-type = "internal";
|
||||
phy = <&int_2p5g_phy>;
|
||||
@ -69,6 +71,8 @@
|
||||
|
||||
&gmac2 {
|
||||
label = "wan";
|
||||
nvmem-cells = <&macaddr 0>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
phy-mode = "usxgmii";
|
||||
phy-connection-type = "usxgmii";
|
||||
phy = <&phy8>;
|
||||
|
@ -162,16 +162,6 @@ mediatek_setup_macs()
|
||||
wan_mac=$label_mac
|
||||
lan_mac=$(macaddr_add "$label_mac" 1)
|
||||
;;
|
||||
smartrg,sdg-8612|\
|
||||
smartrg,sdg-8614|\
|
||||
smartrg,sdg-8622|\
|
||||
smartrg,sdg-8632|\
|
||||
smartrg,sdg-8733|\
|
||||
smartrg,sdg-8734)
|
||||
label_mac=$(mmc_get_mac_ascii mfginfo MFG_MAC)
|
||||
wan_mac=$label_mac
|
||||
lan_mac=$(macaddr_add "$label_mac" 1)
|
||||
;;
|
||||
xiaomi,mi-router-ax3000t|\
|
||||
xiaomi,mi-router-ax3000t-ubootmod|\
|
||||
xiaomi,mi-router-wr30u-stock|\
|
||||
|
@ -7,21 +7,6 @@
|
||||
board=$(board_name)
|
||||
|
||||
case "$FIRMWARE" in
|
||||
"mediatek/mt7915_eeprom.bin")
|
||||
case "$board" in
|
||||
smartrg,sdg-8622)
|
||||
caldata_extract_mmc "factory" 0xa0000 0x1000
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"mediatek/mt7916_eeprom.bin")
|
||||
case "$board" in
|
||||
acer,predator-w6|\
|
||||
smartrg,sdg-8632)
|
||||
caldata_extract_mmc "factory" 0xa0000 0x1000
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"mediatek/mt7981_eeprom_mt7976_dbdc.bin")
|
||||
case "$board" in
|
||||
ubnt,unifi-6-plus)
|
||||
@ -36,12 +21,6 @@ case "$FIRMWARE" in
|
||||
ln -sf /tmp/tp_data/MT7986_EEPROM.bin \
|
||||
/lib/firmware/$FIRMWARE
|
||||
;;
|
||||
smartrg,sdg-8612|\
|
||||
smartrg,sdg-8614|\
|
||||
smartrg,sdg-8622|\
|
||||
smartrg,sdg-8632)
|
||||
caldata_extract_mmc "factory" 0x0 0x1000
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"mediatek/mt7986_eeprom_mt7976.bin")
|
||||
|
@ -139,23 +139,6 @@ case "$board" in
|
||||
[ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
smartrg,sdg-8612|\
|
||||
smartrg,sdg-8614|\
|
||||
smartrg,sdg-8622|\
|
||||
smartrg,sdg-8632)
|
||||
addr=$(mmc_get_mac_ascii mfginfo MFG_MAC)
|
||||
[ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "2" ] && macaddr_add $addr 4 > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
smartrg,sdg-8733|\
|
||||
smartrg,sdg-8733a|\
|
||||
smartrg,sdg-8734)
|
||||
addr=$(mmc_get_mac_ascii mfginfo MFG_MAC)
|
||||
[ "$PHYNBR" = "0" ] && macaddr_add $addr 4 > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "1" ] && macaddr_add $addr a > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "2" ] && macaddr_add $addr 6 > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
tplink,tl-xdr4288|\
|
||||
tplink,tl-xdr6086|\
|
||||
tplink,tl-xdr6088)
|
||||
|
@ -22,26 +22,6 @@ preinit_set_mac_address() {
|
||||
addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0)
|
||||
ip link set dev eth1 address "$(macaddr_add $addr 1)"
|
||||
;;
|
||||
smartrg,sdg-8612|\
|
||||
smartrg,sdg-8614|\
|
||||
smartrg,sdg-8733|\
|
||||
smartrg,sdg-8734)
|
||||
addr=$(mmc_get_mac_ascii mfginfo MFG_MAC)
|
||||
lan_addr=$(macaddr_add $addr 1)
|
||||
ip link set dev wan address "$addr"
|
||||
ip link set dev eth0 address "$lan_addr"
|
||||
ip link set dev lan1 address "$lan_addr"
|
||||
ip link set dev lan2 address "$lan_addr"
|
||||
ip link set dev lan3 address "$lan_addr"
|
||||
ip link set dev lan4 address "$lan_addr"
|
||||
;;
|
||||
smartrg,sdg-8622|\
|
||||
smartrg,sdg-8632|\
|
||||
smartrg,sdg-8733a)
|
||||
addr=$(mmc_get_mac_ascii mfginfo MFG_MAC)
|
||||
ip link set dev wan address "$addr"
|
||||
ip link set dev lan address "$(macaddr_add $addr 1)"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user