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