xref: /linux/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml (revision 509d3f45847627f4c5cdce004c3ec79262b5239c)
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  clock_in_out:
89    description:
90      For RGMII, it must be "input", means main clock(125MHz)
91      is not sourced from SoC's PLL, but input from PHY.
92      For RMII, "input" means PHY provides the reference clock(50MHz),
93      "output" means GMAC provides the reference clock.
94    $ref: /schemas/types.yaml#/definitions/string
95    enum: [input, output]
96    default: input
97
98  rockchip,grf:
99    description: The phandle of the syscon node for the general register file.
100    $ref: /schemas/types.yaml#/definitions/phandle
101
102  rockchip,php-grf:
103    description:
104      The phandle of the syscon node for the peripheral general register file.
105    $ref: /schemas/types.yaml#/definitions/phandle
106
107  tx_delay:
108    description: Delay value for TXD timing.
109    $ref: /schemas/types.yaml#/definitions/uint32
110    minimum: 0
111    maximum: 0x7F
112    default: 0x30
113
114  rx_delay:
115    description: Delay value for RXD timing.
116    $ref: /schemas/types.yaml#/definitions/uint32
117    minimum: 0
118    maximum: 0x7F
119    default: 0x10
120
121  phy-supply:
122    description: PHY regulator
123
124required:
125  - compatible
126  - clocks
127  - clock-names
128  - rockchip,grf
129
130allOf:
131  - $ref: snps,dwmac.yaml#
132
133  - if:
134      properties:
135        compatible:
136          contains:
137            enum:
138              - rockchip,rk3576-gmac
139              - rockchip,rk3588-gmac
140    then:
141      required:
142        - rockchip,php-grf
143    else:
144      properties:
145        rockchip,php-grf: false
146
147  - if:
148      not:
149        properties:
150          compatible:
151            contains:
152              enum:
153                - rockchip,rk3506-gmac
154                - rockchip,rk3528-gmac
155    then:
156      properties:
157        clocks:
158          minItems: 5
159
160unevaluatedProperties: false
161
162examples:
163  - |
164    #include <dt-bindings/interrupt-controller/arm-gic.h>
165    #include <dt-bindings/clock/rk3288-cru.h>
166
167    gmac: ethernet@ff290000 {
168        compatible = "rockchip,rk3288-gmac";
169        reg = <0xff290000 0x10000>;
170        interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
171        interrupt-names = "macirq";
172        clocks = <&cru SCLK_MAC>,
173                 <&cru SCLK_MAC_RX>, <&cru SCLK_MAC_TX>,
174                 <&cru SCLK_MACREF>, <&cru SCLK_MACREF_OUT>,
175                 <&cru ACLK_GMAC>, <&cru PCLK_GMAC>;
176        clock-names = "stmmaceth",
177                      "mac_clk_rx", "mac_clk_tx",
178                      "clk_mac_ref", "clk_mac_refout",
179                      "aclk_mac", "pclk_mac";
180        assigned-clocks = <&cru SCLK_MAC>;
181        assigned-clock-parents = <&ext_gmac>;
182
183        rockchip,grf = <&grf>;
184        phy-mode = "rgmii-id";
185        clock_in_out = "input";
186    };
187