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
7title: Synopsys DesignWare MAC
8
9maintainers:
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
18select:
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
43properties:
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        - qcom,qcs404-ethqos
70        - qcom,sc8280xp-ethqos
71        - qcom,sm8150-ethqos
72        - renesas,r9a06g032-gmac
73        - renesas,rzn1-gmac
74        - rockchip,px30-gmac
75        - rockchip,rk3128-gmac
76        - rockchip,rk3228-gmac
77        - rockchip,rk3288-gmac
78        - rockchip,rk3328-gmac
79        - rockchip,rk3366-gmac
80        - rockchip,rk3368-gmac
81        - rockchip,rk3588-gmac
82        - rockchip,rk3399-gmac
83        - rockchip,rv1108-gmac
84        - snps,dwmac
85        - snps,dwmac-3.40a
86        - snps,dwmac-3.50a
87        - snps,dwmac-3.610
88        - snps,dwmac-3.70a
89        - snps,dwmac-3.710
90        - snps,dwmac-4.00
91        - snps,dwmac-4.10a
92        - snps,dwmac-4.20a
93        - snps,dwmac-5.10a
94        - snps,dwmac-5.20
95        - snps,dwxgmac
96        - snps,dwxgmac-2.10
97        - starfive,jh7110-dwmac
98
99  reg:
100    minItems: 1
101    maxItems: 2
102
103  interrupts:
104    minItems: 1
105    items:
106      - description: Combined signal for various interrupt events
107      - description: The interrupt to manage the remote wake-up packet detection
108      - description: The interrupt that occurs when Rx exits the LPI state
109
110  interrupt-names:
111    minItems: 1
112    items:
113      - const: macirq
114      - enum: [eth_wake_irq, eth_lpi]
115      - const: eth_lpi
116
117  clocks:
118    minItems: 1
119    maxItems: 8
120    additionalItems: true
121    items:
122      - description: GMAC main clock
123      - description: Peripheral registers interface clock
124      - description:
125          PTP reference clock. This clock is used for programming the
126          Timestamp Addend Register. If not passed then the system
127          clock will be used and this is fine on some platforms.
128
129  clock-names:
130    minItems: 1
131    maxItems: 8
132    additionalItems: true
133    contains:
134      enum:
135        - stmmaceth
136        - pclk
137        - ptp_ref
138
139  resets:
140    minItems: 1
141    items:
142      - description: GMAC stmmaceth reset
143      - description: AHB reset
144
145  reset-names:
146    minItems: 1
147    items:
148      - const: stmmaceth
149      - const: ahb
150
151  power-domains:
152    maxItems: 1
153
154  mac-mode:
155    $ref: ethernet-controller.yaml#/properties/phy-connection-type
156    description:
157      The property is identical to 'phy-mode', and assumes that there is mode
158      converter in-between the MAC & PHY (e.g. GMII-to-RGMII). This converter
159      can be passive (no SW requirement), and requires that the MAC operate
160      in a different mode than the PHY in order to function.
161
162  snps,axi-config:
163    $ref: /schemas/types.yaml#/definitions/phandle
164    description:
165      AXI BUS Mode parameters. Phandle to a node that can contain the
166      following properties
167        * snps,lpi_en, enable Low Power Interface
168        * snps,xit_frm, unlock on WoL
169        * snps,wr_osr_lmt, max write outstanding req. limit
170        * snps,rd_osr_lmt, max read outstanding req. limit
171        * snps,kbbe, do not cross 1KiB boundary.
172        * snps,blen, this is a vector of supported burst length.
173        * snps,fb, fixed-burst
174        * snps,mb, mixed-burst
175        * snps,rb, rebuild INCRx Burst
176
177  snps,mtl-rx-config:
178    $ref: /schemas/types.yaml#/definitions/phandle
179    description:
180      Multiple RX Queues parameters. Phandle to a node that
181      implements the 'rx-queues-config' object described in
182      this binding.
183
184  rx-queues-config:
185    type: object
186    properties:
187      snps,rx-queues-to-use:
188        $ref: /schemas/types.yaml#/definitions/uint32
189        description: number of RX queues to be used in the driver
190      snps,rx-sched-sp:
191        type: boolean
192        description: Strict priority
193      snps,rx-sched-wsp:
194        type: boolean
195        description: Weighted Strict priority
196    allOf:
197      - if:
198          required:
199            - snps,rx-sched-sp
200        then:
201          properties:
202            snps,rx-sched-wsp: false
203      - if:
204          required:
205            - snps,rx-sched-wsp
206        then:
207          properties:
208            snps,rx-sched-sp: false
209    patternProperties:
210      "^queue[0-9]$":
211        description: Each subnode represents a queue.
212        type: object
213        properties:
214          snps,dcb-algorithm:
215            type: boolean
216            description: Queue to be enabled as DCB
217          snps,avb-algorithm:
218            type: boolean
219            description: Queue to be enabled as AVB
220          snps,map-to-dma-channel:
221            $ref: /schemas/types.yaml#/definitions/uint32
222            description: DMA channel id to map
223          snps,route-avcp:
224            type: boolean
225            description: AV Untagged Control packets
226          snps,route-ptp:
227            type: boolean
228            description: PTP Packets
229          snps,route-dcbcp:
230            type: boolean
231            description: DCB Control Packets
232          snps,route-up:
233            type: boolean
234            description: Untagged Packets
235          snps,route-multi-broad:
236            type: boolean
237            description: Multicast & Broadcast Packets
238          snps,priority:
239            $ref: /schemas/types.yaml#/definitions/uint32
240            description: Bitmask of the tagged frames priorities assigned to the queue
241        allOf:
242          - if:
243              required:
244                - snps,dcb-algorithm
245            then:
246              properties:
247                snps,avb-algorithm: false
248          - if:
249              required:
250                - snps,avb-algorithm
251            then:
252              properties:
253                snps,dcb-algorithm: false
254          - if:
255              required:
256                - snps,route-avcp
257            then:
258              properties:
259                snps,route-ptp: false
260                snps,route-dcbcp: false
261                snps,route-up: false
262                snps,route-multi-broad: false
263          - if:
264              required:
265                - snps,route-ptp
266            then:
267              properties:
268                snps,route-avcp: false
269                snps,route-dcbcp: false
270                snps,route-up: false
271                snps,route-multi-broad: false
272          - if:
273              required:
274                - snps,route-dcbcp
275            then:
276              properties:
277                snps,route-avcp: false
278                snps,route-ptp: false
279                snps,route-up: false
280                snps,route-multi-broad: false
281          - if:
282              required:
283                - snps,route-up
284            then:
285              properties:
286                snps,route-avcp: false
287                snps,route-ptp: false
288                snps,route-dcbcp: false
289                snps,route-multi-broad: false
290          - if:
291              required:
292                - snps,route-multi-broad
293            then:
294              properties:
295                snps,route-avcp: false
296                snps,route-ptp: false
297                snps,route-dcbcp: false
298                snps,route-up: false
299        additionalProperties: false
300    additionalProperties: false
301
302  snps,mtl-tx-config:
303    $ref: /schemas/types.yaml#/definitions/phandle
304    description:
305      Multiple TX Queues parameters. Phandle to a node that
306      implements the 'tx-queues-config' object described in
307      this binding.
308
309  tx-queues-config:
310    type: object
311    properties:
312      snps,tx-queues-to-use:
313        $ref: /schemas/types.yaml#/definitions/uint32
314        description: number of TX queues to be used in the driver
315      snps,tx-sched-wrr:
316        type: boolean
317        description: Weighted Round Robin
318      snps,tx-sched-wfq:
319        type: boolean
320        description: Weighted Fair Queuing
321      snps,tx-sched-dwrr:
322        type: boolean
323        description: Deficit Weighted Round Robin
324      snps,tx-sched-sp:
325        type: boolean
326        description: Strict priority
327    allOf:
328      - if:
329          required:
330            - snps,tx-sched-wrr
331        then:
332          properties:
333            snps,tx-sched-wfq: false
334            snps,tx-sched-dwrr: false
335            snps,tx-sched-sp: false
336      - if:
337          required:
338            - snps,tx-sched-wfq
339        then:
340          properties:
341            snps,tx-sched-wrr: false
342            snps,tx-sched-dwrr: false
343            snps,tx-sched-sp: false
344      - if:
345          required:
346            - snps,tx-sched-dwrr
347        then:
348          properties:
349            snps,tx-sched-wrr: false
350            snps,tx-sched-wfq: false
351            snps,tx-sched-sp: false
352      - if:
353          required:
354            - snps,tx-sched-sp
355        then:
356          properties:
357            snps,tx-sched-wrr: false
358            snps,tx-sched-wfq: false
359            snps,tx-sched-dwrr: false
360    patternProperties:
361      "^queue[0-9]$":
362        description: Each subnode represents a queue.
363        type: object
364        properties:
365          snps,weight:
366            $ref: /schemas/types.yaml#/definitions/uint32
367            description: TX queue weight (if using a DCB weight algorithm)
368          snps,dcb-algorithm:
369            type: boolean
370            description: TX queue will be working in DCB
371          snps,avb-algorithm:
372            type: boolean
373            description:
374              TX queue will be working in AVB.
375              Queue 0 is reserved for legacy traffic and so no AVB is
376              available in this queue.
377          snps,send_slope:
378            $ref: /schemas/types.yaml#/definitions/uint32
379            description: enable Low Power Interface
380          snps,idle_slope:
381            $ref: /schemas/types.yaml#/definitions/uint32
382            description: unlock on WoL
383          snps,high_credit:
384            $ref: /schemas/types.yaml#/definitions/uint32
385            description: max write outstanding req. limit
386          snps,low_credit:
387            $ref: /schemas/types.yaml#/definitions/uint32
388            description: max read outstanding req. limit
389          snps,priority:
390            $ref: /schemas/types.yaml#/definitions/uint32
391            description:
392              Bitmask of the tagged frames priorities assigned to the queue.
393              When a PFC frame is received with priorities matching the bitmask,
394              the queue is blocked from transmitting for the pause time specified
395              in the PFC frame.
396        allOf:
397          - if:
398              required:
399                - snps,dcb-algorithm
400            then:
401              properties:
402                snps,avb-algorithm: false
403          - if:
404              required:
405                - snps,avb-algorithm
406            then:
407              properties:
408                snps,dcb-algorithm: false
409                snps,weight: false
410        additionalProperties: false
411    additionalProperties: false
412
413  snps,reset-gpio:
414    deprecated: true
415    maxItems: 1
416    description:
417      PHY Reset GPIO
418
419  snps,reset-active-low:
420    deprecated: true
421    $ref: /schemas/types.yaml#/definitions/flag
422    description:
423      Indicates that the PHY Reset is active low
424
425  snps,reset-delays-us:
426    deprecated: true
427    description:
428      Triplet of delays. The 1st cell is reset pre-delay in micro
429      seconds. The 2nd cell is reset pulse in micro seconds. The 3rd
430      cell is reset post-delay in micro seconds.
431    minItems: 3
432    maxItems: 3
433
434  snps,aal:
435    $ref: /schemas/types.yaml#/definitions/flag
436    description:
437      Use Address-Aligned Beats
438
439  snps,fixed-burst:
440    $ref: /schemas/types.yaml#/definitions/flag
441    description:
442      Program the DMA to use the fixed burst mode
443
444  snps,mixed-burst:
445    $ref: /schemas/types.yaml#/definitions/flag
446    description:
447      Program the DMA to use the mixed burst mode
448
449  snps,force_thresh_dma_mode:
450    $ref: /schemas/types.yaml#/definitions/flag
451    description:
452      Force DMA to use the threshold mode for both tx and rx
453
454  snps,force_sf_dma_mode:
455    $ref: /schemas/types.yaml#/definitions/flag
456    description:
457      Force DMA to use the Store and Forward mode for both tx and
458      rx. This flag is ignored if force_thresh_dma_mode is set.
459
460  snps,en-tx-lpi-clockgating:
461    $ref: /schemas/types.yaml#/definitions/flag
462    description:
463      Enable gating of the MAC TX clock during TX low-power mode
464
465  snps,multicast-filter-bins:
466    $ref: /schemas/types.yaml#/definitions/uint32
467    description:
468      Number of multicast filter hash bins supported by this device
469      instance
470
471  snps,perfect-filter-entries:
472    $ref: /schemas/types.yaml#/definitions/uint32
473    description:
474      Number of perfect filter entries supported by this device
475      instance
476
477  snps,ps-speed:
478    $ref: /schemas/types.yaml#/definitions/uint32
479    description:
480      Port selection speed that can be passed to the core when PCS
481      is supported. For example, this is used in case of SGMII and
482      MAC2MAC connection.
483
484  snps,clk-csr:
485    $ref: /schemas/types.yaml#/definitions/uint32
486    description:
487      Frequency division factor for MDC clock.
488
489  mdio:
490    $ref: mdio.yaml#
491    unevaluatedProperties: false
492    description:
493      Creates and registers an MDIO bus.
494
495    properties:
496      compatible:
497        const: snps,dwmac-mdio
498
499    required:
500      - compatible
501
502  stmmac-axi-config:
503    type: object
504    unevaluatedProperties: false
505    description:
506      AXI BUS Mode parameters.
507
508    properties:
509      snps,lpi_en:
510        $ref: /schemas/types.yaml#/definitions/flag
511        description:
512          enable Low Power Interface
513
514      snps,xit_frm:
515        $ref: /schemas/types.yaml#/definitions/flag
516        description:
517          unlock on WoL
518
519      snps,wr_osr_lmt:
520        $ref: /schemas/types.yaml#/definitions/uint32
521        description:
522          max write outstanding req. limit
523
524      snps,rd_osr_lmt:
525        $ref: /schemas/types.yaml#/definitions/uint32
526        description:
527          max read outstanding req. limit
528
529      snps,kbbe:
530        $ref: /schemas/types.yaml#/definitions/uint32
531        description:
532          do not cross 1KiB boundary.
533
534      snps,blen:
535        $ref: /schemas/types.yaml#/definitions/uint32-array
536        description:
537          this is a vector of supported burst length.
538        minItems: 7
539        maxItems: 7
540
541      snps,fb:
542        $ref: /schemas/types.yaml#/definitions/flag
543        description:
544          fixed-burst
545
546      snps,mb:
547        $ref: /schemas/types.yaml#/definitions/flag
548        description:
549          mixed-burst
550
551      snps,rb:
552        $ref: /schemas/types.yaml#/definitions/flag
553        description:
554          rebuild INCRx Burst
555
556required:
557  - compatible
558  - reg
559  - interrupts
560  - interrupt-names
561  - phy-mode
562
563dependencies:
564  snps,reset-active-low: ["snps,reset-gpio"]
565  snps,reset-delays-us: ["snps,reset-gpio"]
566
567allOf:
568  - $ref: ethernet-controller.yaml#
569  - if:
570      properties:
571        compatible:
572          contains:
573            enum:
574              - allwinner,sun7i-a20-gmac
575              - allwinner,sun8i-a83t-emac
576              - allwinner,sun8i-h3-emac
577              - allwinner,sun8i-r40-gmac
578              - allwinner,sun8i-v3s-emac
579              - allwinner,sun50i-a64-emac
580              - ingenic,jz4775-mac
581              - ingenic,x1000-mac
582              - ingenic,x1600-mac
583              - ingenic,x1830-mac
584              - ingenic,x2000-mac
585              - qcom,sc8280xp-ethqos
586              - snps,dwmac-3.50a
587              - snps,dwmac-4.10a
588              - snps,dwmac-4.20a
589              - snps,dwmac-5.20
590              - snps,dwxgmac
591              - snps,dwxgmac-2.10
592              - st,spear600-gmac
593
594    then:
595      properties:
596        snps,pbl:
597          description:
598            Programmable Burst Length (tx and rx)
599          $ref: /schemas/types.yaml#/definitions/uint32
600          enum: [1, 2, 4, 8, 16, 32]
601
602        snps,txpbl:
603          description:
604            Tx Programmable Burst Length. If set, DMA tx will use this
605            value rather than snps,pbl.
606          $ref: /schemas/types.yaml#/definitions/uint32
607          enum: [1, 2, 4, 8, 16, 32]
608
609        snps,rxpbl:
610          description:
611            Rx Programmable Burst Length. If set, DMA rx will use this
612            value rather than snps,pbl.
613          $ref: /schemas/types.yaml#/definitions/uint32
614          enum: [1, 2, 4, 8, 16, 32]
615
616        snps,no-pbl-x8:
617          $ref: /schemas/types.yaml#/definitions/flag
618          description:
619            Don\'t multiply the pbl/txpbl/rxpbl values by 8. For core
620            rev < 3.50, don\'t multiply the values by 4.
621
622  - if:
623      properties:
624        compatible:
625          contains:
626            enum:
627              - allwinner,sun7i-a20-gmac
628              - allwinner,sun8i-a83t-emac
629              - allwinner,sun8i-h3-emac
630              - allwinner,sun8i-r40-gmac
631              - allwinner,sun8i-v3s-emac
632              - allwinner,sun50i-a64-emac
633              - loongson,ls2k-dwmac
634              - loongson,ls7a-dwmac
635              - ingenic,jz4775-mac
636              - ingenic,x1000-mac
637              - ingenic,x1600-mac
638              - ingenic,x1830-mac
639              - ingenic,x2000-mac
640              - qcom,qcs404-ethqos
641              - qcom,sc8280xp-ethqos
642              - qcom,sm8150-ethqos
643              - snps,dwmac-4.00
644              - snps,dwmac-4.10a
645              - snps,dwmac-4.20a
646              - snps,dwmac-5.10a
647              - snps,dwmac-5.20
648              - snps,dwxgmac
649              - snps,dwxgmac-2.10
650              - st,spear600-gmac
651
652    then:
653      properties:
654        snps,tso:
655          $ref: /schemas/types.yaml#/definitions/flag
656          description:
657            Enables the TSO feature otherwise it will be managed by
658            MAC HW capability register.
659
660additionalProperties: true
661
662examples:
663  - |
664    gmac0: ethernet@e0800000 {
665        compatible = "snps,dwxgmac-2.10", "snps,dwxgmac";
666        reg = <0xe0800000 0x8000>;
667        interrupt-parent = <&vic1>;
668        interrupts = <24 23 22>;
669        interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
670        mac-address = [000000000000]; /* Filled in by U-Boot */
671        max-frame-size = <3800>;
672        phy-mode = "gmii";
673        snps,multicast-filter-bins = <256>;
674        snps,perfect-filter-entries = <128>;
675        rx-fifo-depth = <16384>;
676        tx-fifo-depth = <16384>;
677        clocks = <&clock>;
678        clock-names = "stmmaceth";
679        snps,axi-config = <&stmmac_axi_setup>;
680        snps,mtl-rx-config = <&mtl_rx_setup>;
681        snps,mtl-tx-config = <&mtl_tx_setup>;
682
683        stmmac_axi_setup: stmmac-axi-config {
684            snps,wr_osr_lmt = <0xf>;
685            snps,rd_osr_lmt = <0xf>;
686            snps,blen = <256 128 64 32 0 0 0>;
687        };
688
689        mtl_rx_setup: rx-queues-config {
690            snps,rx-queues-to-use = <1>;
691            snps,rx-sched-sp;
692            queue0 {
693                snps,dcb-algorithm;
694                snps,map-to-dma-channel = <0x0>;
695                snps,priority = <0x0>;
696            };
697        };
698
699        mtl_tx_setup: tx-queues-config {
700            snps,tx-queues-to-use = <2>;
701            snps,tx-sched-wrr;
702            queue0 {
703                snps,weight = <0x10>;
704                snps,dcb-algorithm;
705                snps,priority = <0x0>;
706            };
707
708            queue1 {
709                snps,avb-algorithm;
710                snps,send_slope = <0x1000>;
711                snps,idle_slope = <0x1000>;
712                snps,high_credit = <0x3E800>;
713                snps,low_credit = <0xFFC18000>;
714                snps,priority = <0x1>;
715            };
716        };
717
718        mdio0 {
719            #address-cells = <1>;
720            #size-cells = <0>;
721            compatible = "snps,dwmac-mdio";
722            phy1: ethernet-phy@0 {
723                reg = <0>;
724            };
725        };
726    };
727
728# FIXME: We should set it, but it would report all the generic
729# properties as additional properties.
730# additionalProperties: false
731
732...
733