compatible = "cmcc,rax3000m", "mediatek,mt7981";
fragment@0 {
+ target = <&gmac0>;
+ __overlay__ {
+ nvmem-cells = <&macaddr_factory_2a 0>;
+ nvmem-cell-names = "mac-address";
+ };
+ };
+
+ fragment@1 {
+ target = <&gmac1>;
+ __overlay__ {
+ nvmem-cells = <&macaddr_factory_24 0>;
+ nvmem-cell-names = "mac-address";
+ };
+ };
+
+ fragment@2 {
target = <&mmc0>;
__overlay__ {
bus-width = <8>;
pinctrl-1 = <&mmc0_pins_uhs>;
vmmc-supply = <®_3p3v>;
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>;
+ };
+
+ macaddr_factory_24: macaddr@24 {
+ compatible = "mac-base";
+ reg = <0x24 0x6>;
+ #nvmem-cell-cells = <1>;
+ };
+
+ macaddr_factory_2a: macaddr@2a {
+ compatible = "mac-base";
+ reg = <0x2a 0x6>;
+ #nvmem-cell-cells = <1>;
+ };
+ };
+ };
+ };
+ };
+ };
};
};
- fragment@1 {
+ fragment@3 {
target = <&pio>;
__overlay__ {
mmc0_pins_default: mmc0-pins {
};
};
};
+
+ fragment@4 {
+ target = <&wifi>;
+ __overlay__ {
+ nvmem-cells = <&eeprom_factory_0>;
+ nvmem-cell-names = "eeprom";
+ };
+ };
};
reg = <0x100000 0x80000>;
};
- factory: partition@180000 {
+ partition@180000 {
label = "factory";
reg = <0x180000 0x200000>;
read-only;
#address-cells = <1>;
#size-cells = <1>;
+ eeprom_factory_0: eeprom@0 {
+ reg = <0x0 0x1000>;
+ };
+
macaddr_factory_24: macaddr@24 {
compatible = "mac-base";
reg = <0x24 0x6>;
fragment@4 {
target = <&wifi>;
__overlay__ {
- mediatek,mtd-eeprom = <&factory 0x0>;
+ nvmem-cells = <&eeprom_factory_0>;
+ nvmem-cell-names = "eeprom";
};
};
};
bananapi,bpi-r4)
wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1)
;;
- cmcc,rax3000m)
- case "$(cmdline_get_var root)" in
- /dev/mmc*)
- wan_mac=$(mmc_get_mac_binary factory 0x2a)
- lan_mac=$(mmc_get_mac_binary factory 0x24)
- label_mac=$wan_mac
- ;;
- esac
- ;;
h3c,magic-nx30-pro)
wan_mac=$(mtd_get_mac_ascii pdt_data_1 ethaddr)
lan_mac=$(macaddr_add "$wan_mac" 1)
[ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 2) > /sys${DEVPATH}/macaddress
;;
cmcc,rax3000m)
- case "$(cmdline_get_var root)" in
- /dev/mmc*)
- addr=$(mmc_get_mac_binary factory 0xa)
- ;;
- *)
- addr=$(mtd_get_mac_binary factory 0xa)
- ;;
- esac
- [ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress
+ addr=$(cat /sys/class/net/eth0/address)
+ [ "$PHYNBR" = "1" ] && macaddr_add $addr -1 > /sys${DEVPATH}/macaddress
;;
comfast,cf-e393ax)
addr=$(mtd_get_mac_binary "Factory" 0x8000)