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