mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-30 18:47:06 +00:00
ramips: TP-Link EC330-G5u v1: switch to mac-address-ascii
The TP-Link EC330-G5u v1 router has MAC address that stored in factory mtd in ascii format. This commit makes the router use of "mac-address-ascii" in dts. After the change: 1. All MAC addresses are explicitly assigned in dts (the workarounds in network scripts are no longer needed); 2. gmac0 (eth0) MAC address is no longer random. Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
This commit is contained in:
parent
c31319b669
commit
15e21d373b
@ -11,6 +11,8 @@
|
|||||||
model = "TP-Link EC330-G5u v1";
|
model = "TP-Link EC330-G5u v1";
|
||||||
|
|
||||||
aliases {
|
aliases {
|
||||||
|
label-mac-device = &gmac0;
|
||||||
|
|
||||||
led-boot = &led_power;
|
led-boot = &led_power;
|
||||||
led-failsafe = &led_power;
|
led-failsafe = &led_power;
|
||||||
led-running = &led_power;
|
led-running = &led_power;
|
||||||
@ -226,6 +228,14 @@
|
|||||||
label = "factory";
|
label = "factory";
|
||||||
reg = <0x7800000 0x400000>;
|
reg = <0x7800000 0x400000>;
|
||||||
read-only;
|
read-only;
|
||||||
|
|
||||||
|
compatible = "nvmem-cells";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
macaddr_factory_165: macaddr@165 {
|
||||||
|
reg = <0x165 0x11>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
partition@0_wholeflash {
|
partition@0_wholeflash {
|
||||||
@ -246,6 +256,9 @@
|
|||||||
reg = <0x0000 0 0 0 0>;
|
reg = <0x0000 0 0 0 0>;
|
||||||
mediatek,mtd-eeprom = <&factory 0x8000>;
|
mediatek,mtd-eeprom = <&factory 0x8000>;
|
||||||
ieee80211-freq-limit = <2400000 2500000>;
|
ieee80211-freq-limit = <2400000 2500000>;
|
||||||
|
|
||||||
|
nvmem-cells = <&macaddr_factory_165>;
|
||||||
|
nvmem-cell-names = "mac-address-ascii";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -255,13 +268,26 @@
|
|||||||
reg = <0x0000 0 0 0 0>;
|
reg = <0x0000 0 0 0 0>;
|
||||||
mediatek,mtd-eeprom = <&factory 0x14000>;
|
mediatek,mtd-eeprom = <&factory 0x14000>;
|
||||||
ieee80211-freq-limit = <5000000 6000000>;
|
ieee80211-freq-limit = <5000000 6000000>;
|
||||||
|
|
||||||
|
nvmem-cells = <&macaddr_factory_165>;
|
||||||
|
nvmem-cell-names = "mac-address-ascii";
|
||||||
|
mac-address-increment = <(2)>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&gmac0 {
|
||||||
|
nvmem-cells = <&macaddr_factory_165>;
|
||||||
|
nvmem-cell-names = "mac-address-ascii";
|
||||||
|
};
|
||||||
|
|
||||||
&gmac1 {
|
&gmac1 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
label = "wan";
|
label = "wan";
|
||||||
phy-handle = <ðphy0>;
|
phy-handle = <ðphy0>;
|
||||||
|
|
||||||
|
nvmem-cells = <&macaddr_factory_165>;
|
||||||
|
nvmem-cell-names = "mac-address-ascii";
|
||||||
|
mac-address-increment = <(1)>;
|
||||||
};
|
};
|
||||||
|
|
||||||
&mdio {
|
&mdio {
|
||||||
|
@ -245,11 +245,6 @@ ramips_setup_macs()
|
|||||||
label_mac=$(cat "/sys/firmware/mikrotik/hard_config/mac_base")
|
label_mac=$(cat "/sys/firmware/mikrotik/hard_config/mac_base")
|
||||||
lan_mac=$label_mac
|
lan_mac=$label_mac
|
||||||
;;
|
;;
|
||||||
tplink,ec330-g5u-v1)
|
|
||||||
label_mac="$(mtd_get_mac_text factory 0x165)"
|
|
||||||
lan_mac=$label_mac
|
|
||||||
wan_mac=$(macaddr_add $label_mac 1)
|
|
||||||
;;
|
|
||||||
tplink,er605-v2)
|
tplink,er605-v2)
|
||||||
CI_UBIPART="firmware"
|
CI_UBIPART="firmware"
|
||||||
label_mac=$(mtd_get_mac_uci_config_ubi "tddp")
|
label_mac=$(mtd_get_mac_uci_config_ubi "tddp")
|
||||||
|
@ -161,11 +161,6 @@ case "$board" in
|
|||||||
hw_mac_addr="$(mtd_get_mac_binary product-info 0x8)"
|
hw_mac_addr="$(mtd_get_mac_binary product-info 0x8)"
|
||||||
macaddr_add "$hw_mac_addr" "$PHYNBR" > "/sys${DEVPATH}/macaddress"
|
macaddr_add "$hw_mac_addr" "$PHYNBR" > "/sys${DEVPATH}/macaddress"
|
||||||
;;
|
;;
|
||||||
tplink,ec330-g5u-v1)
|
|
||||||
hw_mac_addr="$(mtd_get_mac_text factory 0x165)"
|
|
||||||
[ "$PHYNBR" = "0" ] && echo -n $hw_mac_addr > /sys${DEVPATH}/macaddress
|
|
||||||
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
|
|
||||||
;;
|
|
||||||
yuncore,ax820)
|
yuncore,ax820)
|
||||||
[ "$PHYNBR" = "1" ] && \
|
[ "$PHYNBR" = "1" ] && \
|
||||||
macaddr_setbit_la "$(mtd_get_mac_binary Factory 0xe000)" > /sys${DEVPATH}/macaddress
|
macaddr_setbit_la "$(mtd_get_mac_binary Factory 0xe000)" > /sys${DEVPATH}/macaddress
|
||||||
|
Loading…
Reference in New Issue
Block a user