1d5a57e4eSNeil Armstrong# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2d5a57e4eSNeil Armstrong# Copyright 2019 BayLibre, SAS
3d5a57e4eSNeil Armstrong%YAML 1.2
4d5a57e4eSNeil Armstrong---
5d5a57e4eSNeil Armstrong$id: "http://devicetree.org/schemas/net/amlogic,meson-dwmac.yaml#"
6d5a57e4eSNeil Armstrong$schema: "http://devicetree.org/meta-schemas/core.yaml#"
7d5a57e4eSNeil Armstrong
8d5a57e4eSNeil Armstrongtitle: Amlogic Meson DWMAC Ethernet controller
9d5a57e4eSNeil Armstrong
10d5a57e4eSNeil Armstrongmaintainers:
11d5a57e4eSNeil Armstrong  - Neil Armstrong <narmstrong@baylibre.com>
12d5a57e4eSNeil Armstrong  - Martin Blumenstingl <martin.blumenstingl@googlemail.com>
13d5a57e4eSNeil Armstrong
14d5a57e4eSNeil Armstrong# We need a select here so we don't match all nodes with 'snps,dwmac'
15d5a57e4eSNeil Armstrongselect:
16d5a57e4eSNeil Armstrong  properties:
17d5a57e4eSNeil Armstrong    compatible:
18d5a57e4eSNeil Armstrong      contains:
19d5a57e4eSNeil Armstrong        enum:
20d5a57e4eSNeil Armstrong          - amlogic,meson6-dwmac
21d5a57e4eSNeil Armstrong          - amlogic,meson8b-dwmac
22d5a57e4eSNeil Armstrong          - amlogic,meson8m2-dwmac
23d5a57e4eSNeil Armstrong          - amlogic,meson-gxbb-dwmac
24d5a57e4eSNeil Armstrong          - amlogic,meson-axg-dwmac
25d5a57e4eSNeil Armstrong  required:
26d5a57e4eSNeil Armstrong    - compatible
27d5a57e4eSNeil Armstrong
28d5a57e4eSNeil ArmstrongallOf:
29d5a57e4eSNeil Armstrong  - $ref: "snps,dwmac.yaml#"
30d5a57e4eSNeil Armstrong  - if:
31d5a57e4eSNeil Armstrong      properties:
32d5a57e4eSNeil Armstrong        compatible:
33d5a57e4eSNeil Armstrong          contains:
34d5a57e4eSNeil Armstrong            enum:
35d5a57e4eSNeil Armstrong              - amlogic,meson8b-dwmac
36d5a57e4eSNeil Armstrong              - amlogic,meson8m2-dwmac
37d5a57e4eSNeil Armstrong              - amlogic,meson-gxbb-dwmac
38d5a57e4eSNeil Armstrong              - amlogic,meson-axg-dwmac
39d5a57e4eSNeil Armstrong
40d5a57e4eSNeil Armstrong    then:
41d5a57e4eSNeil Armstrong      properties:
42d5a57e4eSNeil Armstrong        clocks:
43ee0b8e6dSMartin Blumenstingl          minItems: 3
44ee0b8e6dSMartin Blumenstingl          maxItems: 4
45d5a57e4eSNeil Armstrong          items:
46d5a57e4eSNeil Armstrong            - description: GMAC main clock
47d5a57e4eSNeil Armstrong            - description: First parent clock of the internal mux
48d5a57e4eSNeil Armstrong            - description: Second parent clock of the internal mux
49ee0b8e6dSMartin Blumenstingl            - description: The clock which drives the timing adjustment logic
50d5a57e4eSNeil Armstrong
51d5a57e4eSNeil Armstrong        clock-names:
52d5a57e4eSNeil Armstrong          minItems: 3
53ee0b8e6dSMartin Blumenstingl          maxItems: 4
54d5a57e4eSNeil Armstrong          items:
55d5a57e4eSNeil Armstrong            - const: stmmaceth
56d5a57e4eSNeil Armstrong            - const: clkin0
57d5a57e4eSNeil Armstrong            - const: clkin1
58ee0b8e6dSMartin Blumenstingl            - const: timing-adjustment
59d5a57e4eSNeil Armstrong
60d5a57e4eSNeil Armstrong        amlogic,tx-delay-ns:
61d5a57e4eSNeil Armstrong          $ref: /schemas/types.yaml#definitions/uint32
62d5a57e4eSNeil Armstrong          description:
63d5a57e4eSNeil Armstrong            The internal RGMII TX clock delay (provided by this driver) in
64d5a57e4eSNeil Armstrong            nanoseconds. Allowed values are 0ns, 2ns, 4ns, 6ns.
65d5a57e4eSNeil Armstrong            When phy-mode is set to "rgmii" then the TX delay should be
66d5a57e4eSNeil Armstrong            explicitly configured. When not configured a fallback of 2ns is
67d5a57e4eSNeil Armstrong            used. When the phy-mode is set to either "rgmii-id" or "rgmii-txid"
68d5a57e4eSNeil Armstrong            the TX clock delay is already provided by the PHY. In that case
69d5a57e4eSNeil Armstrong            this property should be set to 0ns (which disables the TX clock
70d5a57e4eSNeil Armstrong            delay in the MAC to prevent the clock from going off because both
71d5a57e4eSNeil Armstrong            PHY and MAC are adding a delay).
72d5a57e4eSNeil Armstrong            Any configuration is ignored when the phy-mode is set to "rmii".
73d5a57e4eSNeil Armstrong
747af4c845SMartin Blumenstingl        amlogic,rx-delay-ns:
757af4c845SMartin Blumenstingl          enum:
767af4c845SMartin Blumenstingl            - 0
777af4c845SMartin Blumenstingl            - 2
787af4c845SMartin Blumenstingl          default: 0
797af4c845SMartin Blumenstingl          description:
807af4c845SMartin Blumenstingl            The internal RGMII RX clock delay (provided by this IP block) in
817af4c845SMartin Blumenstingl            nanoseconds. When phy-mode is set to "rgmii" then the RX delay
827af4c845SMartin Blumenstingl            should be explicitly configured. When the phy-mode is set to
837af4c845SMartin Blumenstingl            either "rgmii-id" or "rgmii-rxid" the RX clock delay is already
847af4c845SMartin Blumenstingl            provided by the PHY. Any configuration is ignored when the
857af4c845SMartin Blumenstingl            phy-mode is set to "rmii".
867af4c845SMartin Blumenstingl
87d5a57e4eSNeil Armstrongproperties:
88d5a57e4eSNeil Armstrong  compatible:
89d5a57e4eSNeil Armstrong    additionalItems: true
90d5a57e4eSNeil Armstrong    maxItems: 3
91d5a57e4eSNeil Armstrong    items:
92d5a57e4eSNeil Armstrong      - enum:
93d5a57e4eSNeil Armstrong          - amlogic,meson6-dwmac
94d5a57e4eSNeil Armstrong          - amlogic,meson8b-dwmac
95d5a57e4eSNeil Armstrong          - amlogic,meson8m2-dwmac
96d5a57e4eSNeil Armstrong          - amlogic,meson-gxbb-dwmac
97d5a57e4eSNeil Armstrong          - amlogic,meson-axg-dwmac
98d5a57e4eSNeil Armstrong    contains:
99d5a57e4eSNeil Armstrong      enum:
100d5a57e4eSNeil Armstrong        - snps,dwmac-3.70a
101d5a57e4eSNeil Armstrong        - snps,dwmac
102d5a57e4eSNeil Armstrong
103d5a57e4eSNeil Armstrong  reg:
104d5a57e4eSNeil Armstrong    items:
105d5a57e4eSNeil Armstrong      - description:
106d5a57e4eSNeil Armstrong          The first register range should be the one of the DWMAC controller
107d5a57e4eSNeil Armstrong      - description:
108d5a57e4eSNeil Armstrong          The second range is is for the Amlogic specific configuration
109d5a57e4eSNeil Armstrong          (for example the PRG_ETHERNET register range on Meson8b and newer)
110d5a57e4eSNeil Armstrong
111d5a57e4eSNeil Armstrongrequired:
112d5a57e4eSNeil Armstrong  - compatible
113d5a57e4eSNeil Armstrong  - reg
114d5a57e4eSNeil Armstrong  - interrupts
115d5a57e4eSNeil Armstrong  - interrupt-names
116d5a57e4eSNeil Armstrong  - clocks
117d5a57e4eSNeil Armstrong  - clock-names
118d5a57e4eSNeil Armstrong  - phy-mode
119d5a57e4eSNeil Armstrong
120d5a57e4eSNeil Armstrongexamples:
121d5a57e4eSNeil Armstrong  - |
122d5a57e4eSNeil Armstrong    ethmac: ethernet@c9410000 {
123d5a57e4eSNeil Armstrong         compatible = "amlogic,meson-gxbb-dwmac", "snps,dwmac";
124d5a57e4eSNeil Armstrong         reg = <0xc9410000 0x10000>, <0xc8834540 0x8>;
125d5a57e4eSNeil Armstrong         interrupts = <8>;
126d5a57e4eSNeil Armstrong         interrupt-names = "macirq";
127ee0b8e6dSMartin Blumenstingl         clocks = <&clk_eth>, <&clk_fclk_div2>, <&clk_mpll2>, <&clk_fclk_div2>;
128ee0b8e6dSMartin Blumenstingl         clock-names = "stmmaceth", "clkin0", "clkin1", "timing-adjustment";
129d5a57e4eSNeil Armstrong         phy-mode = "rgmii";
130d5a57e4eSNeil Armstrong    };
131