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