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 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-g12a-usb-ctrl
36      - amlogic,meson-a1-usb-ctrl
37
38  ranges: true
39
40  "#address-cells":
41    enum: [ 1, 2 ]
42
43  "#size-cells":
44    enum: [ 1, 2 ]
45
46  clocks:
47    minItems: 1
48    maxItems: 3
49
50  clock-names:
51    minItems: 1
52    maxItems: 3
53
54  resets:
55    minItems: 1
56
57  reg:
58    maxItems: 1
59
60  interrupts:
61    maxItems: 1
62
63  phy-names:
64    minItems: 1
65    maxItems: 3
66
67  phys:
68    minItems: 1
69    maxItems: 3
70
71  dr_mode: true
72
73  power-domains:
74    maxItems: 1
75
76  vbus-supply:
77    description: VBUS power supply when used in OTG switchable mode
78
79patternProperties:
80  "^usb@[0-9a-f]+$":
81    type: object
82
83additionalProperties: false
84
85required:
86  - compatible
87  - "#address-cells"
88  - "#size-cells"
89  - ranges
90  - clocks
91  - resets
92  - reg
93  - interrupts
94  - phy-names
95  - phys
96  - dr_mode
97
98allOf:
99  - if:
100      properties:
101        compatible:
102          enum:
103            - amlogic,meson-g12a-usb-ctrl
104
105    then:
106      properties:
107        phy-names:
108          items:
109            - const: usb2-phy0 # USB2 PHY0 if USBHOST_A port is used
110            - const: usb2-phy1 # USB2 PHY1 if USBOTG_B port is used
111            - const: usb3-phy0 # USB3 PHY if USB3_0 is used
112  - if:
113      properties:
114        compatible:
115          enum:
116            - amlogic,meson-gxl-usb-ctrl
117
118    then:
119      properties:
120        clocks:
121          minItems: 2
122        clock-names:
123          items:
124            - const: usb_ctrl
125            - const: ddr
126        phy-names:
127          items:
128            - const: usb2-phy0 # USB2 PHY0 if USBHOST_A port is used
129            - const: usb2-phy1 # USB2 PHY1 if USBOTG_B port is used
130      required:
131        - clock-names
132  - if:
133      properties:
134        compatible:
135          enum:
136            - amlogic,meson-gxm-usb-ctrl
137
138    then:
139      properties:
140        clocks:
141          minItems: 2
142        clock-names:
143          items:
144            - const: usb_ctrl
145            - const: ddr
146        phy-names:
147          items:
148            - const: usb2-phy0 # USB2 PHY0 if USBHOST_A port is used
149            - const: usb2-phy1 # USB2 PHY1 if USBOTG_B port is used
150            - const: usb2-phy2 # USB2 PHY2 if USBOTG_C port is used
151
152      required:
153        - clock-names
154  - if:
155      properties:
156        compatible:
157          enum:
158            - amlogic,meson-a1-usb-ctrl
159
160    then:
161      properties:
162        phy-names:
163          items:
164            - const: usb2-phy1 # USB2 PHY1 if USBOTG_B port is used
165        clocks:
166          minItems: 3
167        clock-names:
168          items:
169            - const: usb_ctrl
170            - const: usb_bus
171            - const: xtal_usb_ctrl
172      required:
173        - clock-names
174
175examples:
176  - |
177    usb: usb@ffe09000 {
178          compatible = "amlogic,meson-g12a-usb-ctrl";
179          reg = <0xffe09000 0xa0>;
180          interrupts = <16>;
181          #address-cells = <1>;
182          #size-cells = <1>;
183          ranges;
184
185          clocks = <&clkc_usb>;
186          resets = <&reset_usb>;
187
188          dr_mode = "otg";
189
190          phys = <&usb2_phy0>, <&usb2_phy1>, <&usb3_phy0>;
191          phy-names = "usb2-phy0", "usb2-phy1", "usb3-phy0";
192
193          dwc2: usb@ff400000 {
194              compatible = "amlogic,meson-g12a-usb", "snps,dwc2";
195              reg = <0xff400000 0x40000>;
196              interrupts = <31>;
197              clocks = <&clkc_usb1>;
198              clock-names = "otg";
199              phys = <&usb2_phy1>;
200              dr_mode = "peripheral";
201              g-rx-fifo-size = <192>;
202              g-np-tx-fifo-size = <128>;
203              g-tx-fifo-size = <128 128 16 16 16>;
204          };
205
206          dwc3: usb@ff500000 {
207              compatible = "snps,dwc3";
208              reg = <0xff500000 0x100000>;
209              interrupts = <30>;
210              dr_mode = "host";
211              snps,dis_u2_susphy_quirk;
212              snps,quirk-frame-length-adjustment;
213          };
214    };
215