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