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