8fb8a0d24c08181c9eab2d2033f05d10284f3ab7
[platform/kernel/linux-starfive.git] / Documentation / devicetree / bindings / net / snps,dwmac.yaml
1 # SPDX-License-Identifier: GPL-2.0
2 %YAML 1.2
3 ---
4 $id: http://devicetree.org/schemas/net/snps,dwmac.yaml#
5 $schema: http://devicetree.org/meta-schemas/core.yaml#
6
7 title: Synopsys DesignWare MAC
8
9 maintainers:
10   - Alexandre Torgue <alexandre.torgue@foss.st.com>
11   - Giuseppe Cavallaro <peppe.cavallaro@st.com>
12   - Jose Abreu <joabreu@synopsys.com>
13
14 # Select every compatible, including the deprecated ones. This way, we
15 # will be able to report a warning when we have that compatible, since
16 # we will validate the node thanks to the select, but won't report it
17 # as a valid value in the compatible property description
18 select:
19   properties:
20     compatible:
21       contains:
22         enum:
23           - snps,dwmac
24           - snps,dwmac-3.40a
25           - snps,dwmac-3.50a
26           - snps,dwmac-3.610
27           - snps,dwmac-3.70a
28           - snps,dwmac-3.710
29           - snps,dwmac-4.00
30           - snps,dwmac-4.10a
31           - snps,dwmac-4.20a
32           - snps,dwmac-5.10a
33           - snps,dwmac-5.20
34           - snps,dwxgmac
35           - snps,dwxgmac-2.10
36
37           # Deprecated
38           - st,spear600-gmac
39
40   required:
41     - compatible
42
43 properties:
44
45   # We need to include all the compatibles from schemas that will
46   # include that schemas, otherwise compatible won't validate for
47   # those.
48   compatible:
49     contains:
50       enum:
51         - allwinner,sun7i-a20-gmac
52         - allwinner,sun8i-a83t-emac
53         - allwinner,sun8i-h3-emac
54         - allwinner,sun8i-r40-gmac
55         - allwinner,sun8i-v3s-emac
56         - allwinner,sun50i-a64-emac
57         - amlogic,meson6-dwmac
58         - amlogic,meson8b-dwmac
59         - amlogic,meson8m2-dwmac
60         - amlogic,meson-gxbb-dwmac
61         - amlogic,meson-axg-dwmac
62         - ingenic,jz4775-mac
63         - ingenic,x1000-mac
64         - ingenic,x1600-mac
65         - ingenic,x1830-mac
66         - ingenic,x2000-mac
67         - loongson,ls2k-dwmac
68         - loongson,ls7a-dwmac
69         - renesas,r9a06g032-gmac
70         - renesas,rzn1-gmac
71         - rockchip,px30-gmac
72         - rockchip,rk3128-gmac
73         - rockchip,rk3228-gmac
74         - rockchip,rk3288-gmac
75         - rockchip,rk3328-gmac
76         - rockchip,rk3366-gmac
77         - rockchip,rk3368-gmac
78         - rockchip,rk3588-gmac
79         - rockchip,rk3399-gmac
80         - rockchip,rv1108-gmac
81         - snps,dwmac
82         - snps,dwmac-3.40a
83         - snps,dwmac-3.50a
84         - snps,dwmac-3.610
85         - snps,dwmac-3.70a
86         - snps,dwmac-3.710
87         - snps,dwmac-4.00
88         - snps,dwmac-4.10a
89         - snps,dwmac-4.20a
90         - snps,dwmac-5.10a
91         - snps,dwmac-5.20
92         - snps,dwxgmac
93         - snps,dwxgmac-2.10
94
95   reg:
96     minItems: 1
97     maxItems: 2
98
99   interrupts:
100     minItems: 1
101     items:
102       - description: Combined signal for various interrupt events
103       - description: The interrupt to manage the remote wake-up packet detection
104       - description: The interrupt that occurs when Rx exits the LPI state
105
106   interrupt-names:
107     minItems: 1
108     items:
109       - const: macirq
110       - const: eth_wake_irq
111       - const: eth_lpi
112
113   clocks:
114     minItems: 1
115     maxItems: 8
116     additionalItems: true
117     items:
118       - description: GMAC main clock
119       - description: Peripheral registers interface clock
120       - description:
121           PTP reference clock. This clock is used for programming the
122           Timestamp Addend Register. If not passed then the system
123           clock will be used and this is fine on some platforms.
124
125   clock-names:
126     minItems: 1
127     maxItems: 8
128     additionalItems: true
129     contains:
130       enum:
131         - stmmaceth
132         - pclk
133         - ptp_ref
134
135   resets:
136     minItems: 1
137     items:
138       - description: GMAC stmmaceth reset
139       - description: AHB reset
140
141   reset-names:
142     minItems: 1
143     items:
144       - const: stmmaceth
145       - const: ahb
146
147   power-domains:
148     maxItems: 1
149
150   mac-mode:
151     $ref: ethernet-controller.yaml#/properties/phy-connection-type
152     description:
153       The property is identical to 'phy-mode', and assumes that there is mode
154       converter in-between the MAC & PHY (e.g. GMII-to-RGMII). This converter
155       can be passive (no SW requirement), and requires that the MAC operate
156       in a different mode than the PHY in order to function.
157
158   snps,axi-config:
159     $ref: /schemas/types.yaml#/definitions/phandle
160     description:
161       AXI BUS Mode parameters. Phandle to a node that can contain the
162       following properties
163         * snps,lpi_en, enable Low Power Interface
164         * snps,xit_frm, unlock on WoL
165         * snps,wr_osr_lmt, max write outstanding req. limit
166         * snps,rd_osr_lmt, max read outstanding req. limit
167         * snps,kbbe, do not cross 1KiB boundary.
168         * snps,blen, this is a vector of supported burst length.
169         * snps,fb, fixed-burst
170         * snps,mb, mixed-burst
171         * snps,rb, rebuild INCRx Burst
172
173   snps,mtl-rx-config:
174     $ref: /schemas/types.yaml#/definitions/phandle
175     description:
176       Multiple RX Queues parameters. Phandle to a node that can
177       contain the following properties
178         * snps,rx-queues-to-use, number of RX queues to be used in the
179           driver
180         * Choose one of these RX scheduling algorithms
181           * snps,rx-sched-sp, Strict priority
182           * snps,rx-sched-wsp, Weighted Strict priority
183         * For each RX queue
184           * Choose one of these modes
185             * snps,dcb-algorithm, Queue to be enabled as DCB
186             * snps,avb-algorithm, Queue to be enabled as AVB
187           * snps,map-to-dma-channel, Channel to map
188           * Specifiy specific packet routing
189             * snps,route-avcp, AV Untagged Control packets
190             * snps,route-ptp, PTP Packets
191             * snps,route-dcbcp, DCB Control Packets
192             * snps,route-up, Untagged Packets
193             * snps,route-multi-broad, Multicast & Broadcast Packets
194           * snps,priority, bitmask of the tagged frames priorities assigned to
195             the queue
196
197   snps,mtl-tx-config:
198     $ref: /schemas/types.yaml#/definitions/phandle
199     description:
200       Multiple TX Queues parameters. Phandle to a node that can
201       contain the following properties
202         * snps,tx-queues-to-use, number of TX queues to be used in the
203           driver
204         * Choose one of these TX scheduling algorithms
205           * snps,tx-sched-wrr, Weighted Round Robin
206           * snps,tx-sched-wfq, Weighted Fair Queuing
207           * snps,tx-sched-dwrr, Deficit Weighted Round Robin
208           * snps,tx-sched-sp, Strict priority
209         * For each TX queue
210           * snps,weight, TX queue weight (if using a DCB weight
211             algorithm)
212           * Choose one of these modes
213             * snps,dcb-algorithm, TX queue will be working in DCB
214             * snps,avb-algorithm, TX queue will be working in AVB
215               [Attention] Queue 0 is reserved for legacy traffic
216                           and so no AVB is available in this queue.
217           * Configure Credit Base Shaper (if AVB Mode selected)
218             * snps,send_slope, enable Low Power Interface
219             * snps,idle_slope, unlock on WoL
220             * snps,high_credit, max write outstanding req. limit
221             * snps,low_credit, max read outstanding req. limit
222           * snps,priority, bitmask of the priorities assigned to the queue.
223             When a PFC frame is received with priorities matching the bitmask,
224             the queue is blocked from transmitting for the pause time specified
225             in the PFC frame.
226
227   snps,reset-gpio:
228     deprecated: true
229     maxItems: 1
230     description:
231       PHY Reset GPIO
232
233   snps,reset-active-low:
234     deprecated: true
235     $ref: /schemas/types.yaml#/definitions/flag
236     description:
237       Indicates that the PHY Reset is active low
238
239   snps,reset-delays-us:
240     deprecated: true
241     description:
242       Triplet of delays. The 1st cell is reset pre-delay in micro
243       seconds. The 2nd cell is reset pulse in micro seconds. The 3rd
244       cell is reset post-delay in micro seconds.
245     minItems: 3
246     maxItems: 3
247
248   snps,aal:
249     $ref: /schemas/types.yaml#/definitions/flag
250     description:
251       Use Address-Aligned Beats
252
253   snps,fixed-burst:
254     $ref: /schemas/types.yaml#/definitions/flag
255     description:
256       Program the DMA to use the fixed burst mode
257
258   snps,mixed-burst:
259     $ref: /schemas/types.yaml#/definitions/flag
260     description:
261       Program the DMA to use the mixed burst mode
262
263   snps,force_thresh_dma_mode:
264     $ref: /schemas/types.yaml#/definitions/flag
265     description:
266       Force DMA to use the threshold mode for both tx and rx
267
268   snps,force_sf_dma_mode:
269     $ref: /schemas/types.yaml#/definitions/flag
270     description:
271       Force DMA to use the Store and Forward mode for both tx and
272       rx. This flag is ignored if force_thresh_dma_mode is set.
273
274   snps,en-tx-lpi-clockgating:
275     $ref: /schemas/types.yaml#/definitions/flag
276     description:
277       Enable gating of the MAC TX clock during TX low-power mode
278
279   snps,multicast-filter-bins:
280     $ref: /schemas/types.yaml#/definitions/uint32
281     description:
282       Number of multicast filter hash bins supported by this device
283       instance
284
285   snps,perfect-filter-entries:
286     $ref: /schemas/types.yaml#/definitions/uint32
287     description:
288       Number of perfect filter entries supported by this device
289       instance
290
291   snps,ps-speed:
292     $ref: /schemas/types.yaml#/definitions/uint32
293     description:
294       Port selection speed that can be passed to the core when PCS
295       is supported. For example, this is used in case of SGMII and
296       MAC2MAC connection.
297
298   snps,clk-csr:
299     $ref: /schemas/types.yaml#/definitions/uint32
300     description:
301       Frequency division factor for MDC clock.
302
303   mdio:
304     $ref: mdio.yaml#
305     unevaluatedProperties: false
306     description:
307       Creates and registers an MDIO bus.
308
309     properties:
310       compatible:
311         const: snps,dwmac-mdio
312
313     required:
314       - compatible
315
316   stmmac-axi-config:
317     type: object
318     unevaluatedProperties: false
319     description:
320       AXI BUS Mode parameters.
321
322     properties:
323       snps,lpi_en:
324         $ref: /schemas/types.yaml#/definitions/flag
325         description:
326           enable Low Power Interface
327
328       snps,xit_frm:
329         $ref: /schemas/types.yaml#/definitions/flag
330         description:
331           unlock on WoL
332
333       snps,wr_osr_lmt:
334         $ref: /schemas/types.yaml#/definitions/uint32
335         description:
336           max write outstanding req. limit
337
338       snps,rd_osr_lmt:
339         $ref: /schemas/types.yaml#/definitions/uint32
340         description:
341           max read outstanding req. limit
342
343       snps,kbbe:
344         $ref: /schemas/types.yaml#/definitions/uint32
345         description:
346           do not cross 1KiB boundary.
347
348       snps,blen:
349         $ref: /schemas/types.yaml#/definitions/uint32-array
350         description:
351           this is a vector of supported burst length.
352         minItems: 7
353         maxItems: 7
354
355       snps,fb:
356         $ref: /schemas/types.yaml#/definitions/flag
357         description:
358           fixed-burst
359
360       snps,mb:
361         $ref: /schemas/types.yaml#/definitions/flag
362         description:
363           mixed-burst
364
365       snps,rb:
366         $ref: /schemas/types.yaml#/definitions/flag
367         description:
368           rebuild INCRx Burst
369
370 required:
371   - compatible
372   - reg
373   - interrupts
374   - interrupt-names
375   - phy-mode
376
377 dependencies:
378   snps,reset-active-low: ["snps,reset-gpio"]
379   snps,reset-delay-us: ["snps,reset-gpio"]
380
381 allOf:
382   - $ref: "ethernet-controller.yaml#"
383   - if:
384       properties:
385         compatible:
386           contains:
387             enum:
388               - allwinner,sun7i-a20-gmac
389               - allwinner,sun8i-a83t-emac
390               - allwinner,sun8i-h3-emac
391               - allwinner,sun8i-r40-gmac
392               - allwinner,sun8i-v3s-emac
393               - allwinner,sun50i-a64-emac
394               - ingenic,jz4775-mac
395               - ingenic,x1000-mac
396               - ingenic,x1600-mac
397               - ingenic,x1830-mac
398               - ingenic,x2000-mac
399               - snps,dwmac-3.50a
400               - snps,dwmac-4.10a
401               - snps,dwmac-4.20a
402               - snps,dwmac-5.20
403               - snps,dwxgmac
404               - snps,dwxgmac-2.10
405               - st,spear600-gmac
406
407     then:
408       properties:
409         snps,pbl:
410           description:
411             Programmable Burst Length (tx and rx)
412           $ref: /schemas/types.yaml#/definitions/uint32
413           enum: [1, 2, 4, 8, 16, 32]
414
415         snps,txpbl:
416           description:
417             Tx Programmable Burst Length. If set, DMA tx will use this
418             value rather than snps,pbl.
419           $ref: /schemas/types.yaml#/definitions/uint32
420           enum: [1, 2, 4, 8, 16, 32]
421
422         snps,rxpbl:
423           description:
424             Rx Programmable Burst Length. If set, DMA rx will use this
425             value rather than snps,pbl.
426           $ref: /schemas/types.yaml#/definitions/uint32
427           enum: [1, 2, 4, 8, 16, 32]
428
429         snps,no-pbl-x8:
430           $ref: /schemas/types.yaml#/definitions/flag
431           description:
432             Don\'t multiply the pbl/txpbl/rxpbl values by 8. For core
433             rev < 3.50, don\'t multiply the values by 4.
434
435   - if:
436       properties:
437         compatible:
438           contains:
439             enum:
440               - allwinner,sun7i-a20-gmac
441               - allwinner,sun8i-a83t-emac
442               - allwinner,sun8i-h3-emac
443               - allwinner,sun8i-r40-gmac
444               - allwinner,sun8i-v3s-emac
445               - allwinner,sun50i-a64-emac
446               - loongson,ls2k-dwmac
447               - loongson,ls7a-dwmac
448               - ingenic,jz4775-mac
449               - ingenic,x1000-mac
450               - ingenic,x1600-mac
451               - ingenic,x1830-mac
452               - ingenic,x2000-mac
453               - snps,dwmac-4.00
454               - snps,dwmac-4.10a
455               - snps,dwmac-4.20a
456               - snps,dwmac-5.10a
457               - snps,dwmac-5.20
458               - snps,dwxgmac
459               - snps,dwxgmac-2.10
460               - st,spear600-gmac
461
462     then:
463       properties:
464         snps,tso:
465           $ref: /schemas/types.yaml#/definitions/flag
466           description:
467             Enables the TSO feature otherwise it will be managed by
468             MAC HW capability register.
469
470 additionalProperties: true
471
472 examples:
473   - |
474     stmmac_axi_setup: stmmac-axi-config {
475         snps,wr_osr_lmt = <0xf>;
476         snps,rd_osr_lmt = <0xf>;
477         snps,blen = <256 128 64 32 0 0 0>;
478     };
479
480     mtl_rx_setup: rx-queues-config {
481         snps,rx-queues-to-use = <1>;
482         snps,rx-sched-sp;
483         queue0 {
484             snps,dcb-algorithm;
485             snps,map-to-dma-channel = <0x0>;
486             snps,priority = <0x0>;
487         };
488     };
489
490     mtl_tx_setup: tx-queues-config {
491         snps,tx-queues-to-use = <2>;
492         snps,tx-sched-wrr;
493         queue0 {
494             snps,weight = <0x10>;
495             snps,dcb-algorithm;
496             snps,priority = <0x0>;
497         };
498
499         queue1 {
500             snps,avb-algorithm;
501             snps,send_slope = <0x1000>;
502             snps,idle_slope = <0x1000>;
503             snps,high_credit = <0x3E800>;
504             snps,low_credit = <0xFFC18000>;
505             snps,priority = <0x1>;
506         };
507     };
508
509     gmac0: ethernet@e0800000 {
510         compatible = "snps,dwxgmac-2.10", "snps,dwxgmac";
511         reg = <0xe0800000 0x8000>;
512         interrupt-parent = <&vic1>;
513         interrupts = <24 23 22>;
514         interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
515         mac-address = [000000000000]; /* Filled in by U-Boot */
516         max-frame-size = <3800>;
517         phy-mode = "gmii";
518         snps,multicast-filter-bins = <256>;
519         snps,perfect-filter-entries = <128>;
520         rx-fifo-depth = <16384>;
521         tx-fifo-depth = <16384>;
522         clocks = <&clock>;
523         clock-names = "stmmaceth";
524         snps,axi-config = <&stmmac_axi_setup>;
525         snps,mtl-rx-config = <&mtl_rx_setup>;
526         snps,mtl-tx-config = <&mtl_tx_setup>;
527         mdio0 {
528             #address-cells = <1>;
529             #size-cells = <0>;
530             compatible = "snps,dwmac-mdio";
531             phy1: ethernet-phy@0 {
532                 reg = <0>;
533             };
534         };
535     };
536
537 # FIXME: We should set it, but it would report all the generic
538 # properties as additional properties.
539 # additionalProperties: false
540
541 ...