Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dt-bindings: usb: convert usb-device.txt to YAML schema

Convert usb-device.txt to YAML schema usb-device.yaml

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/20201225075258.33352-1-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Chunfeng Yun and committed by
Greg Kroah-Hartman
23bf6fc7 63d15214

+143 -102
-102
Documentation/devicetree/bindings/usb/usb-device.txt
··· 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 - };
+124
Documentation/devicetree/bindings/usb/usb-device.yaml
··· 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 + 7 + title: The device tree bindings for the Generic USB Device 8 + 9 + maintainers: 10 + - Greg Kroah-Hartman <gregkh@linuxfoundation.org> 11 + 12 + description: | 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 + 29 + properties: 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 + 53 + patternProperties: 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 + 78 + required: 79 + - compatile 80 + - reg 81 + 82 + additionalProperties: true 83 + 84 + examples: 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 + };
+19
Documentation/devicetree/bindings/usb/usb-hcd.yaml
··· 23 23 targeted hosts (non-PC hosts). 24 24 type: boolean 25 25 26 + "#address-cells": 27 + const: 1 28 + 29 + "#size-cells": 30 + const: 0 31 + 32 + patternProperties: 33 + "^.*@[0-9a-f]{1,2}$": 34 + description: The hard wired USB devices 35 + type: object 36 + $ref: /usb/usb-device.yaml 37 + 26 38 additionalProperties: true 27 39 28 40 examples: ··· 42 30 usb { 43 31 phys = <&usb2_phy1>, <&usb3_phy1>; 44 32 phy-names = "usb"; 33 + #address-cells = <1>; 34 + #size-cells = <0>; 35 + 36 + hub@1 { 37 + compatible = "usb5e3,610"; 38 + reg = <1>; 39 + }; 45 40 };