ipq40xx: Meraki MR33: convert MAC addresses to nvmem
authorLech Perczak <lech.perczak@gmail.com>
Wed, 15 Dec 2021 20:10:11 +0000 (21:10 +0100)
committerDavid Bauer <mail@david-bauer.net>
Sun, 2 Oct 2022 21:04:39 +0000 (23:04 +0200)
This fixes assigning random MAC to br-lan interface upon boot.
While at that, rename at24@50 node to eeprom@50, to align with upstream
device tree style.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh
target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-insect-common.dtsi

index f8d270a659252d4900a3b57acfaa81935832ac08..64215746d55ff4c4847081e587e625126cded124 100644 (file)
@@ -13,7 +13,6 @@ case "$FIRMWARE" in
        meraki,mr74)
                caldata_extract_ubi "ART" 0x9000 0x844
                caldata_valid "4408" || caldata_extract "ART" 0x9000 0x844
-               ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) 1)
                ;;
        esac
        ;;
@@ -117,7 +116,6 @@ case "$FIRMWARE" in
        meraki,mr74)
                caldata_extract_ubi "ART" 0x1000 0x2f20
                caldata_valid "202f" || caldata_extract "ART" 0x1000 0x2f20
-               ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) 2)
                ;;
        mikrotik,cap-ac |\
        mikrotik,hap-ac2 |\
@@ -214,7 +212,6 @@ case "$FIRMWARE" in
        meraki,mr74)
                caldata_extract_ubi "ART" 0x5000 0x2f20
                caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20
-               ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) 3)
                ;;
        mikrotik,cap-ac |\
        mikrotik,hap-ac2 |\
index 3c247ae6aa184e1bc6ddee49ea7e07f05026b3cc..18c24e0511593656397da7b168085ba9d94ba55d 100644 (file)
@@ -24,11 +24,6 @@ preinit_set_mac_address() {
                ip link set dev lan1 address $(macaddr_add "$base_mac" 1)
                ip link set dev eth0 address $(macaddr_setbit "$base_mac" 7)
                ;;
-       meraki,mr33|\
-       meraki,mr74)
-               mac_lan=$(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66)
-               [ -n "$mac_lan" ] && ip link set dev eth0 address "$mac_lan"
-               ;;
        mikrotik,wap-ac)
                base_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base)
                ip link set dev eth0 address "$base_mac"
index bc385d330e4841891f36feef64f108b8d3325ddc..ebfab171f51cc4e39879a8a88dcbbb62a491cca6 100644 (file)
        pinctrl-0 = <&i2c_0_pins>;
        pinctrl-names = "default";
        status = "okay";
-       at24@50 {
+
+       eeprom@50 {
                compatible = "atmel,24c64";
                pagesize = <32>;
                reg = <0x50>;
                read-only; /* This holds our MAC & Meraki board-data */
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               mac_address: mac-address@66 {
+                       reg = <0x66 0x6>;
+               };
        };
 };
 
                        compatible = "qcom,ath10k";
                        status = "okay";
                        reg = <0x00010000 0 0 0 0>;
+                       nvmem-cells = <&mac_address>;
+                       nvmem-cell-names = "mac-address";
+                       mac-address-increment = <1>;
                };
        };
 };
 &wifi0 {
        status = "okay";
        qcom,ath10k-calibration-variant = "Meraki-MR33";
+       nvmem-cells = <&mac_address>;
+       nvmem-cell-names = "mac-address";
+       mac-address-increment = <2>;
 };
 
 &wifi1 {
        status = "okay";
        qcom,ath10k-calibration-variant = "Meraki-MR33";
+       nvmem-cells = <&mac_address>;
+       nvmem-cell-names = "mac-address";
+       mac-address-increment = <3>;
 };
 
 &gmac {
        status = "okay";
+       nvmem-cells = <&mac_address>;
+       nvmem-cell-names = "mac-address";
 };
 
 &switch {