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 Device Tree Bindings
8
9maintainers:
10  - Alexandre Torgue <alexandre.torgue@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.50a
25          - snps,dwmac-3.610
26          - snps,dwmac-3.70a
27          - snps,dwmac-3.710
28          - snps,dwmac-4.00
29          - snps,dwmac-4.10a
30          - snps,dwmac-4.20a
31          - snps,dwxgmac
32          - snps,dwxgmac-2.10
33
34          # Deprecated
35          - st,spear600-gmac
36
37  required:
38    - compatible
39
40properties:
41
42  # We need to include all the compatibles from schemas that will
43  # include that schemas, otherwise compatible won't validate for
44  # those.
45  compatible:
46    contains:
47      enum:
48        - allwinner,sun7i-a20-gmac
49        - allwinner,sun8i-a83t-emac
50        - allwinner,sun8i-h3-emac
51        - allwinner,sun8i-r40-emac
52        - allwinner,sun8i-v3s-emac
53        - allwinner,sun50i-a64-emac
54        - loongson,ls2k-dwmac
55        - loongson,ls7a-dwmac
56        - amlogic,meson6-dwmac
57        - amlogic,meson8b-dwmac
58        - amlogic,meson8m2-dwmac
59        - amlogic,meson-gxbb-dwmac
60        - amlogic,meson-axg-dwmac
61        - loongson,ls2k-dwmac
62        - loongson,ls7a-dwmac
63        - ingenic,jz4775-mac
64        - ingenic,x1000-mac
65        - ingenic,x1600-mac
66        - ingenic,x1830-mac
67        - ingenic,x2000-mac
68        - rockchip,px30-gmac
69        - rockchip,rk3128-gmac
70        - rockchip,rk3228-gmac
71        - rockchip,rk3288-gmac
72        - rockchip,rk3328-gmac
73        - rockchip,rk3366-gmac
74        - rockchip,rk3368-gmac
75        - rockchip,rk3399-gmac
76        - rockchip,rv1108-gmac
77        - snps,dwmac
78        - snps,dwmac-3.50a
79        - snps,dwmac-3.610
80        - snps,dwmac-3.70a
81        - snps,dwmac-3.710
82        - snps,dwmac-4.00
83        - snps,dwmac-4.10a
84        - snps,dwmac-4.20a
85        - snps,dwxgmac
86        - snps,dwxgmac-2.10
87
88  reg:
89    minItems: 1
90    maxItems: 2
91
92  interrupts:
93    minItems: 1
94    items:
95      - description: Combined signal for various interrupt events
96      - description: The interrupt to manage the remote wake-up packet detection
97      - description: The interrupt that occurs when Rx exits the LPI state
98
99  interrupt-names:
100    minItems: 1
101    items:
102      - const: macirq
103      - const: eth_wake_irq
104      - const: eth_lpi
105
106  clocks:
107    minItems: 1
108    maxItems: 8
109    additionalItems: true
110    items:
111      - description: GMAC main clock
112      - description: Peripheral registers interface clock
113      - description:
114          PTP reference clock. This clock is used for programming the
115          Timestamp Addend Register. If not passed then the system
116          clock will be used and this is fine on some platforms.
117
118  clock-names:
119    minItems: 1
120    maxItems: 8
121    additionalItems: true
122    contains:
123      enum:
124        - stmmaceth
125        - pclk
126        - ptp_ref
127
128  resets:
129    maxItems: 1
130    description:
131      MAC Reset signal.
132
133  reset-names:
134    const: stmmaceth
135
136  mac-mode:
137    $ref: ethernet-controller.yaml#/properties/phy-connection-type
138    description:
139      The property is identical to 'phy-mode', and assumes that there is mode
140      converter in-between the MAC & PHY (e.g. GMII-to-RGMII). This converter
141      can be passive (no SW requirement), and requires that the MAC operate
142      in a different mode than the PHY in order to function.
143
144  snps,axi-config:
145    $ref: /schemas/types.yaml#/definitions/phandle
146    description:
147      AXI BUS Mode parameters. Phandle to a node that can contain the
148      following properties
149        * snps,lpi_en, enable Low Power Interface
150        * snps,xit_frm, unlock on WoL
151        * snps,wr_osr_lmt, max write outstanding req. limit
152        * snps,rd_osr_lmt, max read outstanding req. limit
153        * snps,kbbe, do not cross 1KiB boundary.
154        * snps,blen, this is a vector of supported burst length.
155        * snps,fb, fixed-burst
156        * snps,mb, mixed-burst
157        * snps,rb, rebuild INCRx Burst
158
159  snps,mtl-rx-config:
160    $ref: /schemas/types.yaml#/definitions/phandle
161    description:
162      Multiple RX Queues parameters. Phandle to a node that can
163      contain the following properties
164        * snps,rx-queues-to-use, number of RX queues to be used in the
165          driver
166        * Choose one of these RX scheduling algorithms
167          * snps,rx-sched-sp, Strict priority
168          * snps,rx-sched-wsp, Weighted Strict priority
169        * For each RX queue
170          * Choose one of these modes
171            * snps,dcb-algorithm, Queue to be enabled as DCB
172            * snps,avb-algorithm, Queue to be enabled as AVB
173          * snps,map-to-dma-channel, Channel to map
174          * Specifiy specific packet routing
175            * snps,route-avcp, AV Untagged Control packets
176            * snps,route-ptp, PTP Packets
177            * snps,route-dcbcp, DCB Control Packets
178            * snps,route-up, Untagged Packets
179            * snps,route-multi-broad, Multicast & Broadcast Packets
180          * snps,priority, bitmask of the tagged frames priorities assigned to
181            the queue
182
183  snps,mtl-tx-config:
184    $ref: /schemas/types.yaml#/definitions/phandle
185    description:
186      Multiple TX Queues parameters. Phandle to a node that can
187      contain the following properties
188        * snps,tx-queues-to-use, number of TX queues to be used in the
189          driver
190        * Choose one of these TX scheduling algorithms
191          * snps,tx-sched-wrr, Weighted Round Robin
192          * snps,tx-sched-wfq, Weighted Fair Queuing
193          * snps,tx-sched-dwrr, Deficit Weighted Round Robin
194          * snps,tx-sched-sp, Strict priority
195        * For each TX queue
196          * snps,weight, TX queue weight (if using a DCB weight
197            algorithm)
198          * Choose one of these modes
199            * snps,dcb-algorithm, TX queue will be working in DCB
200            * snps,avb-algorithm, TX queue will be working in AVB
201              [Attention] Queue 0 is reserved for legacy traffic
202                          and so no AVB is available in this queue.
203          * Configure Credit Base Shaper (if AVB Mode selected)
204            * snps,send_slope, enable Low Power Interface
205            * snps,idle_slope, unlock on WoL
206            * snps,high_credit, max write outstanding req. limit
207            * snps,low_credit, max read outstanding req. limit
208          * snps,priority, bitmask of the priorities assigned to the queue.
209            When a PFC frame is received with priorities matching the bitmask,
210            the queue is blocked from transmitting for the pause time specified
211            in the PFC frame.
212
213  snps,reset-gpio:
214    deprecated: true
215    maxItems: 1
216    description:
217      PHY Reset GPIO
218
219  snps,reset-active-low:
220    deprecated: true
221    $ref: /schemas/types.yaml#/definitions/flag
222    description:
223      Indicates that the PHY Reset is active low
224
225  snps,reset-delays-us:
226    deprecated: true
227    description:
228      Triplet of delays. The 1st cell is reset pre-delay in micro
229      seconds. The 2nd cell is reset pulse in micro seconds. The 3rd
230      cell is reset post-delay in micro seconds.
231    minItems: 3
232    maxItems: 3
233
234  snps,aal:
235    $ref: /schemas/types.yaml#/definitions/flag
236    description:
237      Use Address-Aligned Beats
238
239  snps,fixed-burst:
240    $ref: /schemas/types.yaml#/definitions/flag
241    description:
242      Program the DMA to use the fixed burst mode
243
244  snps,mixed-burst:
245    $ref: /schemas/types.yaml#/definitions/flag
246    description:
247      Program the DMA to use the mixed burst mode
248
249  snps,force_thresh_dma_mode:
250    $ref: /schemas/types.yaml#/definitions/flag
251    description:
252      Force DMA to use the threshold mode for both tx and rx
253
254  snps,force_sf_dma_mode:
255    $ref: /schemas/types.yaml#/definitions/flag
256    description:
257      Force DMA to use the Store and Forward mode for both tx and
258      rx. This flag is ignored if force_thresh_dma_mode is set.
259
260  snps,en-tx-lpi-clockgating:
261    $ref: /schemas/types.yaml#/definitions/flag
262    description:
263      Enable gating of the MAC TX clock during TX low-power mode
264
265  snps,multicast-filter-bins:
266    $ref: /schemas/types.yaml#/definitions/uint32
267    description:
268      Number of multicast filter hash bins supported by this device
269      instance
270
271  snps,perfect-filter-entries:
272    $ref: /schemas/types.yaml#/definitions/uint32
273    description:
274      Number of perfect filter entries supported by this device
275      instance
276
277  snps,ps-speed:
278    $ref: /schemas/types.yaml#/definitions/uint32
279    description:
280      Port selection speed that can be passed to the core when PCS
281      is supported. For example, this is used in case of SGMII and
282      MAC2MAC connection.
283
284  mdio:
285    type: object
286    description:
287      Creates and registers an MDIO bus.
288
289    properties:
290      compatible:
291        const: snps,dwmac-mdio
292
293    required:
294      - compatible
295
296required:
297  - compatible
298  - reg
299  - interrupts
300  - interrupt-names
301  - phy-mode
302
303dependencies:
304  snps,reset-active-low: ["snps,reset-gpio"]
305  snps,reset-delay-us: ["snps,reset-gpio"]
306
307allOf:
308  - $ref: "ethernet-controller.yaml#"
309  - if:
310      properties:
311        compatible:
312          contains:
313            enum:
314              - allwinner,sun7i-a20-gmac
315              - allwinner,sun8i-a83t-emac
316              - allwinner,sun8i-h3-emac
317              - allwinner,sun8i-r40-emac
318              - allwinner,sun8i-v3s-emac
319              - allwinner,sun50i-a64-emac
320              - ingenic,jz4775-mac
321              - ingenic,x1000-mac
322              - ingenic,x1600-mac
323              - ingenic,x1830-mac
324              - ingenic,x2000-mac
325              - snps,dwxgmac
326              - snps,dwxgmac-2.10
327              - st,spear600-gmac
328
329    then:
330      properties:
331        snps,pbl:
332          description:
333            Programmable Burst Length (tx and rx)
334          $ref: /schemas/types.yaml#/definitions/uint32
335          enum: [2, 4, 8]
336
337        snps,txpbl:
338          description:
339            Tx Programmable Burst Length. If set, DMA tx will use this
340            value rather than snps,pbl.
341          $ref: /schemas/types.yaml#/definitions/uint32
342          enum: [2, 4, 8]
343
344        snps,rxpbl:
345          description:
346            Rx Programmable Burst Length. If set, DMA rx will use this
347            value rather than snps,pbl.
348          $ref: /schemas/types.yaml#/definitions/uint32
349          enum: [2, 4, 8]
350
351        snps,no-pbl-x8:
352          $ref: /schemas/types.yaml#/definitions/flag
353          description:
354            Don\'t multiply the pbl/txpbl/rxpbl values by 8. For core
355            rev < 3.50, don\'t multiply the values by 4.
356
357  - if:
358      properties:
359        compatible:
360          contains:
361            enum:
362              - allwinner,sun7i-a20-gmac
363              - allwinner,sun8i-a83t-emac
364              - allwinner,sun8i-h3-emac
365              - allwinner,sun8i-r40-emac
366              - allwinner,sun8i-v3s-emac
367              - allwinner,sun50i-a64-emac
368              - loongson,ls2k-dwmac
369              - loongson,ls7a-dwmac
370              - ingenic,jz4775-mac
371              - ingenic,x1000-mac
372              - ingenic,x1600-mac
373              - ingenic,x1830-mac
374              - ingenic,x2000-mac
375              - snps,dwmac-4.00
376              - snps,dwmac-4.10a
377              - snps,dwmac-4.20a
378              - snps,dwxgmac
379              - snps,dwxgmac-2.10
380              - st,spear600-gmac
381
382    then:
383      properties:
384        snps,tso:
385          $ref: /schemas/types.yaml#/definitions/flag
386          description:
387            Enables the TSO feature otherwise it will be managed by
388            MAC HW capability register.
389
390additionalProperties: true
391
392examples:
393  - |
394    stmmac_axi_setup: stmmac-axi-config {
395        snps,wr_osr_lmt = <0xf>;
396        snps,rd_osr_lmt = <0xf>;
397        snps,blen = <256 128 64 32 0 0 0>;
398    };
399
400    mtl_rx_setup: rx-queues-config {
401        snps,rx-queues-to-use = <1>;
402        snps,rx-sched-sp;
403        queue0 {
404            snps,dcb-algorithm;
405            snps,map-to-dma-channel = <0x0>;
406            snps,priority = <0x0>;
407        };
408    };
409
410    mtl_tx_setup: tx-queues-config {
411        snps,tx-queues-to-use = <2>;
412        snps,tx-sched-wrr;
413        queue0 {
414            snps,weight = <0x10>;
415            snps,dcb-algorithm;
416            snps,priority = <0x0>;
417        };
418
419        queue1 {
420            snps,avb-algorithm;
421            snps,send_slope = <0x1000>;
422            snps,idle_slope = <0x1000>;
423            snps,high_credit = <0x3E800>;
424            snps,low_credit = <0xFFC18000>;
425            snps,priority = <0x1>;
426        };
427    };
428
429    gmac0: ethernet@e0800000 {
430        compatible = "snps,dwxgmac-2.10", "snps,dwxgmac";
431        reg = <0xe0800000 0x8000>;
432        interrupt-parent = <&vic1>;
433        interrupts = <24 23 22>;
434        interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
435        mac-address = [000000000000]; /* Filled in by U-Boot */
436        max-frame-size = <3800>;
437        phy-mode = "gmii";
438        snps,multicast-filter-bins = <256>;
439        snps,perfect-filter-entries = <128>;
440        rx-fifo-depth = <16384>;
441        tx-fifo-depth = <16384>;
442        clocks = <&clock>;
443        clock-names = "stmmaceth";
444        snps,axi-config = <&stmmac_axi_setup>;
445        snps,mtl-rx-config = <&mtl_rx_setup>;
446        snps,mtl-tx-config = <&mtl_tx_setup>;
447        mdio0 {
448            #address-cells = <1>;
449            #size-cells = <0>;
450            compatible = "snps,dwmac-mdio";
451            phy1: ethernet-phy@0 {
452                reg = <0>;
453            };
454        };
455    };
456
457# FIXME: We should set it, but it would report all the generic
458# properties as additional properties.
459# additionalProperties: false
460
461...
462