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
398          snps,coe-unsupported:
399            type: boolean
400            description: TX checksum offload is unsupported by the TX queue.
401
402        allOf:
403          - if:
404              required:
405                - snps,dcb-algorithm
406            then:
407              properties:
408                snps,avb-algorithm: false
409          - if:
410              required:
411                - snps,avb-algorithm
412            then:
413              properties:
414                snps,dcb-algorithm: false
415                snps,weight: false
416        additionalProperties: false
417    additionalProperties: false
418
419  snps,reset-gpio:
420    deprecated: true
421    maxItems: 1
422    description:
423      PHY Reset GPIO
424
425  snps,reset-active-low:
426    deprecated: true
427    $ref: /schemas/types.yaml#/definitions/flag
428    description:
429      Indicates that the PHY Reset is active low
430
431  snps,reset-delays-us:
432    deprecated: true
433    description:
434      Triplet of delays. The 1st cell is reset pre-delay in micro
435      seconds. The 2nd cell is reset pulse in micro seconds. The 3rd
436      cell is reset post-delay in micro seconds.
437    minItems: 3
438    maxItems: 3
439
440  snps,aal:
441    $ref: /schemas/types.yaml#/definitions/flag
442    description:
443      Use Address-Aligned Beats
444
445  snps,fixed-burst:
446    $ref: /schemas/types.yaml#/definitions/flag
447    description:
448      Program the DMA to use the fixed burst mode
449
450  snps,mixed-burst:
451    $ref: /schemas/types.yaml#/definitions/flag
452    description:
453      Program the DMA to use the mixed burst mode
454
455  snps,force_thresh_dma_mode:
456    $ref: /schemas/types.yaml#/definitions/flag
457    description:
458      Force DMA to use the threshold mode for both tx and rx
459
460  snps,force_sf_dma_mode:
461    $ref: /schemas/types.yaml#/definitions/flag
462    description:
463      Force DMA to use the Store and Forward mode for both tx and
464      rx. This flag is ignored if force_thresh_dma_mode is set.
465
466  snps,en-tx-lpi-clockgating:
467    $ref: /schemas/types.yaml#/definitions/flag
468    description:
469      Enable gating of the MAC TX clock during TX low-power mode
470
471  snps,multicast-filter-bins:
472    $ref: /schemas/types.yaml#/definitions/uint32
473    description:
474      Number of multicast filter hash bins supported by this device
475      instance
476
477  snps,perfect-filter-entries:
478    $ref: /schemas/types.yaml#/definitions/uint32
479    description:
480      Number of perfect filter entries supported by this device
481      instance
482
483  snps,ps-speed:
484    $ref: /schemas/types.yaml#/definitions/uint32
485    description:
486      Port selection speed that can be passed to the core when PCS
487      is supported. For example, this is used in case of SGMII and
488      MAC2MAC connection.
489
490  snps,clk-csr:
491    $ref: /schemas/types.yaml#/definitions/uint32
492    description:
493      Frequency division factor for MDC clock.
494
495  mdio:
496    $ref: mdio.yaml#
497    unevaluatedProperties: false
498    description:
499      Creates and registers an MDIO bus.
500
501    properties:
502      compatible:
503        const: snps,dwmac-mdio
504
505    required:
506      - compatible
507
508  stmmac-axi-config:
509    type: object
510    unevaluatedProperties: false
511    description:
512      AXI BUS Mode parameters.
513
514    properties:
515      snps,lpi_en:
516        $ref: /schemas/types.yaml#/definitions/flag
517        description:
518          enable Low Power Interface
519
520      snps,xit_frm:
521        $ref: /schemas/types.yaml#/definitions/flag
522        description:
523          unlock on WoL
524
525      snps,wr_osr_lmt:
526        $ref: /schemas/types.yaml#/definitions/uint32
527        description:
528          max write outstanding req. limit
529
530      snps,rd_osr_lmt:
531        $ref: /schemas/types.yaml#/definitions/uint32
532        description:
533          max read outstanding req. limit
534
535      snps,kbbe:
536        $ref: /schemas/types.yaml#/definitions/uint32
537        description:
538          do not cross 1KiB boundary.
539
540      snps,blen:
541        $ref: /schemas/types.yaml#/definitions/uint32-array
542        description:
543          this is a vector of supported burst length.
544        minItems: 7
545        maxItems: 7
546
547      snps,fb:
548        $ref: /schemas/types.yaml#/definitions/flag
549        description:
550          fixed-burst
551
552      snps,mb:
553        $ref: /schemas/types.yaml#/definitions/flag
554        description:
555          mixed-burst
556
557      snps,rb:
558        $ref: /schemas/types.yaml#/definitions/flag
559        description:
560          rebuild INCRx Burst
561
562required:
563  - compatible
564  - reg
565  - interrupts
566  - interrupt-names
567  - phy-mode
568
569dependencies:
570  snps,reset-active-low: ["snps,reset-gpio"]
571  snps,reset-delays-us: ["snps,reset-gpio"]
572
573allOf:
574  - $ref: ethernet-controller.yaml#
575  - if:
576      properties:
577        compatible:
578          contains:
579            enum:
580              - allwinner,sun7i-a20-gmac
581              - allwinner,sun8i-a83t-emac
582              - allwinner,sun8i-h3-emac
583              - allwinner,sun8i-r40-gmac
584              - allwinner,sun8i-v3s-emac
585              - allwinner,sun50i-a64-emac
586              - ingenic,jz4775-mac
587              - ingenic,x1000-mac
588              - ingenic,x1600-mac
589              - ingenic,x1830-mac
590              - ingenic,x2000-mac
591              - qcom,sa8775p-ethqos
592              - qcom,sc8280xp-ethqos
593              - snps,dwmac-3.50a
594              - snps,dwmac-4.10a
595              - snps,dwmac-4.20a
596              - snps,dwmac-5.20
597              - snps,dwxgmac
598              - snps,dwxgmac-2.10
599              - st,spear600-gmac
600
601    then:
602      properties:
603        snps,pbl:
604          description:
605            Programmable Burst Length (tx and rx)
606          $ref: /schemas/types.yaml#/definitions/uint32
607          enum: [1, 2, 4, 8, 16, 32]
608
609        snps,txpbl:
610          description:
611            Tx Programmable Burst Length. If set, DMA tx 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,rxpbl:
617          description:
618            Rx Programmable Burst Length. If set, DMA rx will use this
619            value rather than snps,pbl.
620          $ref: /schemas/types.yaml#/definitions/uint32
621          enum: [1, 2, 4, 8, 16, 32]
622
623        snps,no-pbl-x8:
624          $ref: /schemas/types.yaml#/definitions/flag
625          description:
626            Don\'t multiply the pbl/txpbl/rxpbl values by 8. For core
627            rev < 3.50, don\'t multiply the values by 4.
628
629  - if:
630      properties:
631        compatible:
632          contains:
633            enum:
634              - allwinner,sun7i-a20-gmac
635              - allwinner,sun8i-a83t-emac
636              - allwinner,sun8i-h3-emac
637              - allwinner,sun8i-r40-gmac
638              - allwinner,sun8i-v3s-emac
639              - allwinner,sun50i-a64-emac
640              - loongson,ls2k-dwmac
641              - loongson,ls7a-dwmac
642              - ingenic,jz4775-mac
643              - ingenic,x1000-mac
644              - ingenic,x1600-mac
645              - ingenic,x1830-mac
646              - ingenic,x2000-mac
647              - qcom,qcs404-ethqos
648              - qcom,sa8775p-ethqos
649              - qcom,sc8280xp-ethqos
650              - qcom,sm8150-ethqos
651              - snps,dwmac-4.00
652              - snps,dwmac-4.10a
653              - snps,dwmac-4.20a
654              - snps,dwmac-5.10a
655              - snps,dwmac-5.20
656              - snps,dwxgmac
657              - snps,dwxgmac-2.10
658              - st,spear600-gmac
659
660    then:
661      properties:
662        snps,tso:
663          $ref: /schemas/types.yaml#/definitions/flag
664          description:
665            Enables the TSO feature otherwise it will be managed by
666            MAC HW capability register.
667
668additionalProperties: true
669
670examples:
671  - |
672    gmac0: ethernet@e0800000 {
673        compatible = "snps,dwxgmac-2.10", "snps,dwxgmac";
674        reg = <0xe0800000 0x8000>;
675        interrupt-parent = <&vic1>;
676        interrupts = <24 23 22>;
677        interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
678        mac-address = [000000000000]; /* Filled in by U-Boot */
679        max-frame-size = <3800>;
680        phy-mode = "gmii";
681        snps,multicast-filter-bins = <256>;
682        snps,perfect-filter-entries = <128>;
683        rx-fifo-depth = <16384>;
684        tx-fifo-depth = <16384>;
685        clocks = <&clock>;
686        clock-names = "stmmaceth";
687        snps,axi-config = <&stmmac_axi_setup>;
688        snps,mtl-rx-config = <&mtl_rx_setup>;
689        snps,mtl-tx-config = <&mtl_tx_setup>;
690
691        stmmac_axi_setup: stmmac-axi-config {
692            snps,wr_osr_lmt = <0xf>;
693            snps,rd_osr_lmt = <0xf>;
694            snps,blen = <256 128 64 32 0 0 0>;
695        };
696
697        mtl_rx_setup: rx-queues-config {
698            snps,rx-queues-to-use = <1>;
699            snps,rx-sched-sp;
700            queue0 {
701                snps,dcb-algorithm;
702                snps,map-to-dma-channel = <0x0>;
703                snps,priority = <0x0>;
704            };
705        };
706
707        mtl_tx_setup: tx-queues-config {
708            snps,tx-queues-to-use = <2>;
709            snps,tx-sched-wrr;
710            queue0 {
711                snps,weight = <0x10>;
712                snps,dcb-algorithm;
713                snps,priority = <0x0>;
714            };
715
716            queue1 {
717                snps,avb-algorithm;
718                snps,send_slope = <0x1000>;
719                snps,idle_slope = <0x1000>;
720                snps,high_credit = <0x3E800>;
721                snps,low_credit = <0xFFC18000>;
722                snps,priority = <0x1>;
723            };
724        };
725
726        mdio0 {
727            #address-cells = <1>;
728            #size-cells = <0>;
729            compatible = "snps,dwmac-mdio";
730            phy1: ethernet-phy@0 {
731                reg = <0>;
732            };
733        };
734    };
735
736# FIXME: We should set it, but it would report all the generic
737# properties as additional properties.
738# additionalProperties: false
739
740...
741