xref: /linux/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml (revision fa79e55d467366a2c52c68a261a0d6ea5f8a6534)
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,rk3528-gmac
28          - rockchip,rk3568-gmac
29          - rockchip,rk3576-gmac
30          - rockchip,rk3588-gmac
31          - rockchip,rv1108-gmac
32          - rockchip,rv1126-gmac
33  required:
34    - compatible
35
36properties:
37  compatible:
38    oneOf:
39      - items:
40          - enum:
41              - rockchip,px30-gmac
42              - rockchip,rk3128-gmac
43              - rockchip,rk3228-gmac
44              - rockchip,rk3288-gmac
45              - rockchip,rk3308-gmac
46              - rockchip,rk3328-gmac
47              - rockchip,rk3366-gmac
48              - rockchip,rk3368-gmac
49              - rockchip,rk3399-gmac
50              - rockchip,rv1108-gmac
51      - items:
52          - enum:
53              - rockchip,rk3528-gmac
54              - rockchip,rk3568-gmac
55              - rockchip,rk3576-gmac
56              - rockchip,rk3588-gmac
57              - rockchip,rv1126-gmac
58          - const: snps,dwmac-4.20a
59
60  interrupts:
61    minItems: 1
62    maxItems: 2
63
64  interrupt-names:
65    minItems: 1
66    items:
67      - const: macirq
68      - const: eth_wake_irq
69
70  clocks:
71    minItems: 4
72    maxItems: 8
73
74  clock-names:
75    contains:
76      enum:
77        - stmmaceth
78        - mac_clk_tx
79        - mac_clk_rx
80        - aclk_mac
81        - pclk_mac
82        - clk_mac_ref
83        - clk_mac_refout
84        - clk_mac_speed
85
86  clock_in_out:
87    description:
88      For RGMII, it must be "input", means main clock(125MHz)
89      is not sourced from SoC's PLL, but input from PHY.
90      For RMII, "input" means PHY provides the reference clock(50MHz),
91      "output" means GMAC provides the reference clock.
92    $ref: /schemas/types.yaml#/definitions/string
93    enum: [input, output]
94    default: input
95
96  rockchip,grf:
97    description: The phandle of the syscon node for the general register file.
98    $ref: /schemas/types.yaml#/definitions/phandle
99
100  rockchip,php-grf:
101    description:
102      The phandle of the syscon node for the peripheral general register file.
103    $ref: /schemas/types.yaml#/definitions/phandle
104
105  tx_delay:
106    description: Delay value for TXD timing.
107    $ref: /schemas/types.yaml#/definitions/uint32
108    minimum: 0
109    maximum: 0x7F
110    default: 0x30
111
112  rx_delay:
113    description: Delay value for RXD timing.
114    $ref: /schemas/types.yaml#/definitions/uint32
115    minimum: 0
116    maximum: 0x7F
117    default: 0x10
118
119  phy-supply:
120    description: PHY regulator
121
122required:
123  - compatible
124  - clocks
125  - clock-names
126  - rockchip,grf
127
128allOf:
129  - $ref: snps,dwmac.yaml#
130
131  - if:
132      properties:
133        compatible:
134          contains:
135            enum:
136              - rockchip,rk3576-gmac
137              - rockchip,rk3588-gmac
138    then:
139      required:
140        - rockchip,php-grf
141    else:
142      properties:
143        rockchip,php-grf: false
144
145  - if:
146      not:
147        properties:
148          compatible:
149            contains:
150              enum:
151                - rockchip,rk3528-gmac
152    then:
153      properties:
154        clocks:
155          minItems: 5
156
157unevaluatedProperties: false
158
159examples:
160  - |
161    #include <dt-bindings/interrupt-controller/arm-gic.h>
162    #include <dt-bindings/clock/rk3288-cru.h>
163
164    gmac: ethernet@ff290000 {
165        compatible = "rockchip,rk3288-gmac";
166        reg = <0xff290000 0x10000>;
167        interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
168        interrupt-names = "macirq";
169        clocks = <&cru SCLK_MAC>,
170                 <&cru SCLK_MAC_RX>, <&cru SCLK_MAC_TX>,
171                 <&cru SCLK_MACREF>, <&cru SCLK_MACREF_OUT>,
172                 <&cru ACLK_GMAC>, <&cru PCLK_GMAC>;
173        clock-names = "stmmaceth",
174                      "mac_clk_rx", "mac_clk_tx",
175                      "clk_mac_ref", "clk_mac_refout",
176                      "aclk_mac", "pclk_mac";
177        assigned-clocks = <&cru SCLK_MAC>;
178        assigned-clock-parents = <&ext_gmac>;
179
180        rockchip,grf = <&grf>;
181        phy-mode = "rgmii-id";
182        clock_in_out = "input";
183    };
184