xref: /freebsd/sys/contrib/device-tree/Bindings/net/mediatek-dwmac.yaml (revision d5b0e70f7e04d971691517ce1304d86a1e367e2e)
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
22c9ccf3a3SEmmanuel Vadot          - mediatek,mt8195-gmac
23c9ccf3a3SEmmanuel Vadot  required:
24c9ccf3a3SEmmanuel Vadot    - compatible
25c9ccf3a3SEmmanuel Vadot
26c9ccf3a3SEmmanuel VadotallOf:
27c9ccf3a3SEmmanuel Vadot  - $ref: "snps,dwmac.yaml#"
28c9ccf3a3SEmmanuel Vadot
29c9ccf3a3SEmmanuel Vadotproperties:
30c9ccf3a3SEmmanuel Vadot  compatible:
31c9ccf3a3SEmmanuel Vadot    oneOf:
32c9ccf3a3SEmmanuel Vadot      - items:
33c9ccf3a3SEmmanuel Vadot          - enum:
34c9ccf3a3SEmmanuel Vadot              - mediatek,mt2712-gmac
35c9ccf3a3SEmmanuel Vadot          - const: snps,dwmac-4.20a
36c9ccf3a3SEmmanuel Vadot      - items:
37c9ccf3a3SEmmanuel Vadot          - enum:
38c9ccf3a3SEmmanuel Vadot              - mediatek,mt8195-gmac
39c9ccf3a3SEmmanuel Vadot          - const: snps,dwmac-5.10a
40c9ccf3a3SEmmanuel Vadot
41c9ccf3a3SEmmanuel Vadot  clocks:
42c9ccf3a3SEmmanuel Vadot    minItems: 5
43c9ccf3a3SEmmanuel Vadot    items:
44c9ccf3a3SEmmanuel Vadot      - description: AXI clock
45c9ccf3a3SEmmanuel Vadot      - description: APB clock
46c9ccf3a3SEmmanuel Vadot      - description: MAC Main clock
47c9ccf3a3SEmmanuel Vadot      - description: PTP clock
48c9ccf3a3SEmmanuel Vadot      - description: RMII reference clock provided by MAC
49c9ccf3a3SEmmanuel Vadot      - description: MAC clock gate
50c9ccf3a3SEmmanuel Vadot
51c9ccf3a3SEmmanuel Vadot  clock-names:
52c9ccf3a3SEmmanuel Vadot    minItems: 5
53c9ccf3a3SEmmanuel Vadot    items:
54c9ccf3a3SEmmanuel Vadot      - const: axi
55c9ccf3a3SEmmanuel Vadot      - const: apb
56c9ccf3a3SEmmanuel Vadot      - const: mac_main
57c9ccf3a3SEmmanuel Vadot      - const: ptp_ref
58c9ccf3a3SEmmanuel Vadot      - const: rmii_internal
59c9ccf3a3SEmmanuel Vadot      - const: mac_cg
60c9ccf3a3SEmmanuel Vadot
61*d5b0e70fSEmmanuel Vadot  power-domains:
62*d5b0e70fSEmmanuel Vadot    maxItems: 1
63*d5b0e70fSEmmanuel Vadot
64c9ccf3a3SEmmanuel Vadot  mediatek,pericfg:
65c9ccf3a3SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/phandle
66c9ccf3a3SEmmanuel Vadot    description:
67c9ccf3a3SEmmanuel Vadot      The phandle to the syscon node that control ethernet
68c9ccf3a3SEmmanuel Vadot      interface and timing delay.
69c9ccf3a3SEmmanuel Vadot
70c9ccf3a3SEmmanuel Vadot  mediatek,tx-delay-ps:
71c9ccf3a3SEmmanuel Vadot    description:
72c9ccf3a3SEmmanuel Vadot      The internal TX clock delay (provided by this driver) in nanoseconds.
73c9ccf3a3SEmmanuel Vadot      For MT2712 RGMII interface, Allowed value need to be a multiple of 170,
74c9ccf3a3SEmmanuel Vadot      or will round down. Range 0~31*170.
75c9ccf3a3SEmmanuel Vadot      For MT2712 RMII/MII interface, Allowed value need to be a multiple of 550,
76c9ccf3a3SEmmanuel Vadot      or will round down. Range 0~31*550.
77c9ccf3a3SEmmanuel Vadot      For MT8195 RGMII/RMII/MII interface, Allowed value need to be a multiple of 290,
78c9ccf3a3SEmmanuel Vadot      or will round down. Range 0~31*290.
79c9ccf3a3SEmmanuel Vadot
80c9ccf3a3SEmmanuel Vadot  mediatek,rx-delay-ps:
81c9ccf3a3SEmmanuel Vadot    description:
82c9ccf3a3SEmmanuel Vadot      The internal RX clock delay (provided by this driver) in nanoseconds.
83c9ccf3a3SEmmanuel Vadot      For MT2712 RGMII interface, Allowed value need to be a multiple of 170,
84c9ccf3a3SEmmanuel Vadot      or will round down. Range 0~31*170.
85c9ccf3a3SEmmanuel Vadot      For MT2712 RMII/MII interface, Allowed value need to be a multiple of 550,
86c9ccf3a3SEmmanuel Vadot      or will round down. Range 0~31*550.
87c9ccf3a3SEmmanuel Vadot      For MT8195 RGMII/RMII/MII interface, Allowed value need to be a multiple
88c9ccf3a3SEmmanuel Vadot      of 290, or will round down. Range 0~31*290.
89c9ccf3a3SEmmanuel Vadot
90c9ccf3a3SEmmanuel Vadot  mediatek,rmii-rxc:
91c9ccf3a3SEmmanuel Vadot    type: boolean
92c9ccf3a3SEmmanuel Vadot    description:
93c9ccf3a3SEmmanuel Vadot      If present, indicates that the RMII reference clock, which is from external
94c9ccf3a3SEmmanuel Vadot      PHYs, is connected to RXC pin. Otherwise, is connected to TXC pin.
95c9ccf3a3SEmmanuel Vadot
96c9ccf3a3SEmmanuel Vadot  mediatek,rmii-clk-from-mac:
97c9ccf3a3SEmmanuel Vadot    type: boolean
98c9ccf3a3SEmmanuel Vadot    description:
99c9ccf3a3SEmmanuel Vadot      If present, indicates that MAC provides the RMII reference clock, which
100c9ccf3a3SEmmanuel Vadot      outputs to TXC pin only.
101c9ccf3a3SEmmanuel Vadot
102c9ccf3a3SEmmanuel Vadot  mediatek,txc-inverse:
103c9ccf3a3SEmmanuel Vadot    type: boolean
104c9ccf3a3SEmmanuel Vadot    description:
105c9ccf3a3SEmmanuel Vadot      If present, indicates that
106c9ccf3a3SEmmanuel Vadot      1. tx clock will be inversed in MII/RGMII case,
107c9ccf3a3SEmmanuel Vadot      2. tx clock inside MAC will be inversed relative to reference clock
108c9ccf3a3SEmmanuel Vadot         which is from external PHYs in RMII case, and it rarely happen.
109c9ccf3a3SEmmanuel Vadot      3. the reference clock, which outputs to TXC pin will be inversed in RMII case
110c9ccf3a3SEmmanuel Vadot         when the reference clock is from MAC.
111c9ccf3a3SEmmanuel Vadot
112c9ccf3a3SEmmanuel Vadot  mediatek,rxc-inverse:
113c9ccf3a3SEmmanuel Vadot    type: boolean
114c9ccf3a3SEmmanuel Vadot    description:
115c9ccf3a3SEmmanuel Vadot      If present, indicates that
116c9ccf3a3SEmmanuel Vadot      1. rx clock will be inversed in MII/RGMII case.
117c9ccf3a3SEmmanuel Vadot      2. reference clock will be inversed when arrived at MAC in RMII case, when
118c9ccf3a3SEmmanuel Vadot         the reference clock is from external PHYs.
119c9ccf3a3SEmmanuel Vadot      3. the inside clock, which be sent to MAC, will be inversed in RMII case when
120c9ccf3a3SEmmanuel Vadot         the reference clock is from MAC.
121c9ccf3a3SEmmanuel Vadot
122c9ccf3a3SEmmanuel Vadot  mediatek,mac-wol:
123c9ccf3a3SEmmanuel Vadot    type: boolean
124c9ccf3a3SEmmanuel Vadot    description:
125c9ccf3a3SEmmanuel Vadot      If present, indicates that MAC supports WOL(Wake-On-LAN), and MAC WOL will be enabled.
126c9ccf3a3SEmmanuel Vadot      Otherwise, PHY WOL is perferred.
127c9ccf3a3SEmmanuel Vadot
128c9ccf3a3SEmmanuel Vadotrequired:
129c9ccf3a3SEmmanuel Vadot  - compatible
130c9ccf3a3SEmmanuel Vadot  - reg
131c9ccf3a3SEmmanuel Vadot  - interrupts
132c9ccf3a3SEmmanuel Vadot  - interrupt-names
133c9ccf3a3SEmmanuel Vadot  - clocks
134c9ccf3a3SEmmanuel Vadot  - clock-names
135c9ccf3a3SEmmanuel Vadot  - phy-mode
136c9ccf3a3SEmmanuel Vadot  - mediatek,pericfg
137c9ccf3a3SEmmanuel Vadot
138c9ccf3a3SEmmanuel VadotunevaluatedProperties: false
139c9ccf3a3SEmmanuel Vadot
140c9ccf3a3SEmmanuel Vadotexamples:
141c9ccf3a3SEmmanuel Vadot  - |
142c9ccf3a3SEmmanuel Vadot    #include <dt-bindings/clock/mt2712-clk.h>
143c9ccf3a3SEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
144c9ccf3a3SEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
145c9ccf3a3SEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
146c9ccf3a3SEmmanuel Vadot    #include <dt-bindings/power/mt2712-power.h>
147c9ccf3a3SEmmanuel Vadot
148c9ccf3a3SEmmanuel Vadot    eth: ethernet@1101c000 {
149c9ccf3a3SEmmanuel Vadot        compatible = "mediatek,mt2712-gmac", "snps,dwmac-4.20a";
150c9ccf3a3SEmmanuel Vadot        reg = <0x1101c000 0x1300>;
151c9ccf3a3SEmmanuel Vadot        interrupts = <GIC_SPI 237 IRQ_TYPE_LEVEL_LOW>;
152c9ccf3a3SEmmanuel Vadot        interrupt-names = "macirq";
153c9ccf3a3SEmmanuel Vadot        phy-mode ="rgmii-rxid";
154c9ccf3a3SEmmanuel Vadot        mac-address = [00 55 7b b5 7d f7];
155c9ccf3a3SEmmanuel Vadot        clock-names = "axi",
156c9ccf3a3SEmmanuel Vadot                      "apb",
157c9ccf3a3SEmmanuel Vadot                      "mac_main",
158c9ccf3a3SEmmanuel Vadot                      "ptp_ref",
159c9ccf3a3SEmmanuel Vadot                      "rmii_internal";
160c9ccf3a3SEmmanuel Vadot        clocks = <&pericfg CLK_PERI_GMAC>,
161c9ccf3a3SEmmanuel Vadot                 <&pericfg CLK_PERI_GMAC_PCLK>,
162c9ccf3a3SEmmanuel Vadot                 <&topckgen CLK_TOP_ETHER_125M_SEL>,
163c9ccf3a3SEmmanuel Vadot                 <&topckgen CLK_TOP_ETHER_50M_SEL>,
164c9ccf3a3SEmmanuel Vadot                 <&topckgen CLK_TOP_ETHER_50M_RMII_SEL>;
165c9ccf3a3SEmmanuel Vadot        assigned-clocks = <&topckgen CLK_TOP_ETHER_125M_SEL>,
166c9ccf3a3SEmmanuel Vadot                          <&topckgen CLK_TOP_ETHER_50M_SEL>,
167c9ccf3a3SEmmanuel Vadot                          <&topckgen CLK_TOP_ETHER_50M_RMII_SEL>;
168c9ccf3a3SEmmanuel Vadot        assigned-clock-parents = <&topckgen CLK_TOP_ETHERPLL_125M>,
169c9ccf3a3SEmmanuel Vadot                                 <&topckgen CLK_TOP_APLL1_D3>,
170c9ccf3a3SEmmanuel Vadot                                 <&topckgen CLK_TOP_ETHERPLL_50M>;
171c9ccf3a3SEmmanuel Vadot        power-domains = <&scpsys MT2712_POWER_DOMAIN_AUDIO>;
172c9ccf3a3SEmmanuel Vadot        mediatek,pericfg = <&pericfg>;
173c9ccf3a3SEmmanuel Vadot        mediatek,tx-delay-ps = <1530>;
174c9ccf3a3SEmmanuel Vadot        snps,txpbl = <1>;
175c9ccf3a3SEmmanuel Vadot        snps,rxpbl = <1>;
176c9ccf3a3SEmmanuel Vadot        snps,reset-gpio = <&pio 87 GPIO_ACTIVE_LOW>;
177c9ccf3a3SEmmanuel Vadot        snps,reset-delays-us = <0 10000 10000>;
178c9ccf3a3SEmmanuel Vadot    };
179