xref: /linux/Documentation/devicetree/bindings/usb/usb-device.yaml (revision 8e07e0e3964ca4e23ce7b68e2096fe660a888942)
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/usb/usb-device.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Generic USB Device
8
9maintainers:
10  - Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11
12description: |
13  Usually, we only use device tree for hard wired USB device.
14  The reference binding doc is from:
15  http://www.devicetree.org/open-firmware/bindings/usb/usb-1_0.ps
16
17  Four types of device-tree nodes are defined: "host-controller nodes"
18  representing USB host controllers, "device nodes" representing USB devices,
19  "interface nodes" representing USB interfaces and "combined nodes"
20  representing simple USB devices.
21
22  A combined node shall be used instead of a device node and an interface node
23  for devices of class 0 or 9 (hub) with a single configuration and a single
24  interface.
25
26  A "hub node" is a combined node or an interface node that represents a USB
27  hub.
28
29properties:
30  compatible:
31    pattern: "^usb[0-9a-f]{1,4},[0-9a-f]{1,4}$"
32    description: Device nodes or combined nodes.
33      "usbVID,PID", where VID is the vendor id and PID the product id.
34      The textual representation of VID and PID shall be in lower case
35      hexadecimal with leading zeroes suppressed. The other compatible
36      strings from the above standard binding could also be used,
37      but a device adhering to this binding may leave out all except
38      for "usbVID,PID".
39
40  reg:
41    description: the number of the USB hub port or the USB host-controller
42      port to which this device is attached. The range is 1-255.
43    maxItems: 1
44
45  "#address-cells":
46    description: should be 1 for hub nodes with device nodes,
47      should be 2 for device nodes with interface nodes.
48    enum: [1, 2]
49
50  "#size-cells":
51    const: 0
52
53patternProperties:
54  "^interface@[0-9a-f]{1,2}(,[0-9a-f]{1,2})$":
55    type: object
56    description: USB interface nodes.
57      The configuration component is not included in the textual
58      representation of an interface-node unit address for configuration 1.
59
60    properties:
61      compatible:
62        pattern: "^usbif[0-9a-f]{1,4},[0-9a-f]{1,4}.config[0-9a-f]{1,2}.[0-9a-f]{1,2}$"
63        description: Interface nodes.
64          "usbifVID,PID.configCN.IN", where VID is the vendor id, PID is
65          the product id, CN is the configuration value and IN is the interface
66          number. The textual representation of VID, PID, CN and IN shall be
67          in lower case hexadecimal with leading zeroes suppressed.
68          The other compatible strings from the above standard binding could
69          also be used, but a device adhering to this binding may leave out
70          all except for "usbifVID,PID.configCN.IN".
71
72      reg:
73        description: should be 2 cells long, the first cell represents
74          the interface number and the second cell represents the
75          configuration value.
76        maxItems: 1
77
78required:
79  - reg
80
81additionalProperties: true
82
83examples:
84  # hub connected to port 1
85  # device connected to port 2
86  # device connected to port 3
87  #    interface 0 of configuration 1
88  #    interface 0 of configuration 2
89  - |
90    usb@11270000 {
91        reg = <0x11270000 0x1000>;
92        interrupts = <0x0 0x4e 0x0>;
93        #address-cells = <1>;
94        #size-cells = <0>;
95
96        hub@1 {
97            compatible = "usb5e3,608";
98            reg = <1>;
99        };
100
101        device@2 {
102            compatible = "usb123,4567";
103            reg = <2>;
104        };
105
106        device@3 {
107            compatible = "usb123,abcd";
108            reg = <3>;
109
110            #address-cells = <2>;
111            #size-cells = <0>;
112
113            interface@0 {
114                compatible = "usbif123,abcd.config1.0";
115                reg = <0 1>;
116            };
117
118            interface@0,2 {
119                compatible = "usbif123,abcd.config2.0";
120                reg = <0 2>;
121            };
122        };
123    };
124