ath79: ja76pf2: use nvmem cells to specify MAC addresses
authorTomasz Maciej Nowak <tmn505@gmail.com>
Mon, 4 Jul 2022 12:23:05 +0000 (14:23 +0200)
committerChristian Lamparter <chunkeey@gmail.com>
Fri, 15 Jul 2022 13:22:08 +0000 (15:22 +0200)
The bootloader on this board hid the partition containig MAC addresses
and prevented adding this space to FIS directory, therefore those had to
be stored in RedBoot configuration as aliases to be able to assigne them
to proper interfaces. Now that fixed partition size are used instead of
redboot-fis parser, the partition containig MAC addresses could be
specified, and with marking it as nvmem cell, we can assign them without
userspace involvement.

Signed-off-by: Tomasz Maciej Nowak <tmn505@gmail.com>
(cherry picked from commit b52719b71a3337e5ae840c7a50fe41ebdc070f4e)

target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts
target/linux/ath79/generic/base-files/etc/board.d/02_network

index 7a8e2faa538f27c771d31b0daa6ced87444da21c..3d2ef9b5ee947dd0ade591358a3e8e62e87bf861 100644 (file)
 &eth0 {
        status = "okay";
 
+       nvmem-cells = <&macaddr_lan>;
+       nvmem-cell-names = "mac-address";
        phy-handle = <&phy0>;
 };
 
 &eth1 {
        status = "okay";
 
+       nvmem-cells = <&macaddr_wan>;
+       nvmem-cell-names = "mac-address";
        phy-handle = <&phy4>;
 };
 
                                label = "Atheros Board Data";
                                reg = <0xff0000 0x10000>;
                                read-only;
+                               compatible = "nvmem-cells";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               macaddr_wan: macaddr@1000 {
+                                       reg = <0x1000 0x6>;
+                               };
+
+                               macaddr_lan: macaddr@1006 {
+                                       reg = <0x1006 0x6>;
+                               };
                        };
                };
        };
index 258b0814424da39e9083b529cb154c5340c5bc0b..e7de69ba18c10a88902b277ac23bfdcc2987f931 100644 (file)
@@ -659,10 +659,6 @@ ath79_setup_macs()
                wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
                label_mac=$wan_mac
                ;;
-       jjplus,ja76pf2)
-               wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n alias/ethaddr)
-               lan_mac=$(macaddr_add "$wan_mac" 1)
-               ;;
        mercury,mw4530r-v1|\
        tplink,tl-wdr3600-v1|\
        tplink,tl-wdr4300-v1|\