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