xref: /linux/Documentation/devicetree/bindings/usb/usb-device.yaml (revision 156010ed9c2ac1e9df6c11b1f688cf8a6e0152e6)
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  - compatible
80  - reg
81
82additionalProperties: true
83
84examples:
85  # hub connected to port 1
86  # device connected to port 2
87  # device connected to port 3
88  #    interface 0 of configuration 1
89  #    interface 0 of configuration 2
90  - |
91    usb@11270000 {
92        reg = <0x11270000 0x1000>;
93        interrupts = <0x0 0x4e 0x0>;
94        #address-cells = <1>;
95        #size-cells = <0>;
96
97        hub@1 {
98            compatible = "usb5e3,608";
99            reg = <1>;
100        };
101
102        device@2 {
103            compatible = "usb123,4567";
104            reg = <2>;
105        };
106
107        device@3 {
108            compatible = "usb123,abcd";
109            reg = <3>;
110
111            #address-cells = <2>;
112            #size-cells = <0>;
113
114            interface@0 {
115                compatible = "usbif123,abcd.config1.0";
116                reg = <0 1>;
117            };
118
119            interface@0,2 {
120                compatible = "usbif123,abcd.config2.0";
121                reg = <0 2>;
122            };
123        };
124    };
125