xref: /linux/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml (revision 2d7eaeb05ae265bd64270376e6a2c0d80244771f)
1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/net/rockchip-dwmac.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Rockchip 10/100/1000 Ethernet driver(GMAC)
8
9maintainers:
10  - David Wu <david.wu@rock-chips.com>
11
12# We need a select here so we don't match all nodes with 'snps,dwmac'
13select:
14  properties:
15    compatible:
16      contains:
17        enum:
18          - rockchip,px30-gmac
19          - rockchip,rk3128-gmac
20          - rockchip,rk3228-gmac
21          - rockchip,rk3288-gmac
22          - rockchip,rk3308-gmac
23          - rockchip,rk3328-gmac
24          - rockchip,rk3366-gmac
25          - rockchip,rk3368-gmac
26          - rockchip,rk3399-gmac
27          - rockchip,rk3506-gmac
28          - rockchip,rk3528-gmac
29          - rockchip,rk3568-gmac
30          - rockchip,rk3576-gmac
31          - rockchip,rk3588-gmac
32          - rockchip,rv1108-gmac
33          - rockchip,rv1126-gmac
34  required:
35    - compatible
36
37properties:
38  compatible:
39    oneOf:
40      - items:
41          - enum:
42              - rockchip,px30-gmac
43              - rockchip,rk3128-gmac
44              - rockchip,rk3228-gmac
45              - rockchip,rk3288-gmac
46              - rockchip,rk3308-gmac
47              - rockchip,rk3328-gmac
48              - rockchip,rk3366-gmac
49              - rockchip,rk3368-gmac
50              - rockchip,rk3399-gmac
51              - rockchip,rv1108-gmac
52      - items:
53          - enum:
54              - rockchip,rk3506-gmac
55              - rockchip,rk3528-gmac
56              - rockchip,rk3568-gmac
57              - rockchip,rk3576-gmac
58              - rockchip,rk3588-gmac
59              - rockchip,rv1126-gmac
60          - const: snps,dwmac-4.20a
61
62  interrupts:
63    minItems: 1
64    maxItems: 2
65
66  interrupt-names:
67    minItems: 1
68    items:
69      - const: macirq
70      - const: eth_wake_irq
71
72  clocks:
73    minItems: 4
74    maxItems: 8
75
76  clock-names:
77    contains:
78      enum:
79        - stmmaceth
80        - mac_clk_tx
81        - mac_clk_rx
82        - aclk_mac
83        - pclk_mac
84        - clk_mac_ref
85        - clk_mac_refout
86        - clk_mac_speed
87
88  dma-coherent: true
89
90  clock_in_out:
91    description:
92      For RGMII, it must be "input", means main clock(125MHz)
93      is not sourced from SoC's PLL, but input from PHY.
94      For RMII, "input" means PHY provides the reference clock(50MHz),
95      "output" means GMAC provides the reference clock.
96    $ref: /schemas/types.yaml#/definitions/string
97    enum: [input, output]
98    default: input
99
100  rockchip,grf:
101    description: The phandle of the syscon node for the general register file.
102    $ref: /schemas/types.yaml#/definitions/phandle
103
104  rockchip,php-grf:
105    description:
106      The phandle of the syscon node for the peripheral general register file.
107    $ref: /schemas/types.yaml#/definitions/phandle
108
109  tx_delay:
110    description: Delay value for TXD timing.
111    $ref: /schemas/types.yaml#/definitions/uint32
112    minimum: 0
113    maximum: 0x7F
114    default: 0x30
115
116  rx_delay:
117    description: Delay value for RXD timing.
118    $ref: /schemas/types.yaml#/definitions/uint32
119    minimum: 0
120    maximum: 0x7F
121    default: 0x10
122
123  pcs-handle:
124    description:
125      Specifies a reference to a node representing the PCS device
126      connected to this GMAC. Required when phy-mode is "sgmii".
127    maxItems: 1
128
129  phy-supply:
130    description: PHY regulator
131
132  power-domains:
133    maxItems: 1
134
135required:
136  - compatible
137  - clocks
138  - clock-names
139  - rockchip,grf
140
141allOf:
142  - $ref: snps,dwmac.yaml#
143
144  - if:
145      properties:
146        compatible:
147          contains:
148            enum:
149              - rockchip,rk3576-gmac
150              - rockchip,rk3588-gmac
151    then:
152      required:
153        - rockchip,php-grf
154    else:
155      properties:
156        rockchip,php-grf: false
157
158  - if:
159      not:
160        properties:
161          compatible:
162            contains:
163              enum:
164                - rockchip,rk3506-gmac
165                - rockchip,rk3528-gmac
166    then:
167      properties:
168        clocks:
169          minItems: 5
170
171  - if:
172      properties:
173        compatible:
174          contains:
175            const: rockchip,rk3568-gmac
176    then:
177      required:
178        - phy-mode
179
180  - if:
181      properties:
182        compatible:
183          contains:
184            const: rockchip,rk3568-gmac
185        phy-mode:
186          contains:
187            const: sgmii
188    then:
189      required:
190        - pcs-handle
191
192unevaluatedProperties: false
193
194examples:
195  - |
196    #include <dt-bindings/interrupt-controller/arm-gic.h>
197    #include <dt-bindings/clock/rk3288-cru.h>
198
199    gmac: ethernet@ff290000 {
200        compatible = "rockchip,rk3288-gmac";
201        reg = <0xff290000 0x10000>;
202        interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
203        interrupt-names = "macirq";
204        clocks = <&cru SCLK_MAC>,
205                 <&cru SCLK_MAC_RX>, <&cru SCLK_MAC_TX>,
206                 <&cru SCLK_MACREF>, <&cru SCLK_MACREF_OUT>,
207                 <&cru ACLK_GMAC>, <&cru PCLK_GMAC>;
208        clock-names = "stmmaceth",
209                      "mac_clk_rx", "mac_clk_tx",
210                      "clk_mac_ref", "clk_mac_refout",
211                      "aclk_mac", "pclk_mac";
212        assigned-clocks = <&cru SCLK_MAC>;
213        assigned-clock-parents = <&ext_gmac>;
214
215        rockchip,grf = <&grf>;
216        phy-mode = "rgmii-id";
217        clock_in_out = "input";
218    };
219