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