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