/ {
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;
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";
};
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 {
radio0: mt7915@0,0 {
reg = <0x0000 0 0 0 0>;
+
+ nvmem-cells = <&eeprom_factory_a0000>, <&macaddr 4>;
+ nvmem-cell-names = "eeprom", "mac-address";
};
};
};
};
&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 {
/ {
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;
};
&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 {
};
};
};
+
+ block-partition-mfginfo {
+ partname = "mfginfo";
+
+ nvmem-layout {
+ compatible = "adtran,mfginfo";
+
+ macaddr: mfg-mac {
+ #nvmem-cell-cells = <1>;
+ };
+ };
+ };
};
};
};
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";
+ };
};
};
};
&gmac1 {
label = "lan";
+ nvmem-cells = <&macaddr 1>;
+ nvmem-cell-names = "mac-address";
phy-mode = "internal";
phy-connection-type = "internal";
phy = <&int_2p5g_phy>;
&gmac2 {
label = "wan";
+ nvmem-cells = <&macaddr 0>;
+ nvmem-cell-names = "mac-address";
phy-mode = "usxgmii";
phy-connection-type = "usxgmii";
phy = <&phy8>;
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|\
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)
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")
[ "$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)
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