dt-bindings: usb: mtu3: add support property role-switch-default-mode
[linux-2.6-microblaze.git] / Documentation / devicetree / bindings / usb / mediatek,mtu3.yaml
1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 # Copyright (c) 2020 MediaTek
3 %YAML 1.2
4 ---
5 $id: http://devicetree.org/schemas/usb/mediatek,mtu3.yaml#
6 $schema: http://devicetree.org/meta-schemas/core.yaml#
7
8 title: MediaTek USB3 DRD Controller Device Tree Bindings
9
10 maintainers:
11   - Chunfeng Yun <chunfeng.yun@mediatek.com>
12
13 allOf:
14   - $ref: "usb-drd.yaml"
15
16 description: |
17   The DRD controller has a glue layer IPPC (IP Port Control), and its host is
18   based on xHCI.
19
20 properties:
21   compatible:
22     items:
23       - enum:
24           - mediatek,mt2712-mtu3
25           - mediatek,mt8173-mtu3
26           - mediatek,mt8183-mtu3
27           - mediatek,mt8192-mtu3
28       - const: mediatek,mtu3
29
30   reg:
31     items:
32       - description: the registers of device MAC
33       - description: the registers of IP Port Control
34
35   reg-names:
36     items:
37       - const: mac
38       - const: ippc
39
40   interrupts:
41     maxItems: 1
42
43   power-domains:
44     description: A phandle to USB power domain node to control USB's MTCMOS
45     maxItems: 1
46
47   clocks:
48     minItems: 1
49     items:
50       - description: Controller clock used by normal mode
51       - description: Reference clock used by low power mode etc
52       - description: Mcu bus clock for register access
53       - description: DMA bus clock for data transfer
54
55   clock-names:
56     minItems: 1
57     items:
58       - const: sys_ck  # required, others are optional
59       - const: ref_ck
60       - const: mcu_ck
61       - const: dma_ck
62
63   phys:
64     description:
65       List of all the USB PHYs used, it's better to keep the sequence
66       as the hardware layout.
67     minItems: 1
68     items:
69       - description: USB2/HS PHY    # required, others are optional
70       - description: USB3/SS(P) PHY
71       - description: USB2/HS PHY    # the following for backward compatible
72       - description: USB3/SS(P) PHY
73       - description: USB2/HS PHY
74       - description: USB3/SS(P) PHY
75       - description: USB2/HS PHY
76       - description: USB3/SS(P) PHY
77       - description: USB2/HS PHY
78
79   vusb33-supply:
80     description: Regulator of USB AVDD3.3v
81
82   vbus-supply:
83     deprecated: true
84     description: |
85       Regulator of USB VBUS5v, needed when supports dual-role mode.
86       Particularly, if use an output GPIO to control a VBUS regulator, should
87       model it as a regulator. See bindings/regulator/fixed-regulator.yaml
88       It's considered valid for compatibility reasons, not allowed for
89       new bindings, and put into a usb-connector node.
90
91   dr_mode:
92     enum: [host, peripheral, otg]
93     default: otg
94
95   maximum-speed:
96     enum: [super-speed-plus, super-speed, high-speed, full-speed]
97
98   "#address-cells":
99     enum: [1, 2]
100
101   "#size-cells":
102     enum: [1, 2]
103
104   ranges: true
105
106   extcon:
107     deprecated: true
108     description: |
109       Phandle to the extcon device detecting the IDDIG state, needed
110       when supports dual-role mode.
111       It's considered valid for compatibility reasons, not allowed for
112       new bindings, and use "usb-role-switch" property instead.
113
114   usb-role-switch:
115     $ref: /schemas/types.yaml#/definitions/flag
116     description: Support role switch.
117     type: boolean
118
119   role-switch-default-mode:
120     enum: [host, peripheral]
121     default: host
122
123   connector:
124     $ref: /connector/usb-connector.yaml#
125     description:
126       Connector for dual role switch, especially for "gpio-usb-b-connector"
127     type: object
128
129   port:
130     description:
131       Any connector to the data bus of this controller should be modelled
132       using the OF graph bindings specified, if the "usb-role-switch"
133       property is used. See graph.txt
134     $ref: /schemas/graph.yaml#/properties/port
135
136   enable-manual-drd:
137     $ref: /schemas/types.yaml#/definitions/flag
138     description:
139       supports manual dual-role switch via debugfs; usually used when
140       receptacle is TYPE-A and also wants to support dual-role mode.
141     type: boolean
142
143   wakeup-source:
144     description: enable USB remote wakeup, see power/wakeup-source.txt
145     type: boolean
146
147   mediatek,syscon-wakeup:
148     $ref: /schemas/types.yaml#/definitions/phandle-array
149     maxItems: 1
150     description:
151       A phandle to syscon used to access the register of the USB wakeup glue
152       layer between xHCI and SPM, the field should always be 3 cells long.
153     items:
154       items:
155         - description:
156             The first cell represents a phandle to syscon
157         - description:
158             The second cell represents the register base address of the glue
159             layer in syscon
160         - description: |
161             The third cell represents the hardware version of the glue layer,
162             1 - used by mt8173 etc, revision 1 without following IPM rule;
163             2 - used by mt2712 etc, revision 2 with following IPM rule;
164             101 - used by mt8183, specific 1.01;
165             102 - used by mt8192, specific 1.02;
166           enum: [1, 2, 101, 102]
167
168   mediatek,u3p-dis-msk:
169     $ref: /schemas/types.yaml#/definitions/uint32
170     description: The mask to disable u3ports, bit0 for u3port0,
171       bit1 for u3port1, ... etc
172
173   mediatek,u2p-dis-msk:
174     $ref: /schemas/types.yaml#/definitions/uint32
175     description: The mask to disable u2ports, bit0 for u2port0,
176       bit1 for u2port1, ... etc; but can't disable u2port0 if dual role mode
177       is enabled, so will be skipped in this case.
178
179 # Required child node when support dual-role
180 patternProperties:
181   "^usb@[0-9a-f]+$":
182     type: object
183     $ref: /usb/mediatek,mtk-xhci.yaml#
184     description:
185       The xhci should be added as subnode to mtu3 as shown in the following
186       example if the host mode is enabled.
187
188 dependencies:
189   connector: [ 'usb-role-switch' ]
190   port: [ 'usb-role-switch' ]
191   role-switch-default-mode: [ 'usb-role-switch' ]
192   wakeup-source: [ 'mediatek,syscon-wakeup' ]
193
194 required:
195   - compatible
196   - reg
197   - reg-names
198   - interrupts
199   - clocks
200   - clock-names
201
202 additionalProperties: false
203
204 examples:
205   # Dual role switch by extcon
206   - |
207     #include <dt-bindings/clock/mt8173-clk.h>
208     #include <dt-bindings/interrupt-controller/arm-gic.h>
209     #include <dt-bindings/interrupt-controller/irq.h>
210     #include <dt-bindings/phy/phy.h>
211     #include <dt-bindings/power/mt8173-power.h>
212
213     usb@11271000 {
214         compatible = "mediatek,mt8173-mtu3", "mediatek,mtu3";
215         reg = <0x11271000 0x3000>, <0x11280700 0x0100>;
216         reg-names = "mac", "ippc";
217         interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_LOW>;
218         phys = <&phy_port0 PHY_TYPE_USB3>, <&phy_port1 PHY_TYPE_USB2>;
219         power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
220         clocks = <&topckgen CLK_TOP_USB30_SEL>;
221         clock-names = "sys_ck";
222         vusb33-supply = <&mt6397_vusb_reg>;
223         vbus-supply = <&usb_p0_vbus>;
224         extcon = <&extcon_usb>;
225         dr_mode = "otg";
226         wakeup-source;
227         mediatek,syscon-wakeup = <&pericfg 0x400 1>;
228         #address-cells = <1>;
229         #size-cells = <1>;
230         ranges;
231
232         xhci: usb@11270000 {
233             compatible = "mediatek,mt8173-xhci", "mediatek,mtk-xhci";
234             reg = <0x11270000 0x1000>;
235             reg-names = "mac";
236             interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_LOW>;
237             power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
238             clocks = <&topckgen CLK_TOP_USB30_SEL>, <&clk26m>;
239             clock-names = "sys_ck", "ref_ck";
240             vusb33-supply = <&mt6397_vusb_reg>;
241         };
242     };
243
244   # Dual role switch by gpio-usb-b-connector
245   - |
246     #include <dt-bindings/gpio/gpio.h>
247     #include <dt-bindings/power/mt2712-power.h>
248
249     usb@112c1000 {
250         compatible = "mediatek,mt2712-mtu3", "mediatek,mtu3";
251         reg = <0x112c1000 0x3000>, <0x112d0700 0x0100>;
252         reg-names = "mac", "ippc";
253         interrupts = <GIC_SPI 248 IRQ_TYPE_LEVEL_LOW>;
254         phys = <&u2port2 PHY_TYPE_USB2>;
255         power-domains = <&scpsys MT2712_POWER_DOMAIN_USB2>;
256         clocks = <&topckgen CLK_TOP_USB30_SEL>;
257         clock-names = "sys_ck";
258         dr_mode = "otg";
259         usb-role-switch;
260         #address-cells = <1>;
261         #size-cells = <1>;
262         ranges;
263
264         host0: usb@11270000 {
265             compatible = "mediatek,mt2712-xhci", "mediatek,mtk-xhci";
266             reg = <0x11270000 0x1000>;
267             reg-names = "mac";
268             interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_LOW>;
269             power-domains = <&scpsys MT2712_POWER_DOMAIN_USB>;
270             clocks = <&topckgen CLK_TOP_USB30_SEL>, <&clk26m>;
271             clock-names = "sys_ck", "ref_ck";
272         };
273
274         connector {
275             compatible = "gpio-usb-b-connector", "usb-b-connector";
276             type = "micro";
277             id-gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
278             vbus-supply = <&usb_p0_vbus>;
279         };
280     };
281
282   # Dual role switch with type-c
283   - |
284     usb@11201000 {
285         compatible ="mediatek,mt8183-mtu3", "mediatek,mtu3";
286         reg = <0x11201000 0x2e00>, <0x11203e00 0x0100>;
287         reg-names = "mac", "ippc";
288         interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_LOW>;
289         phys = <&u2port0 PHY_TYPE_USB2>;
290         clocks = <&clk26m>;
291         clock-names = "sys_ck";
292         mediatek,syscon-wakeup = <&pericfg 0x400 1>;
293         wakeup-source;
294         dr_mode = "otg";
295         usb-role-switch;
296         role-switch-default-mode = "host";
297         #address-cells = <1>;
298         #size-cells = <1>;
299         ranges;
300
301         host: usb@11200000 {
302             compatible = "mediatek,mt8183-xhci", "mediatek,mtk-xhci";
303             reg = <0x11200000 0x1000>;
304             reg-names = "mac";
305             interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_LOW>;
306             clocks = <&clk26m>;
307             clock-names = "sys_ck";
308         };
309
310         port {
311             usb_role_sw: endpoint {
312                 remote-endpoint = <&hs_ep>;
313             };
314         };
315     };
316
317 ...