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