]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: use nvmem for mac address for XikeStor SKS8310-8X
authorJonas Jelonek <jelonek.jonas@gmail.com>
Fri, 27 Feb 2026 22:31:55 +0000 (22:31 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 1 Mar 2026 13:46:12 +0000 (14:46 +0100)
Define an nvmem cell in the device tree of XikeStor SKS8310-8X to
reference that as a source for the MAC address of the switch (ports).
This eliminates the need for the userspace script to read and parse the
MAC address.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22211
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/realtek/base-files/etc/board.d/02_network
target/linux/realtek/dts/rtl9303_xikestor_sks8310-8x.dts

index 06619524dbbf7772834081b1033c84a355fbdfe9..7fccc77f582ed944daf7eaf99b8308c84e7248bf 100644 (file)
@@ -65,6 +65,7 @@ realtek_setup_macs()
        xikestor,sks8300-8t|\
        xikestor,sks8300-12e2t2x|\
        xikestor,sks8300-12x-v1|\
+       xikestor,sks8310-8x|\
        zyxel,xgs1210-12-a1|\
        zyxel,xgs1210-12-b1)
                lan_mac=$(get_mac_label)
@@ -100,12 +101,6 @@ realtek_setup_macs()
                lan_mac_start=$lan_mac
                eth0_mac=$lan_mac
                ;;
-       xikestor,sks8310-8x)
-               lan_mac=$(mtd_get_mac_binary factory 0x80)
-               label_mac="$lan_mac"
-               lan_mac_start=$lan_mac
-               eth0_mac=$lan_mac
-               ;;
        allnet,all-sg8208m|\
        apresia,aplgs120gtss|\
        d-link,dgs-1210-10mp-f|\
index 7396a9ed32b7e040dccb7100e3fcdbb2f892f63a..0482eed8bf12af8c88cdadd6a7d0737b25b6a732 100644 (file)
        compatible = "xikestor,sks8310-8x", "realtek,rtl9303-soc";
        model = "XikeStor SKS8310-8X";
 
+       aliases {
+               label-mac-device = &ethernet0;
+       };
+
        memory@0 {
                device_type = "memory";
                reg = <0x00000000 0x10000000>, /* first 256 MiB */
                                label = "factory";
                                reg = <0x1e0000 0x10000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       factory_macaddr: macaddr@80 {
+                                               compatible = "mac-base";
+                                               reg = <0x80 0x6>;
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
 
                        partition@1f0000 {
        };
 };
 
+&ethernet0 {
+       nvmem-cells = <&factory_macaddr 0>;
+       nvmem-cell-names = "mac-address";
+};
+
 &switch0 {
        ethernet-ports {
                #address-cells = <1>;