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