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