blob: 8d53ba779024f9924f5161cc1bb63a2dc36b3f8d [file] [log] [blame]
Patrick Delaunayd6e53c72018-10-26 09:02:52 +02001// SPDX-License-Identifier: GPL-2.0
Michal Simek9d8cbbf2018-05-18 13:15:06 +02002/*
3 * Generic DWC3 Glue layer
4 *
5 * Copyright (C) 2016 - 2018 Xilinx, Inc.
6 *
7 * Based on dwc3-omap.c.
8 */
9
10#include <common.h>
Simon Glass63334482019-11-14 12:57:39 -070011#include <cpu_func.h>
Simon Glass0f2af882020-05-10 11:40:05 -060012#include <log.h>
Michal Simek9d8cbbf2018-05-18 13:15:06 +020013#include <dm.h>
14#include <dm/device-internal.h>
15#include <dm/lists.h>
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +010016#include <dwc3-uboot.h>
Simon Glass4dcacfc2020-05-10 11:40:13 -060017#include <linux/bitops.h>
Frank Wangf5a6c5b2020-05-26 11:34:31 +080018#include <linux/delay.h>
Michal Simek9d8cbbf2018-05-18 13:15:06 +020019#include <linux/usb/ch9.h>
20#include <linux/usb/gadget.h>
21#include <malloc.h>
22#include <usb.h>
23#include "core.h"
24#include "gadget.h"
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +010025#include <reset.h>
26#include <clk.h>
Jean-Jacques Hiblot175cd7c2019-09-11 11:33:50 +020027#include <usb/xhci.h>
Michal Simek9d8cbbf2018-05-18 13:15:06 +020028
Frank Wangf5a6c5b2020-05-26 11:34:31 +080029struct dwc3_glue_data {
30 struct clk_bulk clks;
31 struct reset_ctl_bulk resets;
32 fdt_addr_t regs;
33};
34
Jean-Jacques Hiblota33aa762019-09-11 11:33:48 +020035struct dwc3_generic_plat {
36 fdt_addr_t base;
37 u32 maximum_speed;
38 enum usb_dr_mode dr_mode;
39};
40
Jean-Jacques Hiblota33aa762019-09-11 11:33:48 +020041struct dwc3_generic_priv {
Jean-Jacques Hiblot2bf2c352019-09-11 11:33:49 +020042 void *base;
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +010043 struct dwc3 dwc3;
developerf8bced12020-05-02 11:35:13 +020044 struct phy_bulk phys;
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +010045};
46
Jean-Jacques Hiblot175cd7c2019-09-11 11:33:50 +020047struct dwc3_generic_host_priv {
48 struct xhci_ctrl xhci_ctrl;
49 struct dwc3_generic_priv gen_priv;
50};
51
Jean-Jacques Hiblot2bf2c352019-09-11 11:33:49 +020052static int dwc3_generic_probe(struct udevice *dev,
53 struct dwc3_generic_priv *priv)
Michal Simek9d8cbbf2018-05-18 13:15:06 +020054{
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +010055 int rc;
Simon Glassfa20e932020-12-03 16:55:20 -070056 struct dwc3_generic_plat *plat = dev_get_plat(dev);
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +010057 struct dwc3 *dwc3 = &priv->dwc3;
Simon Glassfa20e932020-12-03 16:55:20 -070058 struct dwc3_glue_data *glue = dev_get_plat(dev->parent);
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +010059
Jean-Jacques Hiblotce868d02019-09-11 11:33:52 +020060 dwc3->dev = dev;
Jean-Jacques Hiblota33aa762019-09-11 11:33:48 +020061 dwc3->maximum_speed = plat->maximum_speed;
62 dwc3->dr_mode = plat->dr_mode;
Jean-Jacques Hiblotce868d02019-09-11 11:33:52 +020063#if CONFIG_IS_ENABLED(OF_CONTROL)
64 dwc3_of_parse(dwc3);
65#endif
Jean-Jacques Hiblota33aa762019-09-11 11:33:48 +020066
Frank Wangf5a6c5b2020-05-26 11:34:31 +080067 /*
68 * It must hold whole USB3.0 OTG controller in resetting to hold pipe
69 * power state in P2 before initializing TypeC PHY on RK3399 platform.
70 */
71 if (device_is_compatible(dev->parent, "rockchip,rk3399-dwc3")) {
72 reset_assert_bulk(&glue->resets);
73 udelay(1);
74 }
75
developerf8bced12020-05-02 11:35:13 +020076 rc = dwc3_setup_phy(dev, &priv->phys);
Siva Durga Prasad Paladuguc37f8f32020-10-21 14:17:31 +020077 if (rc && rc != -ENOTSUPP)
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +010078 return rc;
79
Frank Wangf5a6c5b2020-05-26 11:34:31 +080080 if (device_is_compatible(dev->parent, "rockchip,rk3399-dwc3"))
81 reset_deassert_bulk(&glue->resets);
82
Jean-Jacques Hiblot2bf2c352019-09-11 11:33:49 +020083 priv->base = map_physmem(plat->base, DWC3_OTG_REGS_END, MAP_NOCACHE);
84 dwc3->regs = priv->base + DWC3_GLOBALS_REGS_START;
Jean-Jacques Hiblotce868d02019-09-11 11:33:52 +020085
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +010086
87 rc = dwc3_init(dwc3);
88 if (rc) {
Jean-Jacques Hiblot2bf2c352019-09-11 11:33:49 +020089 unmap_physmem(priv->base, MAP_NOCACHE);
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +010090 return rc;
91 }
Michal Simek9d8cbbf2018-05-18 13:15:06 +020092
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +010093 return 0;
Michal Simek9d8cbbf2018-05-18 13:15:06 +020094}
95
Jean-Jacques Hiblot2bf2c352019-09-11 11:33:49 +020096static int dwc3_generic_remove(struct udevice *dev,
97 struct dwc3_generic_priv *priv)
Michal Simek9d8cbbf2018-05-18 13:15:06 +020098{
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +010099 struct dwc3 *dwc3 = &priv->dwc3;
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200100
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100101 dwc3_remove(dwc3);
developerf8bced12020-05-02 11:35:13 +0200102 dwc3_shutdown_phy(dev, &priv->phys);
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100103 unmap_physmem(dwc3->regs, MAP_NOCACHE);
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200104
105 return 0;
106}
107
Simon Glassaad29ae2020-12-03 16:55:21 -0700108static int dwc3_generic_of_to_plat(struct udevice *dev)
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200109{
Simon Glassfa20e932020-12-03 16:55:20 -0700110 struct dwc3_generic_plat *plat = dev_get_plat(dev);
Simon Glassa7ece582020-12-19 10:40:14 -0700111 ofnode node = dev_ofnode(dev);
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200112
Kever Yang1b807052020-03-04 08:59:50 +0800113 plat->base = dev_read_addr(dev);
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200114
Jean-Jacques Hiblota33aa762019-09-11 11:33:48 +0200115 plat->maximum_speed = usb_get_maximum_speed(node);
116 if (plat->maximum_speed == USB_SPEED_UNKNOWN) {
Jean-Jacques Hiblot547df0d2019-09-11 11:33:51 +0200117 pr_info("No USB maximum speed specified. Using super speed\n");
118 plat->maximum_speed = USB_SPEED_SUPER;
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200119 }
120
Jean-Jacques Hiblota33aa762019-09-11 11:33:48 +0200121 plat->dr_mode = usb_get_dr_mode(node);
122 if (plat->dr_mode == USB_DR_MODE_UNKNOWN) {
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200123 pr_err("Invalid usb mode setup\n");
124 return -ENODEV;
125 }
126
127 return 0;
128}
129
Jean-Jacques Hiblot2bf2c352019-09-11 11:33:49 +0200130#if CONFIG_IS_ENABLED(DM_USB_GADGET)
131int dm_usb_gadget_handle_interrupts(struct udevice *dev)
132{
133 struct dwc3_generic_priv *priv = dev_get_priv(dev);
134 struct dwc3 *dwc3 = &priv->dwc3;
135
136 dwc3_gadget_uboot_handle_interrupt(dwc3);
137
138 return 0;
139}
140
141static int dwc3_generic_peripheral_probe(struct udevice *dev)
142{
143 struct dwc3_generic_priv *priv = dev_get_priv(dev);
144
145 return dwc3_generic_probe(dev, priv);
146}
147
148static int dwc3_generic_peripheral_remove(struct udevice *dev)
149{
150 struct dwc3_generic_priv *priv = dev_get_priv(dev);
151
152 return dwc3_generic_remove(dev, priv);
153}
154
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200155U_BOOT_DRIVER(dwc3_generic_peripheral) = {
156 .name = "dwc3-generic-peripheral",
Jean-Jacques Hiblot9dc0d5c2018-11-29 10:52:46 +0100157 .id = UCLASS_USB_GADGET_GENERIC,
Simon Glassaad29ae2020-12-03 16:55:21 -0700158 .of_to_plat = dwc3_generic_of_to_plat,
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200159 .probe = dwc3_generic_peripheral_probe,
160 .remove = dwc3_generic_peripheral_remove,
Simon Glass8a2b47f2020-12-03 16:55:17 -0700161 .priv_auto = sizeof(struct dwc3_generic_priv),
Simon Glass71fa5b42020-12-03 16:55:18 -0700162 .plat_auto = sizeof(struct dwc3_generic_plat),
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200163};
Jean-Jacques Hiblot44aaec72018-11-29 10:52:42 +0100164#endif
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200165
Simon Glass1f2440c2021-07-10 21:14:29 -0600166#if defined(CONFIG_SPL_USB_HOST) || \
Kunihiko Hayashib032aa62021-05-12 23:11:14 +0900167 !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USB_HOST)
Jean-Jacques Hiblot175cd7c2019-09-11 11:33:50 +0200168static int dwc3_generic_host_probe(struct udevice *dev)
169{
170 struct xhci_hcor *hcor;
171 struct xhci_hccr *hccr;
172 struct dwc3_generic_host_priv *priv = dev_get_priv(dev);
173 int rc;
174
175 rc = dwc3_generic_probe(dev, &priv->gen_priv);
176 if (rc)
177 return rc;
178
179 hccr = (struct xhci_hccr *)priv->gen_priv.base;
180 hcor = (struct xhci_hcor *)(priv->gen_priv.base +
181 HC_LENGTH(xhci_readl(&(hccr)->cr_capbase)));
182
183 return xhci_register(dev, hccr, hcor);
184}
185
186static int dwc3_generic_host_remove(struct udevice *dev)
187{
188 struct dwc3_generic_host_priv *priv = dev_get_priv(dev);
189 int rc;
190
191 rc = xhci_deregister(dev);
192 if (rc)
193 return rc;
194
195 return dwc3_generic_remove(dev, &priv->gen_priv);
196}
197
198U_BOOT_DRIVER(dwc3_generic_host) = {
199 .name = "dwc3-generic-host",
200 .id = UCLASS_USB,
Simon Glassaad29ae2020-12-03 16:55:21 -0700201 .of_to_plat = dwc3_generic_of_to_plat,
Jean-Jacques Hiblot175cd7c2019-09-11 11:33:50 +0200202 .probe = dwc3_generic_host_probe,
203 .remove = dwc3_generic_host_remove,
Simon Glass8a2b47f2020-12-03 16:55:17 -0700204 .priv_auto = sizeof(struct dwc3_generic_host_priv),
Simon Glass71fa5b42020-12-03 16:55:18 -0700205 .plat_auto = sizeof(struct dwc3_generic_plat),
Jean-Jacques Hiblot175cd7c2019-09-11 11:33:50 +0200206 .ops = &xhci_usb_ops,
207 .flags = DM_FLAG_ALLOC_PRIV_DMA,
208};
209#endif
210
Jean-Jacques Hiblotae004d32018-11-29 10:52:49 +0100211struct dwc3_glue_ops {
212 void (*select_dr_mode)(struct udevice *dev, int index,
213 enum usb_dr_mode mode);
214};
215
Jean-Jacques Hiblot65596f12018-11-29 10:57:40 +0100216void dwc3_ti_select_dr_mode(struct udevice *dev, int index,
217 enum usb_dr_mode mode)
218{
219#define USBOTGSS_UTMI_OTG_STATUS 0x0084
220#define USBOTGSS_UTMI_OTG_OFFSET 0x0480
221
222/* UTMI_OTG_STATUS REGISTER */
223#define USBOTGSS_UTMI_OTG_STATUS_SW_MODE BIT(31)
224#define USBOTGSS_UTMI_OTG_STATUS_POWERPRESENT BIT(9)
225#define USBOTGSS_UTMI_OTG_STATUS_TXBITSTUFFENABLE BIT(8)
226#define USBOTGSS_UTMI_OTG_STATUS_IDDIG BIT(4)
227#define USBOTGSS_UTMI_OTG_STATUS_SESSEND BIT(3)
228#define USBOTGSS_UTMI_OTG_STATUS_SESSVALID BIT(2)
229#define USBOTGSS_UTMI_OTG_STATUS_VBUSVALID BIT(1)
230enum dwc3_omap_utmi_mode {
231 DWC3_OMAP_UTMI_MODE_UNKNOWN = 0,
232 DWC3_OMAP_UTMI_MODE_HW,
233 DWC3_OMAP_UTMI_MODE_SW,
234};
235
236 u32 use_id_pin;
237 u32 host_mode;
238 u32 reg;
239 u32 utmi_mode;
240 u32 utmi_status_offset = USBOTGSS_UTMI_OTG_STATUS;
241
Simon Glassfa20e932020-12-03 16:55:20 -0700242 struct dwc3_glue_data *glue = dev_get_plat(dev);
Jean-Jacques Hiblot65596f12018-11-29 10:57:40 +0100243 void *base = map_physmem(glue->regs, 0x10000, MAP_NOCACHE);
244
245 if (device_is_compatible(dev, "ti,am437x-dwc3"))
246 utmi_status_offset += USBOTGSS_UTMI_OTG_OFFSET;
247
248 utmi_mode = dev_read_u32_default(dev, "utmi-mode",
249 DWC3_OMAP_UTMI_MODE_UNKNOWN);
250 if (utmi_mode != DWC3_OMAP_UTMI_MODE_HW) {
251 debug("%s: OTG is not supported. defaulting to PERIPHERAL\n",
252 dev->name);
253 mode = USB_DR_MODE_PERIPHERAL;
254 }
255
256 switch (mode) {
257 case USB_DR_MODE_PERIPHERAL:
258 use_id_pin = 0;
259 host_mode = 0;
260 break;
261 case USB_DR_MODE_HOST:
262 use_id_pin = 0;
263 host_mode = 1;
264 break;
265 case USB_DR_MODE_OTG:
266 default:
267 use_id_pin = 1;
268 host_mode = 0;
269 break;
270 }
271
272 reg = readl(base + utmi_status_offset);
273
274 reg &= ~(USBOTGSS_UTMI_OTG_STATUS_SW_MODE);
275 if (!use_id_pin)
276 reg |= USBOTGSS_UTMI_OTG_STATUS_SW_MODE;
277
278 writel(reg, base + utmi_status_offset);
279
280 reg &= ~(USBOTGSS_UTMI_OTG_STATUS_SESSEND |
281 USBOTGSS_UTMI_OTG_STATUS_VBUSVALID |
282 USBOTGSS_UTMI_OTG_STATUS_IDDIG);
283
284 reg |= USBOTGSS_UTMI_OTG_STATUS_SESSVALID |
285 USBOTGSS_UTMI_OTG_STATUS_POWERPRESENT;
286
287 if (!host_mode)
288 reg |= USBOTGSS_UTMI_OTG_STATUS_IDDIG |
289 USBOTGSS_UTMI_OTG_STATUS_VBUSVALID;
290
291 writel(reg, base + utmi_status_offset);
292
293 unmap_physmem(base, MAP_NOCACHE);
294}
295
296struct dwc3_glue_ops ti_ops = {
297 .select_dr_mode = dwc3_ti_select_dr_mode,
298};
299
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100300static int dwc3_glue_bind(struct udevice *parent)
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200301{
Kever Yang1b807052020-03-04 08:59:50 +0800302 ofnode node;
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200303 int ret;
304
Simon Glassa7ece582020-12-19 10:40:14 -0700305 ofnode_for_each_subnode(node, dev_ofnode(parent)) {
Kever Yang1b807052020-03-04 08:59:50 +0800306 const char *name = ofnode_get_name(node);
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200307 enum usb_dr_mode dr_mode;
308 struct udevice *dev;
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100309 const char *driver = NULL;
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200310
311 debug("%s: subnode name: %s\n", __func__, name);
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200312
313 dr_mode = usb_get_dr_mode(node);
314
315 switch (dr_mode) {
316 case USB_DR_MODE_PERIPHERAL:
317 case USB_DR_MODE_OTG:
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100318#if CONFIG_IS_ENABLED(DM_USB_GADGET)
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200319 debug("%s: dr_mode: OTG or Peripheral\n", __func__);
320 driver = "dwc3-generic-peripheral";
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100321#endif
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200322 break;
Simon Glass1f2440c2021-07-10 21:14:29 -0600323#if defined(CONFIG_SPL_USB_HOST) || !defined(CONFIG_SPL_BUILD)
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200324 case USB_DR_MODE_HOST:
325 debug("%s: dr_mode: HOST\n", __func__);
Jean-Jacques Hiblot175cd7c2019-09-11 11:33:50 +0200326 driver = "dwc3-generic-host";
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200327 break;
Jean-Jacques Hiblot175cd7c2019-09-11 11:33:50 +0200328#endif
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200329 default:
330 debug("%s: unsupported dr_mode\n", __func__);
331 return -ENODEV;
332 };
333
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100334 if (!driver)
335 continue;
336
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200337 ret = device_bind_driver_to_node(parent, driver, name,
Kever Yang1b807052020-03-04 08:59:50 +0800338 node, &dev);
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200339 if (ret) {
340 debug("%s: not able to bind usb device mode\n",
341 __func__);
342 return ret;
343 }
344 }
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100345
346 return 0;
347}
348
349static int dwc3_glue_reset_init(struct udevice *dev,
350 struct dwc3_glue_data *glue)
351{
352 int ret;
353
354 ret = reset_get_bulk(dev, &glue->resets);
Vignesh Raghavendrae9310fc2019-10-25 13:48:05 +0530355 if (ret == -ENOTSUPP || ret == -ENOENT)
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100356 return 0;
357 else if (ret)
358 return ret;
359
360 ret = reset_deassert_bulk(&glue->resets);
361 if (ret) {
362 reset_release_bulk(&glue->resets);
363 return ret;
364 }
365
366 return 0;
367}
368
369static int dwc3_glue_clk_init(struct udevice *dev,
370 struct dwc3_glue_data *glue)
371{
372 int ret;
373
374 ret = clk_get_bulk(dev, &glue->clks);
Vignesh Raghavendrae9310fc2019-10-25 13:48:05 +0530375 if (ret == -ENOSYS || ret == -ENOENT)
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100376 return 0;
377 if (ret)
378 return ret;
379
380#if CONFIG_IS_ENABLED(CLK)
381 ret = clk_enable_bulk(&glue->clks);
382 if (ret) {
383 clk_release_bulk(&glue->clks);
384 return ret;
385 }
386#endif
387
388 return 0;
389}
390
391static int dwc3_glue_probe(struct udevice *dev)
392{
Jean-Jacques Hiblotae004d32018-11-29 10:52:49 +0100393 struct dwc3_glue_ops *ops = (struct dwc3_glue_ops *)dev_get_driver_data(dev);
Simon Glassfa20e932020-12-03 16:55:20 -0700394 struct dwc3_glue_data *glue = dev_get_plat(dev);
Jean-Jacques Hiblotae004d32018-11-29 10:52:49 +0100395 struct udevice *child = NULL;
396 int index = 0;
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100397 int ret;
398
Jean-Jacques Hiblotae004d32018-11-29 10:52:49 +0100399 glue->regs = dev_read_addr(dev);
400
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100401 ret = dwc3_glue_clk_init(dev, glue);
402 if (ret)
403 return ret;
404
405 ret = dwc3_glue_reset_init(dev, glue);
406 if (ret)
407 return ret;
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200408
Jean-Jacques Hiblotae004d32018-11-29 10:52:49 +0100409 ret = device_find_first_child(dev, &child);
410 if (ret)
411 return ret;
412
Frank Wangf5a6c5b2020-05-26 11:34:31 +0800413 if (glue->resets.count == 0) {
414 ret = dwc3_glue_reset_init(child, glue);
415 if (ret)
416 return ret;
417 }
418
Jean-Jacques Hiblotae004d32018-11-29 10:52:49 +0100419 while (child) {
420 enum usb_dr_mode dr_mode;
421
Simon Glassa7ece582020-12-19 10:40:14 -0700422 dr_mode = usb_get_dr_mode(dev_ofnode(child));
Jean-Jacques Hiblotae004d32018-11-29 10:52:49 +0100423 device_find_next_child(&child);
424 if (ops && ops->select_dr_mode)
425 ops->select_dr_mode(dev, index, dr_mode);
426 index++;
427 }
428
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200429 return 0;
430}
431
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100432static int dwc3_glue_remove(struct udevice *dev)
433{
Simon Glassfa20e932020-12-03 16:55:20 -0700434 struct dwc3_glue_data *glue = dev_get_plat(dev);
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100435
436 reset_release_bulk(&glue->resets);
437
438 clk_release_bulk(&glue->clks);
439
Jean-Jacques Hiblot5a945572019-07-05 09:33:56 +0200440 return 0;
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100441}
442
443static const struct udevice_id dwc3_glue_ids[] = {
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200444 { .compatible = "xlnx,zynqmp-dwc3" },
Siva Durga Prasad Paladugu1eb3c302020-05-12 08:36:01 +0200445 { .compatible = "xlnx,versal-dwc3" },
Jean-Jacques Hiblot3e0684b2018-12-04 11:12:56 +0100446 { .compatible = "ti,keystone-dwc3"},
Jean-Jacques Hiblot65596f12018-11-29 10:57:40 +0100447 { .compatible = "ti,dwc3", .data = (ulong)&ti_ops },
Jean-Jacques Hiblotca848df2018-12-04 11:30:50 +0100448 { .compatible = "ti,am437x-dwc3", .data = (ulong)&ti_ops },
Vignesh Raghavendrac6282952019-12-09 10:37:29 +0530449 { .compatible = "ti,am654-dwc3" },
Frank Wangf5a6c5b2020-05-26 11:34:31 +0800450 { .compatible = "rockchip,rk3328-dwc3" },
451 { .compatible = "rockchip,rk3399-dwc3" },
Robert Marko746862b2020-09-10 16:00:05 +0200452 { .compatible = "qcom,dwc3" },
Andy Shevchenko221d7fa2020-12-03 19:45:01 +0200453 { .compatible = "intel,tangier-dwc3" },
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200454 { }
455};
456
457U_BOOT_DRIVER(dwc3_generic_wrapper) = {
458 .name = "dwc3-generic-wrapper",
Jean-Jacques Hiblotb49b5c22019-07-05 09:33:58 +0200459 .id = UCLASS_NOP,
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100460 .of_match = dwc3_glue_ids,
461 .bind = dwc3_glue_bind,
462 .probe = dwc3_glue_probe,
463 .remove = dwc3_glue_remove,
Simon Glass71fa5b42020-12-03 16:55:18 -0700464 .plat_auto = sizeof(struct dwc3_glue_data),
Jean-Jacques Hiblotaa866a02018-11-29 10:52:48 +0100465
Michal Simek9d8cbbf2018-05-18 13:15:06 +0200466};