1# SPDX-License-Identifier: GPL-2.0-only
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/connector/usb-connector.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: USB Connector
8
9maintainers:
10  - Rob Herring <robh@kernel.org>
11
12description:
13  A USB connector node represents a physical USB connector. It should be a child
14  of a USB interface controller.
15
16properties:
17  compatible:
18    oneOf:
19      - enum:
20          - usb-a-connector
21          - usb-b-connector
22          - usb-c-connector
23
24      - items:
25          - const: gpio-usb-b-connector
26          - const: usb-b-connector
27
28  label:
29    description: Symbolic name for the connector.
30
31  type:
32    description: Size of the connector, should be specified in case of
33      non-fullsize 'usb-a-connector' or 'usb-b-connector' compatible
34      connectors.
35    $ref: /schemas/types.yaml#definitions/string
36
37    enum:
38      - mini
39      - micro
40
41  self-powered:
42    description: Set this property if the USB device has its own power source.
43    type: boolean
44
45  # The following are optional properties for "usb-b-connector".
46  id-gpios:
47    description: An input gpio for USB ID pin.
48    maxItems: 1
49
50  vbus-gpios:
51    description: An input gpio for USB VBus pin, used to detect presence of
52      VBUS 5V.
53    maxItems: 1
54
55  vbus-supply:
56    description: A phandle to the regulator for USB VBUS if needed when host
57      mode or dual role mode is supported.
58      Particularly, if use an output GPIO to control a VBUS regulator, should
59      model it as a regulator. See bindings/regulator/fixed-regulator.yaml
60
61  # The following are optional properties for "usb-c-connector".
62  power-role:
63    description: Determines the power role that the Type C connector will
64      support. "dual" refers to Dual Role Port (DRP).
65    $ref: /schemas/types.yaml#definitions/string
66
67    enum:
68      - source
69      - sink
70      - dual
71
72  try-power-role:
73    description: Preferred power role.
74    $ref: /schemas/types.yaml#definitions/string
75
76    enum:
77      - source
78      - sink
79      - dual
80
81  data-role:
82    description: Data role if Type C connector supports USB data. "dual" refers
83      Dual Role Device (DRD).
84    $ref: /schemas/types.yaml#definitions/string
85
86    enum:
87      - host
88      - device
89      - dual
90
91  # The following are optional properties for "usb-c-connector" with power
92  # delivery support.
93  source-pdos:
94    description: An array of u32 with each entry providing supported power
95      source data object(PDO), the detailed bit definitions of PDO can be found
96      in "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.2
97      Source_Capabilities Message, the order of each entry(PDO) should follow
98      the PD spec chapter 6.4.1. Required for power source and power dual role.
99      User can specify the source PDO array via PDO_FIXED/BATT/VAR/PPS_APDO()
100      defined in dt-bindings/usb/pd.h.
101    minItems: 1
102    maxItems: 7
103    $ref: /schemas/types.yaml#/definitions/uint32-array
104
105  sink-pdos:
106    description: An array of u32 with each entry providing supported power sink
107      data object(PDO), the detailed bit definitions of PDO can be found in
108      "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.3
109      Sink Capabilities Message, the order of each entry(PDO) should follow the
110      PD spec chapter 6.4.1. Required for power sink and power dual role. User
111      can specify the sink PDO array via PDO_FIXED/BATT/VAR/PPS_APDO() defined
112      in dt-bindings/usb/pd.h.
113    minItems: 1
114    maxItems: 7
115    $ref: /schemas/types.yaml#/definitions/uint32-array
116
117  op-sink-microwatt:
118    description: Sink required operating power in microwatt, if source can't
119      offer the power, Capability Mismatch is set. Required for power sink and
120      power dual role.
121
122  ports:
123    description: OF graph bindings (specified in bindings/graph.txt) that model
124      any data bus to the connector unless the bus is between parent node and
125      the connector. Since a single connector can have multiple data buses every
126      bus has an assigned OF graph port number as described below.
127    type: object
128    properties:
129      port@0:
130        type: object
131        description: High Speed (HS), present in all connectors.
132
133      port@1:
134        type: object
135        description: Super Speed (SS), present in SS capable connectors.
136
137      port@2:
138        type: object
139        description: Sideband Use (SBU), present in USB-C. This describes the
140          alternate mode connection of which SBU is a part.
141
142    required:
143      - port@0
144
145required:
146  - compatible
147
148allOf:
149  - if:
150      properties:
151        compatible:
152          contains:
153            const: gpio-usb-b-connector
154    then:
155      anyOf:
156        - required:
157            - vbus-gpios
158        - required:
159            - id-gpios
160
161examples:
162  # Micro-USB connector with HS lines routed via controller (MUIC).
163  - |
164    muic-max77843 {
165      usb_con1: connector {
166        compatible = "usb-b-connector";
167        label = "micro-USB";
168        type = "micro";
169      };
170    };
171
172  # USB-C connector attached to CC controller (s2mm005), HS lines routed
173  # to companion PMIC (max77865), SS lines to USB3 PHY and SBU to DisplayPort.
174  # DisplayPort video lines are routed to the connector via SS mux in USB3 PHY.
175  - |
176    ccic: s2mm005 {
177      usb_con2: connector {
178        compatible = "usb-c-connector";
179        label = "USB-C";
180
181        ports {
182          #address-cells = <1>;
183          #size-cells = <0>;
184
185          port@0 {
186            reg = <0>;
187            usb_con_hs: endpoint {
188              remote-endpoint = <&max77865_usbc_hs>;
189            };
190          };
191          port@1 {
192            reg = <1>;
193            usb_con_ss: endpoint {
194              remote-endpoint = <&usbdrd_phy_ss>;
195            };
196          };
197          port@2 {
198            reg = <2>;
199            usb_con_sbu: endpoint {
200              remote-endpoint = <&dp_aux>;
201            };
202          };
203        };
204      };
205    };
206
207  # USB-C connector attached to a typec port controller(ptn5110), which has
208  # power delivery support and enables drp.
209  - |
210    #include <dt-bindings/usb/pd.h>
211    typec: ptn5110 {
212      usb_con3: connector {
213        compatible = "usb-c-connector";
214        label = "USB-C";
215        power-role = "dual";
216        try-power-role = "sink";
217        source-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)>;
218        sink-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)
219                     PDO_VAR(5000, 12000, 2000)>;
220        op-sink-microwatt = <10000000>;
221      };
222    };
223
224  # USB connector with GPIO control lines
225  - |
226    #include <dt-bindings/gpio/gpio.h>
227
228    usb {
229      connector {
230        compatible = "gpio-usb-b-connector", "usb-b-connector";
231        type = "micro";
232        id-gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
233        vbus-supply = <&usb_p0_vbus>;
234      };
235    };
236