Skip to content

Commit 98e7ed1

Browse files
janhrobimarko
authored andcommitted
realtek: switch Zyxel XGS1210 to NVMEM
These devices contain a single MAC address in the U-Boot environment. Set it as eth0 and label MAC in device tree. To maintain the current state, the 02_network script still sets individual port MAC addresses and the bridge MAC address. Signed-off-by: Jan Hoffmann <jan@3e8.eu> Link: openwrt/openwrt#22024 Signed-off-by: Robert Marko <robimarko@gmail.com>
1 parent d22eb0a commit 98e7ed1

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

target/linux/realtek/base-files/etc/board.d/02_network

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ realtek_setup_macs()
5858
tplink,sg2452p-v4|\
5959
tplink,t1600g-28ts-v3|\
6060
xikestor,sks8300-8t|\
61-
xikestor,sks8300-12e2t2x)
61+
xikestor,sks8300-12e2t2x|\
62+
zyxel,xgs1210-12-a1|\
63+
zyxel,xgs1210-12-b1)
6264
lan_mac=$(get_mac_label)
6365
lan_mac_start=$lan_mac
6466
;;
@@ -142,8 +144,6 @@ realtek_setup_macs()
142144
zyxel,gs1900-8hp-a1|\
143145
zyxel,gs1900-8hp-b1|\
144146
zyxel,gs1920-24hp-v1|\
145-
zyxel,xgs1210-12-a1|\
146-
zyxel,xgs1210-12-b1|\
147147
zyxel,xgs1250-12-a1|\
148148
zyxel,xgs1250-12-b1)
149149
lan_mac=$(mtd_get_mac_ascii u-boot-env2 mac_start)

target/linux/realtek/dts/rtl9302_zyxel_xgs1210-12-common.dtsi

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
#include "rtl9302_zyxel_xgs1x10-12-common.dtsi"
55

66
/ {
7+
aliases {
8+
label-mac-device = &ethernet0;
9+
};
10+
711
keys {
812
compatible = "gpio-keys";
913

@@ -35,6 +39,14 @@
3539
partition@e0000 {
3640
label = "u-boot-env";
3741
reg = <0xe0000 0x10000>;
42+
43+
nvmem-layout {
44+
compatible = "u-boot,env";
45+
46+
macaddr_ubootenv_ethaddr: ethaddr {
47+
#nvmem-cell-cells = <1>;
48+
};
49+
};
3850
};
3951
partition@f0000 {
4052
label = "u-boot-env2";
@@ -63,3 +75,8 @@
6375
};
6476
};
6577
};
78+
79+
&ethernet0 {
80+
nvmem-cells = <&macaddr_ubootenv_ethaddr 0>;
81+
nvmem-cell-names = "mac-address";
82+
};

0 commit comments

Comments
 (0)