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