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