Skip to content

Commit 7a1c254

Browse files
cpackham-atlnzNipaLocal
authored andcommitted
dt-bindings: net: Add Realtek MDIO controller
Add dtschema for the MDIO controller found in the RTL9300 Ethernet switch. The controller is slightly unusual in that direct MDIO communication is not possible. We model the MDIO controller with the MDIO buses as child nodes and the PHYs as children of the buses. The mapping of switch port number to MDIO bus/addr requires the ethernet-ports sibling to provide the mapping via the phy-handle property. Signed-off-by: Chris Packham <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent f36872e commit 7a1c254

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/net/realtek,rtl9301-mdio.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Realtek RTL9300 MDIO Controller
8+
9+
maintainers:
10+
- Chris Packham <[email protected]>
11+
12+
properties:
13+
compatible:
14+
oneOf:
15+
- items:
16+
- enum:
17+
- realtek,rtl9302b-mdio
18+
- realtek,rtl9302c-mdio
19+
- realtek,rtl9303-mdio
20+
- const: realtek,rtl9301-mdio
21+
- const: realtek,rtl9301-mdio
22+
23+
'#address-cells':
24+
const: 1
25+
26+
'#size-cells':
27+
const: 0
28+
29+
reg:
30+
maxItems: 1
31+
32+
patternProperties:
33+
'^mdio-bus@[0-3]$':
34+
$ref: mdio.yaml#
35+
36+
properties:
37+
reg:
38+
maxItems: 1
39+
40+
required:
41+
- reg
42+
43+
patternProperties:
44+
'^ethernet-phy@[a-f0-9]+$':
45+
type: object
46+
$ref: ethernet-phy.yaml#
47+
unevaluatedProperties: false
48+
49+
unevaluatedProperties: false
50+
51+
required:
52+
- compatible
53+
- reg
54+
55+
unevaluatedProperties: false
56+
57+
examples:
58+
- |
59+
mdio-controller@ca00 {
60+
compatible = "realtek,rtl9301-mdio";
61+
reg = <0xca00 0x200>;
62+
#address-cells = <1>;
63+
#size-cells = <0>;
64+
65+
mdio-bus@0 {
66+
reg = <0>;
67+
#address-cells = <1>;
68+
#size-cells = <0>;
69+
70+
ethernet-phy@0 {
71+
compatible = "ethernet-phy-ieee802.3-c45";
72+
reg = <0>;
73+
};
74+
};
75+
76+
mdio-bus@1 {
77+
reg = <1>;
78+
#address-cells = <1>;
79+
#size-cells = <0>;
80+
81+
ethernet-phy@0 {
82+
compatible = "ethernet-phy-ieee802.3-c45";
83+
reg = <0>;
84+
};
85+
};
86+
};

Documentation/devicetree/bindings/net/realtek,rtl9301-switch.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ patternProperties:
5454
'i2c@[0-9a-f]+$':
5555
$ref: /schemas/i2c/realtek,rtl9301-i2c.yaml#
5656

57+
'mdio-controller@[0-9a-f]+$':
58+
$ref: realtek,rtl9301-mdio.yaml#
59+
5760
required:
5861
- compatible
5962
- reg
@@ -129,15 +132,43 @@ examples:
129132
};
130133
};
131134
135+
mdio-controller@ca00 {
136+
compatible = "realtek,rtl9301-mdio";
137+
reg = <0xca00 0x200>;
138+
#address-cells = <1>;
139+
#size-cells = <0>;
140+
141+
mdio-bus@0 {
142+
reg = <0>;
143+
#address-cells = <1>;
144+
#size-cells = <0>;
145+
146+
phy1: ethernet-phy@0 {
147+
reg = <0>;
148+
};
149+
};
150+
mdio-bus@1 {
151+
reg = <1>;
152+
#address-cells = <1>;
153+
#size-cells = <0>;
154+
155+
phy2: ethernet-phy@0 {
156+
reg = <0>;
157+
};
158+
};
159+
};
160+
132161
ethernet-ports {
133162
#address-cells = <1>;
134163
#size-cells = <0>;
135164
136165
port@0 {
137166
reg = <0>;
167+
phy-handle = <&phy1>;
138168
};
139169
port@1 {
140170
reg = <1>;
171+
phy-handle = <&phy2>;
141172
};
142173
};
143174
};

0 commit comments

Comments
 (0)