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
253efdb924SMartin Blumenstingl          - amlogic,meson-g12a-dwmac
26d5a57e4eSNeil Armstrong  required:
27d5a57e4eSNeil Armstrong    - compatible
28d5a57e4eSNeil Armstrong
29d5a57e4eSNeil ArmstrongallOf:
30d5a57e4eSNeil Armstrong  - $ref: "snps,dwmac.yaml#"
31d5a57e4eSNeil Armstrong  - if:
32d5a57e4eSNeil Armstrong      properties:
33d5a57e4eSNeil Armstrong        compatible:
34d5a57e4eSNeil Armstrong          contains:
35d5a57e4eSNeil Armstrong            enum:
36d5a57e4eSNeil Armstrong              - amlogic,meson8b-dwmac
37d5a57e4eSNeil Armstrong              - amlogic,meson8m2-dwmac
38d5a57e4eSNeil Armstrong              - amlogic,meson-gxbb-dwmac
39d5a57e4eSNeil Armstrong              - amlogic,meson-axg-dwmac
403efdb924SMartin Blumenstingl              - amlogic,meson-g12a-dwmac
41d5a57e4eSNeil Armstrong
42d5a57e4eSNeil Armstrong    then:
43d5a57e4eSNeil Armstrong      properties:
44d5a57e4eSNeil Armstrong        clocks:
45ee0b8e6dSMartin Blumenstingl          minItems: 3
46ee0b8e6dSMartin Blumenstingl          maxItems: 4
47d5a57e4eSNeil Armstrong          items:
48d5a57e4eSNeil Armstrong            - description: GMAC main clock
49d5a57e4eSNeil Armstrong            - description: First parent clock of the internal mux
50d5a57e4eSNeil Armstrong            - description: Second parent clock of the internal mux
51ee0b8e6dSMartin Blumenstingl            - description: The clock which drives the timing adjustment logic
52d5a57e4eSNeil Armstrong
53d5a57e4eSNeil Armstrong        clock-names:
54d5a57e4eSNeil Armstrong          minItems: 3
55ee0b8e6dSMartin Blumenstingl          maxItems: 4
56d5a57e4eSNeil Armstrong          items:
57d5a57e4eSNeil Armstrong            - const: stmmaceth
58d5a57e4eSNeil Armstrong            - const: clkin0
59d5a57e4eSNeil Armstrong            - const: clkin1
60ee0b8e6dSMartin Blumenstingl            - const: timing-adjustment
61d5a57e4eSNeil Armstrong
62d5a57e4eSNeil Armstrong        amlogic,tx-delay-ns:
63*d69c6dddSRob Herring          $ref: /schemas/types.yaml#/definitions/uint32
64d5a57e4eSNeil Armstrong          description:
65d5a57e4eSNeil Armstrong            The internal RGMII TX clock delay (provided by this driver) in
66d5a57e4eSNeil Armstrong            nanoseconds. Allowed values are 0ns, 2ns, 4ns, 6ns.
67d5a57e4eSNeil Armstrong            When phy-mode is set to "rgmii" then the TX delay should be
68d5a57e4eSNeil Armstrong            explicitly configured. When not configured a fallback of 2ns is
69d5a57e4eSNeil Armstrong            used. When the phy-mode is set to either "rgmii-id" or "rgmii-txid"
70d5a57e4eSNeil Armstrong            the TX clock delay is already provided by the PHY. In that case
71d5a57e4eSNeil Armstrong            this property should be set to 0ns (which disables the TX clock
72d5a57e4eSNeil Armstrong            delay in the MAC to prevent the clock from going off because both
73d5a57e4eSNeil Armstrong            PHY and MAC are adding a delay).
74d5a57e4eSNeil Armstrong            Any configuration is ignored when the phy-mode is set to "rmii".
75d5a57e4eSNeil Armstrong
767af4c845SMartin Blumenstingl        amlogic,rx-delay-ns:
777af4c845SMartin Blumenstingl          enum:
787af4c845SMartin Blumenstingl            - 0
797af4c845SMartin Blumenstingl            - 2
807af4c845SMartin Blumenstingl          default: 0
817af4c845SMartin Blumenstingl          description:
827af4c845SMartin Blumenstingl            The internal RGMII RX clock delay (provided by this IP block) in
837af4c845SMartin Blumenstingl            nanoseconds. When phy-mode is set to "rgmii" then the RX delay
847af4c845SMartin Blumenstingl            should be explicitly configured. When the phy-mode is set to
857af4c845SMartin Blumenstingl            either "rgmii-id" or "rgmii-rxid" the RX clock delay is already
867af4c845SMartin Blumenstingl            provided by the PHY. Any configuration is ignored when the
877af4c845SMartin Blumenstingl            phy-mode is set to "rmii".
887af4c845SMartin Blumenstingl
89d5a57e4eSNeil Armstrongproperties:
90d5a57e4eSNeil Armstrong  compatible:
91d5a57e4eSNeil Armstrong    additionalItems: true
92d5a57e4eSNeil Armstrong    maxItems: 3
93d5a57e4eSNeil Armstrong    items:
94d5a57e4eSNeil Armstrong      - enum:
95d5a57e4eSNeil Armstrong          - amlogic,meson6-dwmac
96d5a57e4eSNeil Armstrong          - amlogic,meson8b-dwmac
97d5a57e4eSNeil Armstrong          - amlogic,meson8m2-dwmac
98d5a57e4eSNeil Armstrong          - amlogic,meson-gxbb-dwmac
99d5a57e4eSNeil Armstrong          - amlogic,meson-axg-dwmac
1003efdb924SMartin Blumenstingl          - amlogic,meson-g12a-dwmac
101d5a57e4eSNeil Armstrong    contains:
102d5a57e4eSNeil Armstrong      enum:
103d5a57e4eSNeil Armstrong        - snps,dwmac-3.70a
104d5a57e4eSNeil Armstrong        - snps,dwmac
105d5a57e4eSNeil Armstrong
106d5a57e4eSNeil Armstrong  reg:
107d5a57e4eSNeil Armstrong    items:
108d5a57e4eSNeil Armstrong      - description:
109d5a57e4eSNeil Armstrong          The first register range should be the one of the DWMAC controller
110d5a57e4eSNeil Armstrong      - description:
111d5a57e4eSNeil Armstrong          The second range is is for the Amlogic specific configuration
112d5a57e4eSNeil Armstrong          (for example the PRG_ETHERNET register range on Meson8b and newer)
113d5a57e4eSNeil Armstrong
114d5a57e4eSNeil Armstrongrequired:
115d5a57e4eSNeil Armstrong  - compatible
116d5a57e4eSNeil Armstrong  - reg
117d5a57e4eSNeil Armstrong  - interrupts
118d5a57e4eSNeil Armstrong  - interrupt-names
119d5a57e4eSNeil Armstrong  - clocks
120d5a57e4eSNeil Armstrong  - clock-names
121d5a57e4eSNeil Armstrong  - phy-mode
122d5a57e4eSNeil Armstrong
1236fdc6e23SRob HerringunevaluatedProperties: false
1246fdc6e23SRob Herring
125d5a57e4eSNeil Armstrongexamples:
126d5a57e4eSNeil Armstrong  - |
127d5a57e4eSNeil Armstrong    ethmac: ethernet@c9410000 {
128d5a57e4eSNeil Armstrong         compatible = "amlogic,meson-gxbb-dwmac", "snps,dwmac";
129d5a57e4eSNeil Armstrong         reg = <0xc9410000 0x10000>, <0xc8834540 0x8>;
130d5a57e4eSNeil Armstrong         interrupts = <8>;
131d5a57e4eSNeil Armstrong         interrupt-names = "macirq";
132ee0b8e6dSMartin Blumenstingl         clocks = <&clk_eth>, <&clk_fclk_div2>, <&clk_mpll2>, <&clk_fclk_div2>;
133ee0b8e6dSMartin Blumenstingl         clock-names = "stmmaceth", "clkin0", "clkin1", "timing-adjustment";
134d5a57e4eSNeil Armstrong         phy-mode = "rgmii";
135d5a57e4eSNeil Armstrong    };
136