1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2# Copyright 2019 BayLibre, SAS
3%YAML 1.2
4---
5$id: "http://devicetree.org/schemas/usb/amlogic,meson-g12a-usb-ctrl.yaml#"
6$schema: "http://devicetree.org/meta-schemas/core.yaml#"
7
8title: Amlogic Meson G12A DWC3 USB SoC Controller Glue
9
10maintainers:
11  - Neil Armstrong <narmstrong@baylibre.com>
12
13description: |
14  The Amlogic G12A embeds a DWC3 USB IP Core configured for USB2 and USB3
15  in host-only mode, and a DWC2 IP Core configured for USB2 peripheral mode
16  only.
17
18  A glue connects the DWC3 core to USB2 PHYs and optionally to an USB3 PHY.
19
20  One of the USB2 PHYs can be re-routed in peripheral mode to a DWC2 USB IP.
21
22  The DWC3 Glue controls the PHY routing and power, an interrupt line is
23  connected to the Glue to serve as OTG ID change detection.
24
25  The Amlogic A1 embeds a DWC3 USB IP Core configured for USB2 in
26  host-only mode.
27
28  The Amlogic GXL, GXM & AXG SoCs doesn't embed an USB3 PHY.
29
30properties:
31  compatible:
32    enum:
33      - amlogic,meson-gxl-usb-ctrl
34      - amlogic,meson-gxm-usb-ctrl
35      - amlogic,meson-axg-usb-ctrl
36      - amlogic,meson-g12a-usb-ctrl
37      - amlogic,meson-a1-usb-ctrl
38
39  ranges: true
40
41  "#address-cells":
42    enum: [ 1, 2 ]
43
44  "#size-cells":
45    enum: [ 1, 2 ]
46
47  clocks:
48    minItems: 1
49    maxItems: 3
50
51  clock-names:
52    minItems: 1
53    maxItems: 3
54
55  resets:
56    minItems: 1
57
58  reg:
59    maxItems: 1
60
61  interrupts:
62    maxItems: 1
63
64  phy-names:
65    minItems: 1
66    maxItems: 3
67
68  phys:
69    minItems: 1
70    maxItems: 3
71
72  dr_mode: true
73
74  power-domains:
75    maxItems: 1
76
77  vbus-supply:
78    description: VBUS power supply when used in OTG switchable mode
79
80patternProperties:
81  "^usb@[0-9a-f]+$":
82    type: object
83
84additionalProperties: false
85
86required:
87  - compatible
88  - "#address-cells"
89  - "#size-cells"
90  - ranges
91  - clocks
92  - resets
93  - reg
94  - interrupts
95  - phy-names
96  - phys
97  - dr_mode
98
99allOf:
100  - if:
101      properties:
102        compatible:
103          enum:
104            - amlogic,meson-g12a-usb-ctrl
105
106    then:
107      properties:
108        phy-names:
109          items:
110            - const: usb2-phy0 # USB2 PHY0 if USBHOST_A port is used
111            - const: usb2-phy1 # USB2 PHY1 if USBOTG_B port is used
112            - const: usb3-phy0 # USB3 PHY if USB3_0 is used
113  - if:
114      properties:
115        compatible:
116          enum:
117            - amlogic,meson-gxl-usb-ctrl
118
119    then:
120      properties:
121        clocks:
122          minItems: 2
123        clock-names:
124          items:
125            - const: usb_ctrl
126            - const: ddr
127        phy-names:
128          items:
129            - const: usb2-phy0 # USB2 PHY0 if USBHOST_A port is used
130            - const: usb2-phy1 # USB2 PHY1 if USBOTG_B port is used
131      required:
132        - clock-names
133  - if:
134      properties:
135        compatible:
136          enum:
137            - amlogic,meson-gxm-usb-ctrl
138
139    then:
140      properties:
141        clocks:
142          minItems: 2
143        clock-names:
144          items:
145            - const: usb_ctrl
146            - const: ddr
147        phy-names:
148          items:
149            - const: usb2-phy0 # USB2 PHY0 if USBHOST_A port is used
150            - const: usb2-phy1 # USB2 PHY1 if USBOTG_B port is used
151            - const: usb2-phy2 # USB2 PHY2 if USBOTG_C port is used
152
153      required:
154        - clock-names
155  - if:
156      properties:
157        compatible:
158          enum:
159            - amlogic,meson-axg-usb-ctrl
160
161    then:
162      properties:
163        phy-names:
164          items:
165            - const: usb2-phy1 # USB2 PHY1 if USBOTG_B port is used
166        clocks:
167          minItems: 2
168        clock-names:
169          items:
170            - const: usb_ctrl
171            - const: ddr
172      required:
173        - clock-names
174  - if:
175      properties:
176        compatible:
177          enum:
178            - amlogic,meson-a1-usb-ctrl
179
180    then:
181      properties:
182        phy-names:
183          items:
184            - const: usb2-phy1 # USB2 PHY1 if USBOTG_B port is used
185        clocks:
186          minItems: 3
187        clock-names:
188          items:
189            - const: usb_ctrl
190            - const: usb_bus
191            - const: xtal_usb_ctrl
192      required:
193        - clock-names
194
195examples:
196  - |
197    usb: usb@ffe09000 {
198          compatible = "amlogic,meson-g12a-usb-ctrl";
199          reg = <0xffe09000 0xa0>;
200          interrupts = <16>;
201          #address-cells = <1>;
202          #size-cells = <1>;
203          ranges;
204
205          clocks = <&clkc_usb>;
206          resets = <&reset_usb>;
207
208          dr_mode = "otg";
209
210          phys = <&usb2_phy0>, <&usb2_phy1>, <&usb3_phy0>;
211          phy-names = "usb2-phy0", "usb2-phy1", "usb3-phy0";
212
213          dwc2: usb@ff400000 {
214              compatible = "amlogic,meson-g12a-usb", "snps,dwc2";
215              reg = <0xff400000 0x40000>;
216              interrupts = <31>;
217              clocks = <&clkc_usb1>;
218              clock-names = "otg";
219              phys = <&usb2_phy1>;
220              dr_mode = "peripheral";
221              g-rx-fifo-size = <192>;
222              g-np-tx-fifo-size = <128>;
223              g-tx-fifo-size = <128 128 16 16 16>;
224          };
225
226          dwc3: usb@ff500000 {
227              compatible = "snps,dwc3";
228              reg = <0xff500000 0x100000>;
229              interrupts = <30>;
230              dr_mode = "host";
231              snps,dis_u2_susphy_quirk;
232              snps,quirk-frame-length-adjustment;
233          };
234    };
235