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.
43    items:
44      - minimum: 1
45        maximum: 255
46
47  "#address-cells":
48    description: should be 1 for hub nodes with device nodes,
49      should be 2 for device nodes with interface nodes.
50    enum: [1, 2]
51
52  "#size-cells":
53    const: 0
54
55patternProperties:
56  "^interface@[0-9a-f]{1,2}(,[0-9a-f]{1,2})$":
57    type: object
58    description: USB interface nodes.
59      The configuration component is not included in the textual
60      representation of an interface-node unit address for configuration 1.
61
62    properties:
63      compatible:
64        pattern: "^usbif[0-9a-f]{1,4},[0-9a-f]{1,4}.config[0-9a-f]{1,2}.[0-9a-f]{1,2}$"
65        description: Interface nodes.
66          "usbifVID,PID.configCN.IN", where VID is the vendor id, PID is
67          the product id, CN is the configuration value and IN is the interface
68          number. The textual representation of VID, PID, CN and IN shall be
69          in lower case hexadecimal with leading zeroes suppressed.
70          The other compatible strings from the above standard binding could
71          also be used, but a device adhering to this binding may leave out
72          all except for "usbifVID,PID.configCN.IN".
73
74      reg:
75        description: should be 2 cells long, the first cell represents
76          the interface number and the second cell represents the
77          configuration value.
78        maxItems: 1
79
80required:
81  - reg
82
83additionalProperties: true
84
85examples:
86  # hub connected to port 1
87  # device connected to port 2
88  # device connected to port 3
89  #    interface 0 of configuration 1
90  #    interface 0 of configuration 2
91  - |
92    usb@11270000 {
93        reg = <0x11270000 0x1000>;
94        interrupts = <0x0 0x4e 0x0>;
95        #address-cells = <1>;
96        #size-cells = <0>;
97
98        hub@1 {
99            compatible = "usb5e3,608";
100            reg = <1>;
101        };
102
103        device@2 {
104            compatible = "usb123,4567";
105            reg = <2>;
106        };
107
108        device@3 {
109            compatible = "usb123,abcd";
110            reg = <3>;
111
112            #address-cells = <2>;
113            #size-cells = <0>;
114
115            interface@0 {
116                compatible = "usbif123,abcd.config1.0";
117                reg = <0 1>;
118            };
119
120            interface@0,2 {
121                compatible = "usbif123,abcd.config2.0";
122                reg = <0 2>;
123            };
124        };
125    };
126