Back to home page

OSCL-LXR

 
 

    


0001 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
0002 # Copyright (c) 2020 MediaTek
0003 %YAML 1.2
0004 ---
0005 $id: http://devicetree.org/schemas/usb/mediatek,mtu3.yaml#
0006 $schema: http://devicetree.org/meta-schemas/core.yaml#
0007 
0008 title: MediaTek USB3 DRD Controller Device Tree Bindings
0009 
0010 maintainers:
0011   - Chunfeng Yun <chunfeng.yun@mediatek.com>
0012 
0013 allOf:
0014   - $ref: "usb-drd.yaml"
0015 
0016 description: |
0017   The DRD controller has a glue layer IPPC (IP Port Control), and its host is
0018   based on xHCI.
0019 
0020 properties:
0021   compatible:
0022     items:
0023       - enum:
0024           - mediatek,mt2712-mtu3
0025           - mediatek,mt8173-mtu3
0026           - mediatek,mt8183-mtu3
0027           - mediatek,mt8188-mtu3
0028           - mediatek,mt8192-mtu3
0029           - mediatek,mt8195-mtu3
0030       - const: mediatek,mtu3
0031 
0032   reg:
0033     items:
0034       - description: the registers of device MAC
0035       - description: the registers of IP Port Control
0036 
0037   reg-names:
0038     items:
0039       - const: mac
0040       - const: ippc
0041 
0042   interrupts:
0043     description:
0044       use "interrupts-extended" when the interrupts are connected to the
0045       separate interrupt controllers
0046     minItems: 1
0047     items:
0048       - description: SSUSB device controller interrupt
0049       - description: optional, wakeup interrupt used to support runtime PM
0050 
0051   interrupt-names:
0052     items:
0053       - const: device
0054       - const: wakeup
0055 
0056   power-domains:
0057     description: A phandle to USB power domain node to control USB's MTCMOS
0058     maxItems: 1
0059 
0060   clocks:
0061     minItems: 1
0062     items:
0063       - description: Controller clock used by normal mode
0064       - description: Reference clock used by low power mode etc
0065       - description: Mcu bus clock for register access
0066       - description: DMA bus clock for data transfer
0067 
0068   clock-names:
0069     minItems: 1
0070     items:
0071       - const: sys_ck  # required, others are optional
0072       - const: ref_ck
0073       - const: mcu_ck
0074       - const: dma_ck
0075 
0076   phys:
0077     description:
0078       List of all the USB PHYs used, it's better to keep the sequence
0079       as the hardware layout.
0080     minItems: 1
0081     items:
0082       - description: USB2/HS PHY    # required, others are optional
0083       - description: USB3/SS(P) PHY
0084       - description: USB2/HS PHY    # the following for backward compatible
0085       - description: USB3/SS(P) PHY
0086       - description: USB2/HS PHY
0087       - description: USB3/SS(P) PHY
0088       - description: USB2/HS PHY
0089       - description: USB3/SS(P) PHY
0090       - description: USB2/HS PHY
0091 
0092   vusb33-supply:
0093     description: Regulator of USB AVDD3.3v
0094 
0095   vbus-supply:
0096     deprecated: true
0097     description: |
0098       Regulator of USB VBUS5v, needed when supports dual-role mode.
0099       Particularly, if use an output GPIO to control a VBUS regulator, should
0100       model it as a regulator. See bindings/regulator/fixed-regulator.yaml
0101       It's considered valid for compatibility reasons, not allowed for
0102       new bindings, and put into a usb-connector node.
0103 
0104   dr_mode:
0105     enum: [host, peripheral, otg]
0106     default: otg
0107 
0108   maximum-speed:
0109     enum: [super-speed-plus, super-speed, high-speed, full-speed]
0110 
0111   resets:
0112     maxItems: 1
0113 
0114   "#address-cells":
0115     enum: [1, 2]
0116 
0117   "#size-cells":
0118     enum: [1, 2]
0119 
0120   ranges: true
0121 
0122   extcon:
0123     deprecated: true
0124     description: |
0125       Phandle to the extcon device detecting the IDDIG state, needed
0126       when supports dual-role mode.
0127       It's considered valid for compatibility reasons, not allowed for
0128       new bindings, and use "usb-role-switch" property instead.
0129 
0130   usb-role-switch:
0131     $ref: /schemas/types.yaml#/definitions/flag
0132     description: Support role switch.
0133     type: boolean
0134 
0135   role-switch-default-mode:
0136     enum: [host, peripheral]
0137     default: host
0138 
0139   connector:
0140     $ref: /schemas/connector/usb-connector.yaml#
0141     description:
0142       Connector for dual role switch, especially for "gpio-usb-b-connector"
0143     type: object
0144 
0145   port:
0146     description:
0147       Any connector to the data bus of this controller should be modelled
0148       using the OF graph bindings specified, if the "usb-role-switch"
0149       property is used. See graph.txt
0150     $ref: /schemas/graph.yaml#/properties/port
0151 
0152   enable-manual-drd:
0153     $ref: /schemas/types.yaml#/definitions/flag
0154     description:
0155       supports manual dual-role switch via debugfs; usually used when
0156       receptacle is TYPE-A and also wants to support dual-role mode.
0157     type: boolean
0158 
0159   wakeup-source:
0160     description: enable USB remote wakeup, see power/wakeup-source.txt
0161     type: boolean
0162 
0163   mediatek,syscon-wakeup:
0164     $ref: /schemas/types.yaml#/definitions/phandle-array
0165     maxItems: 1
0166     description:
0167       A phandle to syscon used to access the register of the USB wakeup glue
0168       layer between xHCI and SPM, the field should always be 3 cells long.
0169     items:
0170       items:
0171         - description:
0172             The first cell represents a phandle to syscon
0173         - description:
0174             The second cell represents the register base address of the glue
0175             layer in syscon
0176         - description: |
0177             The third cell represents the hardware version of the glue layer,
0178             1 - used by mt8173 etc, revision 1 without following IPM rule;
0179             2 - used by mt2712 etc, revision 2 with following IPM rule;
0180             101 - used by mt8183, specific 1.01;
0181             102 - used by mt8192, specific 1.02;
0182           enum: [1, 2, 101, 102]
0183 
0184   mediatek,u3p-dis-msk:
0185     $ref: /schemas/types.yaml#/definitions/uint32
0186     description: The mask to disable u3ports, bit0 for u3port0,
0187       bit1 for u3port1, ... etc
0188 
0189   mediatek,u2p-dis-msk:
0190     $ref: /schemas/types.yaml#/definitions/uint32
0191     description: The mask to disable u2ports, bit0 for u2port0,
0192       bit1 for u2port1, ... etc; but can't disable u2port0 if dual role mode
0193       is enabled, so will be skipped in this case.
0194 
0195 # Required child node when support dual-role
0196 patternProperties:
0197   "^usb@[0-9a-f]+$":
0198     type: object
0199     $ref: /schemas/usb/mediatek,mtk-xhci.yaml#
0200     description:
0201       The xhci should be added as subnode to mtu3 as shown in the following
0202       example if the host mode is enabled.
0203 
0204 dependencies:
0205   connector: [ 'usb-role-switch' ]
0206   port: [ 'usb-role-switch' ]
0207   role-switch-default-mode: [ 'usb-role-switch' ]
0208   wakeup-source: [ 'mediatek,syscon-wakeup' ]
0209 
0210 required:
0211   - compatible
0212   - reg
0213   - reg-names
0214   - interrupts
0215   - clocks
0216   - clock-names
0217 
0218 additionalProperties: false
0219 
0220 examples:
0221   # Dual role switch by extcon
0222   - |
0223     #include <dt-bindings/clock/mt8173-clk.h>
0224     #include <dt-bindings/interrupt-controller/arm-gic.h>
0225     #include <dt-bindings/interrupt-controller/irq.h>
0226     #include <dt-bindings/phy/phy.h>
0227     #include <dt-bindings/power/mt8173-power.h>
0228 
0229     usb@11271000 {
0230         compatible = "mediatek,mt8173-mtu3", "mediatek,mtu3";
0231         reg = <0x11271000 0x3000>, <0x11280700 0x0100>;
0232         reg-names = "mac", "ippc";
0233         interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_LOW>;
0234         phys = <&phy_port0 PHY_TYPE_USB3>, <&phy_port1 PHY_TYPE_USB2>;
0235         power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
0236         clocks = <&topckgen CLK_TOP_USB30_SEL>;
0237         clock-names = "sys_ck";
0238         vusb33-supply = <&mt6397_vusb_reg>;
0239         vbus-supply = <&usb_p0_vbus>;
0240         extcon = <&extcon_usb>;
0241         dr_mode = "otg";
0242         wakeup-source;
0243         mediatek,syscon-wakeup = <&pericfg 0x400 1>;
0244         #address-cells = <1>;
0245         #size-cells = <1>;
0246         ranges;
0247 
0248         xhci: usb@11270000 {
0249             compatible = "mediatek,mt8173-xhci", "mediatek,mtk-xhci";
0250             reg = <0x11270000 0x1000>;
0251             reg-names = "mac";
0252             interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_LOW>;
0253             power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
0254             clocks = <&topckgen CLK_TOP_USB30_SEL>, <&clk26m>;
0255             clock-names = "sys_ck", "ref_ck";
0256             vusb33-supply = <&mt6397_vusb_reg>;
0257         };
0258     };
0259 
0260   # Dual role switch by gpio-usb-b-connector
0261   - |
0262     #include <dt-bindings/gpio/gpio.h>
0263     #include <dt-bindings/power/mt2712-power.h>
0264 
0265     usb@112c1000 {
0266         compatible = "mediatek,mt2712-mtu3", "mediatek,mtu3";
0267         reg = <0x112c1000 0x3000>, <0x112d0700 0x0100>;
0268         reg-names = "mac", "ippc";
0269         interrupts = <GIC_SPI 248 IRQ_TYPE_LEVEL_LOW>;
0270         phys = <&u2port2 PHY_TYPE_USB2>;
0271         power-domains = <&scpsys MT2712_POWER_DOMAIN_USB2>;
0272         clocks = <&topckgen CLK_TOP_USB30_SEL>;
0273         clock-names = "sys_ck";
0274         dr_mode = "otg";
0275         usb-role-switch;
0276         #address-cells = <1>;
0277         #size-cells = <1>;
0278         ranges;
0279 
0280         host0: usb@11270000 {
0281             compatible = "mediatek,mt2712-xhci", "mediatek,mtk-xhci";
0282             reg = <0x11270000 0x1000>;
0283             reg-names = "mac";
0284             interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_LOW>;
0285             power-domains = <&scpsys MT2712_POWER_DOMAIN_USB>;
0286             clocks = <&topckgen CLK_TOP_USB30_SEL>, <&clk26m>;
0287             clock-names = "sys_ck", "ref_ck";
0288         };
0289 
0290         connector {
0291             compatible = "gpio-usb-b-connector", "usb-b-connector";
0292             type = "micro";
0293             id-gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
0294             vbus-supply = <&usb_p0_vbus>;
0295         };
0296     };
0297 
0298   # Dual role switch with type-c
0299   - |
0300     usb@11201000 {
0301         compatible ="mediatek,mt8183-mtu3", "mediatek,mtu3";
0302         reg = <0x11201000 0x2e00>, <0x11203e00 0x0100>;
0303         reg-names = "mac", "ippc";
0304         interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_LOW>;
0305         phys = <&u2port0 PHY_TYPE_USB2>;
0306         clocks = <&clk26m>;
0307         clock-names = "sys_ck";
0308         mediatek,syscon-wakeup = <&pericfg 0x400 1>;
0309         wakeup-source;
0310         dr_mode = "otg";
0311         usb-role-switch;
0312         role-switch-default-mode = "host";
0313         #address-cells = <1>;
0314         #size-cells = <1>;
0315         ranges;
0316 
0317         host: usb@11200000 {
0318             compatible = "mediatek,mt8183-xhci", "mediatek,mtk-xhci";
0319             reg = <0x11200000 0x1000>;
0320             reg-names = "mac";
0321             interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_LOW>;
0322             clocks = <&clk26m>;
0323             clock-names = "sys_ck";
0324         };
0325 
0326         port {
0327             usb_role_sw: endpoint {
0328                 remote-endpoint = <&hs_ep>;
0329             };
0330         };
0331     };
0332 
0333 ...