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