18c2ecf20Sopenharmony_ciGeneric USB Device Properties
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciUsually, we only use device tree for hard wired USB device.
48c2ecf20Sopenharmony_ciThe reference binding doc is from:
58c2ecf20Sopenharmony_cihttp://www.devicetree.org/open-firmware/bindings/usb/usb-1_0.ps
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciFour types of device-tree nodes are defined: "host-controller nodes"
88c2ecf20Sopenharmony_cirepresenting USB host controllers, "device nodes" representing USB devices,
98c2ecf20Sopenharmony_ci"interface nodes" representing USB interfaces and "combined nodes"
108c2ecf20Sopenharmony_cirepresenting simple USB devices.
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciA combined node shall be used instead of a device node and an interface node
138c2ecf20Sopenharmony_cifor devices of class 0 or 9 (hub) with a single configuration and a single
148c2ecf20Sopenharmony_ciinterface.
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciA "hub node" is a combined node or an interface node that represents a USB
178c2ecf20Sopenharmony_cihub.
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciRequired properties for device nodes:
218c2ecf20Sopenharmony_ci- compatible: "usbVID,PID", where VID is the vendor id and PID the product id.
228c2ecf20Sopenharmony_ci  The textual representation of VID and PID shall be in lower case hexadecimal
238c2ecf20Sopenharmony_ci  with leading zeroes suppressed. The other compatible strings from the above
248c2ecf20Sopenharmony_ci  standard binding could also be used, but a device adhering to this binding
258c2ecf20Sopenharmony_ci  may leave out all except for "usbVID,PID".
268c2ecf20Sopenharmony_ci- reg: the number of the USB hub port or the USB host-controller port to which
278c2ecf20Sopenharmony_ci  this device is attached. The range is 1-255.
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciRequired properties for device nodes with interface nodes:
318c2ecf20Sopenharmony_ci- #address-cells: shall be 2
328c2ecf20Sopenharmony_ci- #size-cells: shall be 0
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciRequired properties for interface nodes:
368c2ecf20Sopenharmony_ci- compatible: "usbifVID,PID.configCN.IN", where VID is the vendor id, PID is
378c2ecf20Sopenharmony_ci  the product id, CN is the configuration value and IN is the interface
388c2ecf20Sopenharmony_ci  number. The textual representation of VID, PID, CN and IN shall be in lower
398c2ecf20Sopenharmony_ci  case hexadecimal with leading zeroes suppressed. The other compatible
408c2ecf20Sopenharmony_ci  strings from the above standard binding could also be used, but a device
418c2ecf20Sopenharmony_ci  adhering to this binding may leave out all except for
428c2ecf20Sopenharmony_ci  "usbifVID,PID.configCN.IN".
438c2ecf20Sopenharmony_ci- reg: the interface number and configuration value
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ciThe configuration component is not included in the textual representation of
468c2ecf20Sopenharmony_cian interface-node unit address for configuration 1.
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciRequired properties for combined nodes:
508c2ecf20Sopenharmony_ci- compatible: "usbVID,PID", where VID is the vendor id and PID the product id.
518c2ecf20Sopenharmony_ci  The textual representation of VID and PID shall be in lower case hexadecimal
528c2ecf20Sopenharmony_ci  with leading zeroes suppressed. The other compatible strings from the above
538c2ecf20Sopenharmony_ci  standard binding could also be used, but a device adhering to this binding
548c2ecf20Sopenharmony_ci  may leave out all except for "usbVID,PID".
558c2ecf20Sopenharmony_ci- reg: the number of the USB hub port or the USB host-controller port to which
568c2ecf20Sopenharmony_ci  this device is attached. The range is 1-255.
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciRequired properties for hub nodes with device nodes:
608c2ecf20Sopenharmony_ci- #address-cells: shall be 1
618c2ecf20Sopenharmony_ci- #size-cells: shall be 0
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ciRequired properties for host-controller nodes with device nodes:
658c2ecf20Sopenharmony_ci- #address-cells: shall be 1
668c2ecf20Sopenharmony_ci- #size-cells: shall be 0
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ciExample:
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci&usb1 {	/* host controller */
728c2ecf20Sopenharmony_ci	#address-cells = <1>;
738c2ecf20Sopenharmony_ci	#size-cells = <0>;
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	hub@1 {		/* hub connected to port 1 */
768c2ecf20Sopenharmony_ci		compatible = "usb5e3,608";
778c2ecf20Sopenharmony_ci		reg = <1>;
788c2ecf20Sopenharmony_ci	};
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci	device@2 {	/* device connected to port 2 */
818c2ecf20Sopenharmony_ci		compatible = "usb123,4567";
828c2ecf20Sopenharmony_ci		reg = <2>;
838c2ecf20Sopenharmony_ci	};
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci	device@3 { 	/* device connected to port 3 */
868c2ecf20Sopenharmony_ci		compatible = "usb123,abcd";
878c2ecf20Sopenharmony_ci		reg = <3>;
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci		#address-cells = <2>;
908c2ecf20Sopenharmony_ci		#size-cells = <0>;
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci		interface@0 {	/* interface 0 of configuration 1 */
938c2ecf20Sopenharmony_ci			compatible = "usbif123,abcd.config1.0";
948c2ecf20Sopenharmony_ci			reg = <0 1>;
958c2ecf20Sopenharmony_ci		};
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci		interface@0,2 {	/* interface 0 of configuration 2 */
988c2ecf20Sopenharmony_ci			compatible = "usbif123,abcd.config2.0";
998c2ecf20Sopenharmony_ci			reg = <0 2>;
1008c2ecf20Sopenharmony_ci		};
1018c2ecf20Sopenharmony_ci	};
1028c2ecf20Sopenharmony_ci};
103