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