xref: /freebsd/sys/contrib/device-tree/Bindings/net/mediatek-dwmac.yaml (revision aa1a8ff2d6dbc51ef058f46f3db5a8bb77967145)
1c9ccf3a3SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2c9ccf3a3SEmmanuel Vadot%YAML 1.2
3c9ccf3a3SEmmanuel Vadot---
4c9ccf3a3SEmmanuel Vadot$id: http://devicetree.org/schemas/net/mediatek-dwmac.yaml#
5c9ccf3a3SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6c9ccf3a3SEmmanuel Vadot
7c9ccf3a3SEmmanuel Vadottitle: MediaTek DWMAC glue layer controller
8c9ccf3a3SEmmanuel Vadot
9c9ccf3a3SEmmanuel Vadotmaintainers:
10c9ccf3a3SEmmanuel Vadot  - Biao Huang <biao.huang@mediatek.com>
11c9ccf3a3SEmmanuel Vadot
12c9ccf3a3SEmmanuel Vadotdescription:
13c9ccf3a3SEmmanuel Vadot  This file documents platform glue layer for stmmac.
14c9ccf3a3SEmmanuel Vadot
15c9ccf3a3SEmmanuel Vadot# We need a select here so we don't match all nodes with 'snps,dwmac'
16c9ccf3a3SEmmanuel Vadotselect:
17c9ccf3a3SEmmanuel Vadot  properties:
18c9ccf3a3SEmmanuel Vadot    compatible:
19c9ccf3a3SEmmanuel Vadot      contains:
20c9ccf3a3SEmmanuel Vadot        enum:
21c9ccf3a3SEmmanuel Vadot          - mediatek,mt2712-gmac
227ef62cebSEmmanuel Vadot          - mediatek,mt8188-gmac
23c9ccf3a3SEmmanuel Vadot          - mediatek,mt8195-gmac
24c9ccf3a3SEmmanuel Vadot  required:
25c9ccf3a3SEmmanuel Vadot    - compatible
26c9ccf3a3SEmmanuel Vadot
27c9ccf3a3SEmmanuel VadotallOf:
28f126890aSEmmanuel Vadot  - $ref: snps,dwmac.yaml#
29c9ccf3a3SEmmanuel Vadot
30c9ccf3a3SEmmanuel Vadotproperties:
31c9ccf3a3SEmmanuel Vadot  compatible:
32c9ccf3a3SEmmanuel Vadot    oneOf:
33c9ccf3a3SEmmanuel Vadot      - items:
34c9ccf3a3SEmmanuel Vadot          - enum:
35c9ccf3a3SEmmanuel Vadot              - mediatek,mt2712-gmac
36c9ccf3a3SEmmanuel Vadot          - const: snps,dwmac-4.20a
37c9ccf3a3SEmmanuel Vadot      - items:
38c9ccf3a3SEmmanuel Vadot          - enum:
39c9ccf3a3SEmmanuel Vadot              - mediatek,mt8195-gmac
40c9ccf3a3SEmmanuel Vadot          - const: snps,dwmac-5.10a
417ef62cebSEmmanuel Vadot      - items:
427ef62cebSEmmanuel Vadot          - enum:
437ef62cebSEmmanuel Vadot              - mediatek,mt8188-gmac
447ef62cebSEmmanuel Vadot          - const: mediatek,mt8195-gmac
457ef62cebSEmmanuel Vadot          - const: snps,dwmac-5.10a
46c9ccf3a3SEmmanuel Vadot
47c9ccf3a3SEmmanuel Vadot  clocks:
48c9ccf3a3SEmmanuel Vadot    minItems: 5
49c9ccf3a3SEmmanuel Vadot    items:
50c9ccf3a3SEmmanuel Vadot      - description: AXI clock
51c9ccf3a3SEmmanuel Vadot      - description: APB clock
52c9ccf3a3SEmmanuel Vadot      - description: MAC Main clock
53c9ccf3a3SEmmanuel Vadot      - description: PTP clock
54c9ccf3a3SEmmanuel Vadot      - description: RMII reference clock provided by MAC
55c9ccf3a3SEmmanuel Vadot      - description: MAC clock gate
56c9ccf3a3SEmmanuel Vadot
57c9ccf3a3SEmmanuel Vadot  clock-names:
58c9ccf3a3SEmmanuel Vadot    minItems: 5
59c9ccf3a3SEmmanuel Vadot    items:
60c9ccf3a3SEmmanuel Vadot      - const: axi
61c9ccf3a3SEmmanuel Vadot      - const: apb
62c9ccf3a3SEmmanuel Vadot      - const: mac_main
63c9ccf3a3SEmmanuel Vadot      - const: ptp_ref
64c9ccf3a3SEmmanuel Vadot      - const: rmii_internal
65c9ccf3a3SEmmanuel Vadot      - const: mac_cg
66c9ccf3a3SEmmanuel Vadot
67d5b0e70fSEmmanuel Vadot  power-domains:
68d5b0e70fSEmmanuel Vadot    maxItems: 1
69d5b0e70fSEmmanuel Vadot
70c9ccf3a3SEmmanuel Vadot  mediatek,pericfg:
71c9ccf3a3SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/phandle
72c9ccf3a3SEmmanuel Vadot    description:
73c9ccf3a3SEmmanuel Vadot      The phandle to the syscon node that control ethernet
74c9ccf3a3SEmmanuel Vadot      interface and timing delay.
75c9ccf3a3SEmmanuel Vadot
76c9ccf3a3SEmmanuel Vadot  mediatek,tx-delay-ps:
77c9ccf3a3SEmmanuel Vadot    description:
78c9ccf3a3SEmmanuel Vadot      The internal TX clock delay (provided by this driver) in nanoseconds.
79c9ccf3a3SEmmanuel Vadot      For MT2712 RGMII interface, Allowed value need to be a multiple of 170,
80c9ccf3a3SEmmanuel Vadot      or will round down. Range 0~31*170.
81c9ccf3a3SEmmanuel Vadot      For MT2712 RMII/MII interface, Allowed value need to be a multiple of 550,
82c9ccf3a3SEmmanuel Vadot      or will round down. Range 0~31*550.
837ef62cebSEmmanuel Vadot      For MT8188/MT8195 RGMII/RMII/MII interface, Allowed value need to be a multiple of 290,
84c9ccf3a3SEmmanuel Vadot      or will round down. Range 0~31*290.
85c9ccf3a3SEmmanuel Vadot
86c9ccf3a3SEmmanuel Vadot  mediatek,rx-delay-ps:
87c9ccf3a3SEmmanuel Vadot    description:
88c9ccf3a3SEmmanuel Vadot      The internal RX clock delay (provided by this driver) in nanoseconds.
89c9ccf3a3SEmmanuel Vadot      For MT2712 RGMII interface, Allowed value need to be a multiple of 170,
90c9ccf3a3SEmmanuel Vadot      or will round down. Range 0~31*170.
91c9ccf3a3SEmmanuel Vadot      For MT2712 RMII/MII interface, Allowed value need to be a multiple of 550,
92c9ccf3a3SEmmanuel Vadot      or will round down. Range 0~31*550.
937ef62cebSEmmanuel Vadot      For MT8188/MT8195 RGMII/RMII/MII interface, Allowed value need to be a multiple
94c9ccf3a3SEmmanuel Vadot      of 290, or will round down. Range 0~31*290.
95c9ccf3a3SEmmanuel Vadot
96c9ccf3a3SEmmanuel Vadot  mediatek,rmii-rxc:
97c9ccf3a3SEmmanuel Vadot    type: boolean
98c9ccf3a3SEmmanuel Vadot    description:
99c9ccf3a3SEmmanuel Vadot      If present, indicates that the RMII reference clock, which is from external
100c9ccf3a3SEmmanuel Vadot      PHYs, is connected to RXC pin. Otherwise, is connected to TXC pin.
101c9ccf3a3SEmmanuel Vadot
102c9ccf3a3SEmmanuel Vadot  mediatek,rmii-clk-from-mac:
103c9ccf3a3SEmmanuel Vadot    type: boolean
104c9ccf3a3SEmmanuel Vadot    description:
105c9ccf3a3SEmmanuel Vadot      If present, indicates that MAC provides the RMII reference clock, which
106c9ccf3a3SEmmanuel Vadot      outputs to TXC pin only.
107c9ccf3a3SEmmanuel Vadot
108c9ccf3a3SEmmanuel Vadot  mediatek,txc-inverse:
109c9ccf3a3SEmmanuel Vadot    type: boolean
110c9ccf3a3SEmmanuel Vadot    description:
111c9ccf3a3SEmmanuel Vadot      If present, indicates that
112c9ccf3a3SEmmanuel Vadot      1. tx clock will be inversed in MII/RGMII case,
113c9ccf3a3SEmmanuel Vadot      2. tx clock inside MAC will be inversed relative to reference clock
114c9ccf3a3SEmmanuel Vadot         which is from external PHYs in RMII case, and it rarely happen.
115c9ccf3a3SEmmanuel Vadot      3. the reference clock, which outputs to TXC pin will be inversed in RMII case
116c9ccf3a3SEmmanuel Vadot         when the reference clock is from MAC.
117c9ccf3a3SEmmanuel Vadot
118c9ccf3a3SEmmanuel Vadot  mediatek,rxc-inverse:
119c9ccf3a3SEmmanuel Vadot    type: boolean
120c9ccf3a3SEmmanuel Vadot    description:
121c9ccf3a3SEmmanuel Vadot      If present, indicates that
122c9ccf3a3SEmmanuel Vadot      1. rx clock will be inversed in MII/RGMII case.
123c9ccf3a3SEmmanuel Vadot      2. reference clock will be inversed when arrived at MAC in RMII case, when
124c9ccf3a3SEmmanuel Vadot         the reference clock is from external PHYs.
125c9ccf3a3SEmmanuel Vadot      3. the inside clock, which be sent to MAC, will be inversed in RMII case when
126c9ccf3a3SEmmanuel Vadot         the reference clock is from MAC.
127c9ccf3a3SEmmanuel Vadot
128c9ccf3a3SEmmanuel Vadot  mediatek,mac-wol:
129c9ccf3a3SEmmanuel Vadot    type: boolean
130c9ccf3a3SEmmanuel Vadot    description:
131c9ccf3a3SEmmanuel Vadot      If present, indicates that MAC supports WOL(Wake-On-LAN), and MAC WOL will be enabled.
132*aa1a8ff2SEmmanuel Vadot      Otherwise, PHY WOL is preferred.
133c9ccf3a3SEmmanuel Vadot
134c9ccf3a3SEmmanuel Vadotrequired:
135c9ccf3a3SEmmanuel Vadot  - compatible
136c9ccf3a3SEmmanuel Vadot  - reg
137c9ccf3a3SEmmanuel Vadot  - interrupts
138c9ccf3a3SEmmanuel Vadot  - interrupt-names
139c9ccf3a3SEmmanuel Vadot  - clocks
140c9ccf3a3SEmmanuel Vadot  - clock-names
141c9ccf3a3SEmmanuel Vadot  - phy-mode
142c9ccf3a3SEmmanuel Vadot  - mediatek,pericfg
143c9ccf3a3SEmmanuel Vadot
144c9ccf3a3SEmmanuel VadotunevaluatedProperties: false
145c9ccf3a3SEmmanuel Vadot
146c9ccf3a3SEmmanuel Vadotexamples:
147c9ccf3a3SEmmanuel Vadot  - |
148c9ccf3a3SEmmanuel Vadot    #include <dt-bindings/clock/mt2712-clk.h>
149c9ccf3a3SEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
150c9ccf3a3SEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
151c9ccf3a3SEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
152c9ccf3a3SEmmanuel Vadot    #include <dt-bindings/power/mt2712-power.h>
153c9ccf3a3SEmmanuel Vadot
154c9ccf3a3SEmmanuel Vadot    eth: ethernet@1101c000 {
155c9ccf3a3SEmmanuel Vadot        compatible = "mediatek,mt2712-gmac", "snps,dwmac-4.20a";
156c9ccf3a3SEmmanuel Vadot        reg = <0x1101c000 0x1300>;
157c9ccf3a3SEmmanuel Vadot        interrupts = <GIC_SPI 237 IRQ_TYPE_LEVEL_LOW>;
158c9ccf3a3SEmmanuel Vadot        interrupt-names = "macirq";
159c9ccf3a3SEmmanuel Vadot        phy-mode = "rgmii-rxid";
160c9ccf3a3SEmmanuel Vadot        mac-address = [00 55 7b b5 7d f7];
161c9ccf3a3SEmmanuel Vadot        clock-names = "axi",
162c9ccf3a3SEmmanuel Vadot                      "apb",
163c9ccf3a3SEmmanuel Vadot                      "mac_main",
164c9ccf3a3SEmmanuel Vadot                      "ptp_ref",
165c9ccf3a3SEmmanuel Vadot                      "rmii_internal";
166c9ccf3a3SEmmanuel Vadot        clocks = <&pericfg CLK_PERI_GMAC>,
167c9ccf3a3SEmmanuel Vadot                 <&pericfg CLK_PERI_GMAC_PCLK>,
168c9ccf3a3SEmmanuel Vadot                 <&topckgen CLK_TOP_ETHER_125M_SEL>,
169c9ccf3a3SEmmanuel Vadot                 <&topckgen CLK_TOP_ETHER_50M_SEL>,
170c9ccf3a3SEmmanuel Vadot                 <&topckgen CLK_TOP_ETHER_50M_RMII_SEL>;
171c9ccf3a3SEmmanuel Vadot        assigned-clocks = <&topckgen CLK_TOP_ETHER_125M_SEL>,
172c9ccf3a3SEmmanuel Vadot                          <&topckgen CLK_TOP_ETHER_50M_SEL>,
173c9ccf3a3SEmmanuel Vadot                          <&topckgen CLK_TOP_ETHER_50M_RMII_SEL>;
174c9ccf3a3SEmmanuel Vadot        assigned-clock-parents = <&topckgen CLK_TOP_ETHERPLL_125M>,
175c9ccf3a3SEmmanuel Vadot                                 <&topckgen CLK_TOP_APLL1_D3>,
176c9ccf3a3SEmmanuel Vadot                                 <&topckgen CLK_TOP_ETHERPLL_50M>;
177c9ccf3a3SEmmanuel Vadot        power-domains = <&scpsys MT2712_POWER_DOMAIN_AUDIO>;
178c9ccf3a3SEmmanuel Vadot        mediatek,pericfg = <&pericfg>;
179c9ccf3a3SEmmanuel Vadot        mediatek,tx-delay-ps = <1530>;
180c9ccf3a3SEmmanuel Vadot        snps,txpbl = <1>;
181c9ccf3a3SEmmanuel Vadot        snps,rxpbl = <1>;
182c9ccf3a3SEmmanuel Vadot        snps,reset-gpio = <&pio 87 GPIO_ACTIVE_LOW>;
183c9ccf3a3SEmmanuel Vadot        snps,reset-delays-us = <0 10000 10000>;
184c9ccf3a3SEmmanuel Vadot    };
185