diff options
author | Petr Štetiar <ynezz@true.cz> | 2020-11-04 16:20:17 +0100 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2020-11-09 09:14:02 +0100 |
commit | e26744551039ef8d33786948a830ba5aa0a988b8 (patch) | |
tree | 9f7b4bb76579b9879ef779faf442fd3ccffb4ebd /target/linux/rtl838x/dts/rtl838x.dtsi | |
parent | 0516aa398cc73a2fec90db5795f7b1d73feefbeb (diff) | |
download | upstream-e26744551039ef8d33786948a830ba5aa0a988b8.tar.gz upstream-e26744551039ef8d33786948a830ba5aa0a988b8.tar.bz2 upstream-e26744551039ef8d33786948a830ba5aa0a988b8.zip |
rtl838x: dts: use macros for phy and switch definitions
It's quite more readable, saves some tedious copy&pasting, not so
error prone etc.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'target/linux/rtl838x/dts/rtl838x.dtsi')
-rw-r--r-- | target/linux/rtl838x/dts/rtl838x.dtsi | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/target/linux/rtl838x/dts/rtl838x.dtsi b/target/linux/rtl838x/dts/rtl838x.dtsi index 99c324bf52..37bbcefd44 100644 --- a/target/linux/rtl838x/dts/rtl838x.dtsi +++ b/target/linux/rtl838x/dts/rtl838x.dtsi @@ -2,6 +2,39 @@ /dts-v1/; +#define STRINGIZE(s) #s +#define LAN_LABEL(p, s) STRINGIZE(p ## s) +#define SWITCH_PORT_LABEL(n) LAN_LABEL(lan, n) + +#define INTERNAL_PHY(n) \ + phy##n: ethernet-phy@##n { \ + reg = <##n>; \ + compatible = "ethernet-phy-ieee802.3-c22"; \ + phy-is-integrated; \ + }; + +#define EXTERNAL_PHY(n) \ + phy##n: ethernet-phy@##n { \ + reg = <##n>; \ + compatible = "ethernet-phy-ieee802.3-c22"; \ + }; + +#define EXTERNAL_SFP_PHY(n) \ + phy##n: ethernet-phy@##n { \ + compatible = "ethernet-phy-ieee802.3-c22"; \ + sfp; \ + media = "fibre"; \ + reg = <##n>; \ + }; + +#define SWITCH_PORT(n, s, m) \ + port@##n { \ + reg = <##n>; \ + label = SWITCH_PORT_LABEL(s) ; \ + phy-handle = <&phy##n>; \ + phy-mode = #m ; \ + }; + / { #address-cells = <1>; #size-cells = <1>; |