diff options
author | Alexandru Gagniuc <mr.nuke.me@gmail.com> | 2022-08-20 18:22:40 -0500 |
---|---|---|
committer | Sander Vanheule <sander@svanheule.net> | 2022-09-13 09:22:26 +0200 |
commit | d55c08739032e906ece6f842f8fac97265018c4f (patch) | |
tree | 403b57cd0855b2862ac65ec0ecb2cd7119bf2f4e /target/linux/realtek/dts-5.10 | |
parent | 5f026f12728fbe9fe909c44c293f4ea58311d50f (diff) | |
download | upstream-d55c08739032e906ece6f842f8fac97265018c4f.tar.gz upstream-d55c08739032e906ece6f842f8fac97265018c4f.tar.bz2 upstream-d55c08739032e906ece6f842f8fac97265018c4f.zip |
realtek: tl-sg2xxx: read MAC address from nvmem-cells
The TP-Link RTL83xx based switches have their MAC address programmed
in the "para" partition. While in theory, the format of this partition
is dynamic, in practice, the MAC address appears to be located at a
consistent address. Thus, use nvmem-cells to read this MAC address.
The main MAC is required for deriving the MAC address of the switch
ports. Instead of reading it via mtd_get_mac_binary(), alias the
ethernet0 node as the label-mac-device, and use get_mac_label().
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Diffstat (limited to 'target/linux/realtek/dts-5.10')
-rw-r--r-- | target/linux/realtek/dts-5.10/rtl8380_tplink_sg2xxx.dtsi | 11 | ||||
-rw-r--r-- | target/linux/realtek/dts-5.10/rtl8393_tplink_sg2452p-v4.dts | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/target/linux/realtek/dts-5.10/rtl8380_tplink_sg2xxx.dtsi b/target/linux/realtek/dts-5.10/rtl8380_tplink_sg2xxx.dtsi index 8aa82831ab..20e96af2e7 100644 --- a/target/linux/realtek/dts-5.10/rtl8380_tplink_sg2xxx.dtsi +++ b/target/linux/realtek/dts-5.10/rtl8380_tplink_sg2xxx.dtsi @@ -11,6 +11,7 @@ led-failsafe = &led_power; led-running = &led_power; led-upgrade = &led_power; + label-mac-device = ðernet0; }; memory@0 { @@ -128,15 +129,25 @@ reg = <0x1b00000 0x400000>; }; partition@1f00000 { + compatible = "nvmem-cells"; label = "para"; reg = <0x1f00000 0x100000>; + #address-cells = <1>; + #size-cells = <1>; read-only; + + factory_macaddr: macaddr@fdff4 { + reg = <0xfdff4 0x6>; + }; }; }; }; }; ðernet0 { + nvmem-cells = <&factory_macaddr>; + nvmem-cell-names = "mac-address"; + mdio: mdio-bus { compatible = "realtek,rtl838x-mdio"; #address-cells = <1>; diff --git a/target/linux/realtek/dts-5.10/rtl8393_tplink_sg2452p-v4.dts b/target/linux/realtek/dts-5.10/rtl8393_tplink_sg2452p-v4.dts index 0649c9fb37..b7300cfcbe 100644 --- a/target/linux/realtek/dts-5.10/rtl8393_tplink_sg2452p-v4.dts +++ b/target/linux/realtek/dts-5.10/rtl8393_tplink_sg2452p-v4.dts @@ -20,6 +20,7 @@ led-failsafe = &led_sys; led-running = &led_sys; led-upgrade = &led_sys; + label-mac-device = ðernet0; }; chosen { @@ -261,15 +262,25 @@ reg = <0x1b00000 0x400000>; }; partition@1f00000 { + compatible = "nvmem-cells"; label = "para"; reg = <0x1f00000 0x100000>; + #address-cells = <1>; + #size-cells = <1>; read-only; + + factory_macaddr: macaddr@fdff4 { + reg = <0xfdff4 0x6>; + }; }; }; }; }; ðernet0 { + nvmem-cells = <&factory_macaddr>; + nvmem-cell-names = "mac-address"; + mdio: mdio-bus { compatible = "realtek,rtl838x-mdio"; #address-cells = <1>; |