| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | Generic USB Device Properties |
| 2 | |
| 3 | Usually, we only use device tree for hard wired USB device. |
| 4 | The reference binding doc is from: |
| 5 | http://www.devicetree.org/open-firmware/bindings/usb/usb-1_0.ps |
| 6 | |
| 7 | Four types of device-tree nodes are defined: "host-controller nodes" |
| 8 | representing USB host controllers, "device nodes" representing USB devices, |
| 9 | "interface nodes" representing USB interfaces and "combined nodes" |
| 10 | representing simple USB devices. |
| 11 | |
| 12 | A combined node shall be used instead of a device node and an interface node |
| 13 | for devices of class 0 or 9 (hub) with a single configuration and a single |
| 14 | interface. |
| 15 | |
| 16 | A "hub node" is a combined node or an interface node that represents a USB |
| 17 | hub. |
| 18 | |
| 19 | |
| 20 | Required properties for device nodes: |
| 21 | - compatible: "usbVID,PID", where VID is the vendor id and PID the product id. |
| 22 | The textual representation of VID and PID shall be in lower case hexadecimal |
| 23 | with leading zeroes suppressed. The other compatible strings from the above |
| 24 | standard binding could also be used, but a device adhering to this binding |
| 25 | may leave out all except for "usbVID,PID". |
| 26 | - reg: the number of the USB hub port or the USB host-controller port to which |
| 27 | this device is attached. The range is 1-255. |
| 28 | |
| 29 | |
| 30 | Required properties for device nodes with interface nodes: |
| 31 | - #address-cells: shall be 2 |
| 32 | - #size-cells: shall be 0 |
| 33 | |
| 34 | |
| 35 | Required properties for interface nodes: |
| 36 | - compatible: "usbifVID,PID.configCN.IN", where VID is the vendor id, PID is |
| 37 | the product id, CN is the configuration value and IN is the interface |
| 38 | number. The textual representation of VID, PID, CN and IN shall be in lower |
| 39 | case hexadecimal with leading zeroes suppressed. The other compatible |
| 40 | strings from the above standard binding could also be used, but a device |
| 41 | adhering to this binding may leave out all except for |
| 42 | "usbifVID,PID.configCN.IN". |
| 43 | - reg: the interface number and configuration value |
| 44 | |
| 45 | The configuration component is not included in the textual representation of |
| 46 | an interface-node unit address for configuration 1. |
| 47 | |
| 48 | |
| 49 | Required properties for combined nodes: |
| 50 | - compatible: "usbVID,PID", where VID is the vendor id and PID the product id. |
| 51 | The textual representation of VID and PID shall be in lower case hexadecimal |
| 52 | with leading zeroes suppressed. The other compatible strings from the above |
| 53 | standard binding could also be used, but a device adhering to this binding |
| 54 | may leave out all except for "usbVID,PID". |
| 55 | - reg: the number of the USB hub port or the USB host-controller port to which |
| 56 | this device is attached. The range is 1-255. |
| 57 | |
| 58 | |
| 59 | Required properties for hub nodes with device nodes: |
| 60 | - #address-cells: shall be 1 |
| 61 | - #size-cells: shall be 0 |
| 62 | |
| 63 | |
| 64 | Required properties for host-controller nodes with device nodes: |
| 65 | - #address-cells: shall be 1 |
| 66 | - #size-cells: shall be 0 |
| 67 | |
| 68 | |
| 69 | Example: |
| 70 | |
| 71 | &usb1 { /* host controller */ |
| 72 | #address-cells = <1>; |
| 73 | #size-cells = <0>; |
| 74 | |
| 75 | hub@1 { /* hub connected to port 1 */ |
| 76 | compatible = "usb5e3,608"; |
| 77 | reg = <1>; |
| 78 | }; |
| 79 | |
| 80 | device@2 { /* device connected to port 2 */ |
| 81 | compatible = "usb123,4567"; |
| 82 | reg = <2>; |
| 83 | }; |
| 84 | |
| 85 | device@3 { /* device connected to port 3 */ |
| 86 | compatible = "usb123,abcd"; |
| 87 | reg = <3>; |
| 88 | |
| 89 | #address-cells = <2>; |
| 90 | #size-cells = <0>; |
| 91 | |
| 92 | interface@0 { /* interface 0 of configuration 1 */ |
| 93 | compatible = "usbif123,abcd.config1.0"; |
| 94 | reg = <0 1>; |
| 95 | }; |
| 96 | |
| 97 | interface@0,2 { /* interface 0 of configuration 2 */ |
| 98 | compatible = "usbif123,abcd.config2.0"; |
| 99 | reg = <0 2>; |
| 100 | }; |
| 101 | }; |
| 102 | }; |