ath79: use "fixed-layout" for Embedded Wireless devices
authorRafał Miłecki <rafal@milecki.pl>
Fri, 10 Nov 2023 10:25:05 +0000 (11:25 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Wed, 15 Nov 2023 06:14:32 +0000 (07:14 +0100)
Those devices have Ethernet interfaces using base MAC address increased
by 0x40 in the 3rd indexed byte (00:00:00:FF:00:00). To describe that we
were using a custom (downstream) "mac-address-increment-byte" property.

The same result can be achieved by using "mac-base" with a properly
adjusted offset value (0x40 << 16). It may be not pretty but it should
work without custom property or downstream kernel patch to support it.

Cc: Ansuel Smith <ansuelsmth@gmail.com>
Cc: Catrinel Catrinescu <cc@80211.de>
Cc: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Rosen Penev <rosenp@gmail.com>
target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts

index de6b709b5cb65a09d12a4b1f934eae9b76d324ae..6286f203efc2aee5bf3e34b4e9b53f33d2870897 100644 (file)
                                label = "art";
                                reg = <0xff0000 0x010000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       macaddr_art_1002: macaddr@1002 {
+                                               compatible = "mac-base";
+                                               reg = <0x1002 0x6>;
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
                };
        };
 &eth1 {
        status = "okay";
 
-       nvmem-cells = <&macaddr_art_1002>;
+       nvmem-cells = <&macaddr_art_1002 0x400000>;
        nvmem-cell-names = "mac-address";
-       mac-address-increment-byte = <3>;
-       mac-address-increment = <0x40>;
 };
 
 &mdio1 {
 
        mtd-cal-data = <&art 0x1000>;
 };
-
-&art {
-       compatible = "nvmem-cells";
-       #address-cells = <1>;
-       #size-cells = <1>;
-
-       macaddr_art_1002: macaddr@1002 {
-               reg = <0x1002 0x6>;
-       };
-};
index a84c273f8622c50bc0a094dbf00af902e22e3469..de138658180760eb2fdd670a357a4b8a0fb484f7 100644 (file)
                                reg = <0xff0000 0x010000>;
                                read-only;
 
-                               compatible = "nvmem-cells";
-                               #address-cells = <1>;
-                               #size-cells = <1>;
-
-                               calibration_art_1000: calibration_data@1000 {
-                                       reg = <0x1000 0x440>;
-                               };
-
-                               macaddr_art_1002: macaddr@1002 {
-                                       reg = <0x1002 0x6>;
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       calibration_art_1000: calibration_data@1000 {
+                                               reg = <0x1000 0x440>;
+                                       };
+
+                                       macaddr_art_1002: macaddr@1002 {
+                                               compatible = "mac-base";
+                                               reg = <0x1002 0x6>;
+                                               #nvmem-cell-cells = <1>;
+                                       };
                                };
                        };
                };
 &eth1 {
        status = "okay";
 
-       nvmem-cells = <&macaddr_art_1002>;
+       nvmem-cells = <&macaddr_art_1002 0x400000>;
        nvmem-cell-names = "mac-address";
-       mac-address-increment-byte = <3>;
-       mac-address-increment = <0x40>;
 
        gmac-config {
                device = <&gmac>;
 &wmac {
        status = "okay";
 
-       nvmem-cells = <&macaddr_art_1002>, <&calibration_art_1000>;
+       nvmem-cells = <&macaddr_art_1002 0>, <&calibration_art_1000>;
        nvmem-cell-names = "mac-address", "calibration";
 };