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 or a separate node when it is attached to both
15  MUX and USB interface controller.
16
17properties:
18  compatible:
19    oneOf:
20      - enum:
21          - usb-a-connector
22          - usb-b-connector
23          - usb-c-connector
24
25      - items:
26          - const: gpio-usb-b-connector
27          - const: usb-b-connector
28
29      - items:
30          - const: samsung,usb-connector-11pin
31          - const: usb-b-connector
32
33  label:
34    description: Symbolic name for the connector.
35
36  type:
37    description: Size of the connector, should be specified in case of
38      non-fullsize 'usb-a-connector' or 'usb-b-connector' compatible
39      connectors.
40    $ref: /schemas/types.yaml#/definitions/string
41
42    enum:
43      - mini
44      - micro
45
46  self-powered:
47    description: Set this property if the USB device has its own power source.
48    type: boolean
49
50  # The following are optional properties for "usb-b-connector".
51  id-gpios:
52    description: An input gpio for USB ID pin.
53    maxItems: 1
54
55  vbus-gpios:
56    description: An input gpio for USB VBus pin, used to detect presence of
57      VBUS 5V.
58    maxItems: 1
59
60  vbus-supply:
61    description: A phandle to the regulator for USB VBUS if needed when host
62      mode or dual role mode is supported.
63      Particularly, if use an output GPIO to control a VBUS regulator, should
64      model it as a regulator. See bindings/regulator/fixed-regulator.yaml
65
66  # The following are optional properties for "usb-c-connector".
67  power-role:
68    description: Determines the power role that the Type C connector will
69      support. "dual" refers to Dual Role Port (DRP).
70    $ref: /schemas/types.yaml#/definitions/string
71
72    enum:
73      - source
74      - sink
75      - dual
76
77  try-power-role:
78    description: Preferred power role.
79    $ref: /schemas/types.yaml#/definitions/string
80
81    enum:
82      - source
83      - sink
84      - dual
85
86  data-role:
87    description: Data role if Type C connector supports USB data. "dual" refers
88      Dual Role Device (DRD).
89    $ref: /schemas/types.yaml#/definitions/string
90
91    enum:
92      - host
93      - device
94      - dual
95
96  typec-power-opmode:
97    description: Determines the power operation mode that the Type C connector
98      will support and will advertise through CC pins when it has no power
99      delivery support.
100      - "default" corresponds to default USB voltage and current defined by the
101        USB 2.0 and USB 3.2 specifications, 5V 500mA for USB 2.0 ports and
102        5V 900mA or 1500mA for USB 3.2 ports in single-lane or dual-lane
103        operation respectively.
104      - "1.5A" and "3.0A", 5V 1.5A and 5V 3.0A respectively, as defined in USB
105        Type-C Cable and Connector specification, when Power Delivery is not
106        supported.
107    allOf:
108      - $ref: /schemas/types.yaml#/definitions/string
109    enum:
110      - default
111      - 1.5A
112      - 3.0A
113
114  pd-disable:
115    description: Set this property if the Type-C connector has no power delivery support.
116    type: boolean
117
118  # The following are optional properties for "usb-c-connector" with power
119  # delivery support.
120  source-pdos:
121    description: An array of u32 with each entry providing supported power
122      source data object(PDO), the detailed bit definitions of PDO can be found
123      in "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.2
124      Source_Capabilities Message, the order of each entry(PDO) should follow
125      the PD spec chapter 6.4.1. Required for power source and power dual role.
126      User can specify the source PDO array via PDO_FIXED/BATT/VAR/PPS_APDO()
127      defined in dt-bindings/usb/pd.h.
128    minItems: 1
129    maxItems: 7
130    $ref: /schemas/types.yaml#/definitions/uint32-array
131
132  sink-pdos:
133    description: An array of u32 with each entry providing supported power sink
134      data object(PDO), the detailed bit definitions of PDO can be found in
135      "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.3
136      Sink Capabilities Message, the order of each entry(PDO) should follow the
137      PD spec chapter 6.4.1. Required for power sink and power dual role. User
138      can specify the sink PDO array via PDO_FIXED/BATT/VAR/PPS_APDO() defined
139      in dt-bindings/usb/pd.h.
140    minItems: 1
141    maxItems: 7
142    $ref: /schemas/types.yaml#/definitions/uint32-array
143
144  sink-vdos:
145    description: An array of u32 with each entry, a Vendor Defined Message Object (VDO),
146      providing additional information corresponding to the product, the detailed bit
147      definitions and the order of each VDO can be found in
148      "USB Power Delivery Specification Revision 3.0, Version 2.0 + ECNs 2020-12-10"
149      chapter 6.4.4.3.1 Discover Identity. User can specify the VDO array via
150      VDO_IDH/_CERT/_PRODUCT/_UFP/_DFP/_PCABLE/_ACABLE(1/2)/_VPD() defined in
151      dt-bindings/usb/pd.h.
152    minItems: 3
153    maxItems: 6
154    $ref: /schemas/types.yaml#/definitions/uint32-array
155
156  sink-vdos-v1:
157    description: An array of u32 with each entry, a Vendor Defined Message Object (VDO),
158      providing additional information corresponding to the product, the detailed bit
159      definitions and the order of each VDO can be found in
160      "USB Power Delivery Specification Revision 2.0, Version 1.3" chapter 6.4.4.3.1 Discover
161      Identity. User can specify the VDO array via VDO_IDH/_CERT/_PRODUCT/_CABLE/_AMA defined in
162      dt-bindings/usb/pd.h.
163    minItems: 3
164    maxItems: 6
165    $ref: /schemas/types.yaml#/definitions/uint32-array
166
167  op-sink-microwatt:
168    description: Sink required operating power in microwatt, if source can't
169      offer the power, Capability Mismatch is set. Required for power sink and
170      power dual role.
171
172  ports:
173    $ref: /schemas/graph.yaml#/properties/ports
174    description: OF graph bindings modeling any data bus to the connector
175      unless the bus is between parent node and the connector. Since a single
176      connector can have multiple data buses every bus has an assigned OF graph
177      port number as described below.
178
179    properties:
180      port@0:
181        $ref: /schemas/graph.yaml#/properties/port
182        description: High Speed (HS), present in all connectors.
183
184      port@1:
185        $ref: /schemas/graph.yaml#/properties/port
186        description: Super Speed (SS), present in SS capable connectors.
187
188      port@2:
189        $ref: /schemas/graph.yaml#/properties/port
190        description: Sideband Use (SBU), present in USB-C. This describes the
191          alternate mode connection of which SBU is a part.
192
193    required:
194      - port@0
195
196  new-source-frs-typec-current:
197    description: Initial current capability of the new source when vSafe5V
198      is applied during PD3.0 Fast Role Swap. "Table 6-14 Fixed Supply PDO - Sink"
199      of "USB Power Delivery Specification Revision 3.0, Version 1.2" provides the
200      different power levels and "6.4.1.3.1.6 Fast Role Swap USB Type-C Current"
201      provides a detailed description of the field. The sink PDO from current source
202      reflects the current source's(i.e. transmitter of the FRS signal) power
203      requirement during fr swap. The current sink (i.e. receiver of the FRS signal),
204      a.k.a new source, should check if it will be able to satisfy the current source's,
205      new sink's, requirement during frswap before enabling the frs signal reception.
206      This property refers to maximum current capability that the current sink can
207      satisfy. During FRS, VBUS voltage is at 5V, as the partners are in implicit
208      contract, hence, the power level is only a function of the current capability.
209      "1" refers to default USB power level as described by "Table 6-14 Fixed Supply PDO - Sink".
210      "2" refers to 1.5A@5V.
211      "3" refers to 3.0A@5V.
212    $ref: /schemas/types.yaml#/definitions/uint32
213    enum: [1, 2, 3]
214
215  slow-charger-loop:
216    description: Allows PMIC charger loops which are slow(i.e. cannot meet the 15ms deadline) to
217      still comply to pSnkStby i.e Maximum power that can be consumed by sink while in Sink Standby
218      state as defined in 7.4.2 Sink Electrical Parameters of USB Power Delivery Specification
219      Revision 3.0, Version 1.2. When the property is set, the port requests pSnkStby(2.5W -
220      5V@500mA) upon entering SNK_DISCOVERY(instead of 3A or the 1.5A, Rp current advertised, during
221      SNK_DISCOVERY) and the actual currrent limit after reception of PS_Ready for PD link or during
222      SNK_READY for non-pd link.
223    type: boolean
224
225dependencies:
226  sink-vdos-v1: [ 'sink-vdos' ]
227  sink-vdos: [ 'sink-vdos-v1' ]
228
229required:
230  - compatible
231
232allOf:
233  - if:
234      properties:
235        compatible:
236          contains:
237            const: gpio-usb-b-connector
238    then:
239      anyOf:
240        - required:
241            - vbus-gpios
242        - required:
243            - id-gpios
244
245  - if:
246      properties:
247        compatible:
248          contains:
249            const: samsung,usb-connector-11pin
250    then:
251      properties:
252        type:
253          const: micro
254
255anyOf:
256  - not:
257      required:
258        - typec-power-opmode
259        - new-source-frs-typec-current
260
261additionalProperties: true
262
263examples:
264  # Micro-USB connector with HS lines routed via controller (MUIC).
265  - |
266    muic-max77843 {
267      usb_con1: connector {
268        compatible = "usb-b-connector";
269        label = "micro-USB";
270        type = "micro";
271      };
272    };
273
274  # USB-C connector attached to CC controller (s2mm005), HS lines routed
275  # to companion PMIC (max77865), SS lines to USB3 PHY and SBU to DisplayPort.
276  # DisplayPort video lines are routed to the connector via SS mux in USB3 PHY.
277  - |
278    ccic: s2mm005 {
279      usb_con2: connector {
280        compatible = "usb-c-connector";
281        label = "USB-C";
282
283        ports {
284          #address-cells = <1>;
285          #size-cells = <0>;
286
287          port@0 {
288            reg = <0>;
289            usb_con_hs: endpoint {
290              remote-endpoint = <&max77865_usbc_hs>;
291            };
292          };
293          port@1 {
294            reg = <1>;
295            usb_con_ss: endpoint {
296              remote-endpoint = <&usbdrd_phy_ss>;
297            };
298          };
299          port@2 {
300            reg = <2>;
301            usb_con_sbu: endpoint {
302              remote-endpoint = <&dp_aux>;
303            };
304          };
305        };
306      };
307    };
308
309  # USB-C connector attached to a typec port controller(ptn5110), which has
310  # power delivery support and enables drp.
311  - |
312    #include <dt-bindings/usb/pd.h>
313    typec: ptn5110 {
314      usb_con3: connector {
315        compatible = "usb-c-connector";
316        label = "USB-C";
317        power-role = "dual";
318        try-power-role = "sink";
319        source-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)>;
320        sink-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)
321                     PDO_VAR(5000, 12000, 2000)>;
322        op-sink-microwatt = <10000000>;
323      };
324    };
325
326  # USB-C connector attached to SoC and USB3 typec port controller(hd3ss3220)
327  # with SS 2:1 MUX. HS lines routed to SoC, SS lines routed to the MUX and
328  # the output of MUX is connected to the SoC.
329  - |
330    connector {
331        compatible = "usb-c-connector";
332        label = "USB-C";
333        data-role = "dual";
334
335        ports {
336                #address-cells = <1>;
337                #size-cells = <0>;
338                port@0 {
339                        reg = <0>;
340                        hs_ep: endpoint {
341                                remote-endpoint = <&usb3_hs_ep>;
342                        };
343                };
344                port@1 {
345                        reg = <1>;
346                        ss_ep: endpoint {
347                                remote-endpoint = <&hd3ss3220_in_ep>;
348                        };
349                };
350        };
351    };
352
353  # USB connector with GPIO control lines
354  - |
355    #include <dt-bindings/gpio/gpio.h>
356
357    usb {
358      connector {
359        compatible = "gpio-usb-b-connector", "usb-b-connector";
360        type = "micro";
361        id-gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
362        vbus-supply = <&usb_p0_vbus>;
363      };
364    };
365
366  # Micro-USB connector with HS lines routed via controller (MUIC) and MHL
367  # lines connected to HDMI-MHL bridge (sii8620) on Samsung Exynos5433-based
368  # mobile phone
369  - |
370    muic-max77843 {
371      usb_con4: connector {
372        compatible = "samsung,usb-connector-11pin", "usb-b-connector";
373        label = "micro-USB";
374        type = "micro";
375
376        ports {
377          #address-cells = <1>;
378          #size-cells = <0>;
379
380          port@0 {
381            reg = <0>;
382            muic_to_usb: endpoint {
383              remote-endpoint = <&usb_to_muic>;
384            };
385          };
386          port@3 {
387            reg = <3>;
388            usb_con_mhl: endpoint {
389              remote-endpoint = <&sii8620_mhl>;
390            };
391          };
392        };
393      };
394    };
395