xref: /linux/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml (revision 1fd1dc41724319406b0aff221a352a400b0ddfc5)
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  phy-supply:
124    description: PHY regulator
125
126required:
127  - compatible
128  - clocks
129  - clock-names
130  - rockchip,grf
131
132allOf:
133  - $ref: snps,dwmac.yaml#
134
135  - if:
136      properties:
137        compatible:
138          contains:
139            enum:
140              - rockchip,rk3576-gmac
141              - rockchip,rk3588-gmac
142    then:
143      required:
144        - rockchip,php-grf
145    else:
146      properties:
147        rockchip,php-grf: false
148
149  - if:
150      not:
151        properties:
152          compatible:
153            contains:
154              enum:
155                - rockchip,rk3506-gmac
156                - rockchip,rk3528-gmac
157    then:
158      properties:
159        clocks:
160          minItems: 5
161
162unevaluatedProperties: false
163
164examples:
165  - |
166    #include <dt-bindings/interrupt-controller/arm-gic.h>
167    #include <dt-bindings/clock/rk3288-cru.h>
168
169    gmac: ethernet@ff290000 {
170        compatible = "rockchip,rk3288-gmac";
171        reg = <0xff290000 0x10000>;
172        interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
173        interrupt-names = "macirq";
174        clocks = <&cru SCLK_MAC>,
175                 <&cru SCLK_MAC_RX>, <&cru SCLK_MAC_TX>,
176                 <&cru SCLK_MACREF>, <&cru SCLK_MACREF_OUT>,
177                 <&cru ACLK_GMAC>, <&cru PCLK_GMAC>;
178        clock-names = "stmmaceth",
179                      "mac_clk_rx", "mac_clk_tx",
180                      "clk_mac_ref", "clk_mac_refout",
181                      "aclk_mac", "pclk_mac";
182        assigned-clocks = <&cru SCLK_MAC>;
183        assigned-clock-parents = <&ext_gmac>;
184
185        rockchip,grf = <&grf>;
186        phy-mode = "rgmii-id";
187        clock_in_out = "input";
188    };
189