← Documents Documentation/devicetree/bindings/usb/usb-device.yaml GitHub 원문 ↗

Linux 6.18.37 · Devicetree Bindings / USB

Generic USB Device

USB device·interface·combined·hub node와 VID/PID·port 주소 규칙을 설명합니다.

Source pathDocumentation/devicetree/bindings/usb/usb-device.yaml
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

usb-device.yaml:1-126

USB device·interface·combined·hub node와 VID/PID·port 주소 규칙을 설명합니다. 접을 수 있는 영어 원문 전체와 한국어 전문 번역을 함께 제공하며, compatible, register, interrupt, regulator, USB ID, graph 구조, source path와 원문 줄 좌표를 원형대로 보존합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
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: 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 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
56 patternProperties:
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
81 required:
82 - reg
83
84 additionalProperties: true
85
86 examples:
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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Generic USB device node 모델

1-28

GPL-2.0-only 또는 BSD-2-Clause로 배포되는 이 스키마는 일반 USB device를 정의합니다. device tree는 보통 board에 고정 배선된 USB device에만 사용하며 기준 문서는 Open Firmware USB 1.0 binding입니다. 관리자는 Greg Kroah-Hartman입니다.

node 유형은 USB host controller를 나타내는 host-controller node, USB device를 나타내는 device node, USB interface를 나타내는 interface node, 단순 USB device를 나타내는 combined node의 네 가지입니다.

class 0 또는 class 9(hub) device가 configuration 하나와 interface 하나만 가지면 device node와 interface node 대신 combined node를 사용해야 합니다. hub node는 USB hub를 나타내는 combined node 또는 interface node입니다.

VID·PID compatible과 port 주소

29-55

device node 또는 combined node의 compatible에는 `usbVID,PID` 형식이 포함됩니다. VID는 vendor ID, PID는 product ID이며 소문자 16진수로 쓰고 선행 0은 생략합니다. 표준의 다른 compatible도 함께 사용할 수 있지만 이 형식 하나만 남겨도 됩니다.

`reg`는 device가 연결된 USB hub port 또는 host-controller port 번호이며 범위는 1~255입니다. device child가 있는 hub node는 `#address-cells = <1>`, interface child가 있는 device node는 `<2>`를 사용하고 `#size-cells`는 0입니다.

properties:
  compatible:
    contains:
      pattern: "^usb[0-9a-f]{1,4},[0-9a-f]{1,4}$"
    description: Device nodes or combined nodes.
      "usbVID,PID", where VID is the vendor id and PID the product id.
      The textual representation of VID and PID shall be in lower case
      hexadecimal with leading zeroes suppressed. The other compatible
      strings from the above standard binding could also be used,
      but a device adhering to this binding may leave out all except
      for "usbVID,PID".

  reg:
    description: the number of the USB hub port or the USB host-controller
      port to which this device is attached.
    items:
      - minimum: 1
        maximum: 255

  "#address-cells":
    description: should be 1 for hub nodes with device nodes,
      should be 2 for device nodes with interface nodes.
    enum: [1, 2]

  "#size-cells":
    const: 0

USB interface node 표기

56-80

interface node의 unit address는 interface number와 필요하면 configuration component를 소문자 16진수로 나타냅니다. configuration 1에서는 textual unit address에서 configuration component를 생략합니다.

interface compatible은 `usbifVID,PID.configCN.IN` 형식입니다. VID·PID는 vendor·product ID, CN은 configuration value, IN은 interface number이며 모두 소문자 16진수로 쓰고 선행 0은 생략합니다. `reg`는 두 cell로, 첫 cell이 interface number이고 둘째가 configuration value입니다.

patternProperties:
  "^interface@[0-9a-f]{1,2}(,[0-9a-f]{1,2})$":
    type: object
    description: USB interface nodes.
      The configuration component is not included in the textual
      representation of an interface-node unit address for configuration 1.

    properties:
      compatible:
        pattern: "^usbif[0-9a-f]{1,4},[0-9a-f]{1,4}.config[0-9a-f]{1,2}.[0-9a-f]{1,2}$"
        description: Interface nodes.
          "usbifVID,PID.configCN.IN", where VID is the vendor id, PID is
          the product id, CN is the configuration value and IN is the interface
          number. The textual representation of VID, PID, CN and IN shall be
          in lower case hexadecimal with leading zeroes suppressed.
          The other compatible strings from the above standard binding could
          also be used, but a device adhering to this binding may leave out
          all except for "usbifVID,PID.configCN.IN".

      reg:
        description: should be 2 cells long, the first cell represents
          the interface number and the second cell represents the
          configuration value.
        maxItems: 1

필수 port 번호와 확장

81-85

`reg`가 필수입니다. device별 속성을 수용할 수 있도록 추가 속성은 허용합니다.

required:
  - reg

additionalProperties: true

hub, device와 두 configuration 예제

86-126

예제 host controller의 port 1에는 VID 0x05e3·PID 0x0608 hub, port 2에는 단순 device가 연결됩니다. port 3의 device는 interface child를 위해 두 개의 address cell을 사용합니다.

configuration 1의 interface 0은 unit address `interface@0`과 `reg = <0 1>`을 사용합니다. configuration 2의 interface 0은 `interface@0,2`, compatible `usbif123,abcd.config2.0`, `reg = <0 2>`로 구분합니다.

examples:
  # hub connected to port 1
  # device connected to port 2
  # device connected to port 3
  #    interface 0 of configuration 1
  #    interface 0 of configuration 2
  - |
    usb@11270000 {
        reg = <0x11270000 0x1000>;
        interrupts = <0x0 0x4e 0x0>;
        #address-cells = <1>;
        #size-cells = <0>;

        hub@1 {
            compatible = "usb5e3,608";
            reg = <1>;
        };

        device@2 {
            compatible = "usb123,4567";
            reg = <2>;
        };

        device@3 {
            compatible = "usb123,abcd";
            reg = <3>;

            #address-cells = <2>;
            #size-cells = <0>;

            interface@0 {
                compatible = "usbif123,abcd.config1.0";
                reg = <0 1>;
            };

            interface@0,2 {
                compatible = "usbif123,abcd.config2.0";
                reg = <0 2>;
            };
        };
    };