Patrick Delaunay | d6e53c7 | 2018-10-26 09:02:52 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 2 | /* |
| 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 Glass | 6333448 | 2019-11-14 12:57:39 -0700 | [diff] [blame] | 11 | #include <cpu_func.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 12 | #include <log.h> |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 13 | #include <dm.h> |
| 14 | #include <dm/device-internal.h> |
| 15 | #include <dm/lists.h> |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 16 | #include <dwc3-uboot.h> |
Michal Simek | bb19d62 | 2022-03-09 10:05:45 +0100 | [diff] [blame] | 17 | #include <generic-phy.h> |
Simon Glass | 4dcacfc | 2020-05-10 11:40:13 -0600 | [diff] [blame] | 18 | #include <linux/bitops.h> |
Frank Wang | f5a6c5b | 2020-05-26 11:34:31 +0800 | [diff] [blame] | 19 | #include <linux/delay.h> |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 20 | #include <linux/usb/ch9.h> |
| 21 | #include <linux/usb/gadget.h> |
| 22 | #include <malloc.h> |
| 23 | #include <usb.h> |
| 24 | #include "core.h" |
| 25 | #include "gadget.h" |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 26 | #include <reset.h> |
| 27 | #include <clk.h> |
Jean-Jacques Hiblot | 175cd7c | 2019-09-11 11:33:50 +0200 | [diff] [blame] | 28 | #include <usb/xhci.h> |
T Karthik Reddy | f7adf89 | 2022-07-08 11:21:59 +0200 | [diff] [blame] | 29 | #include <asm/gpio.h> |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 30 | |
Kunihiko Hayashi | 6cf357e | 2023-02-20 14:50:28 +0900 | [diff] [blame] | 31 | #include "dwc3-generic.h" |
Frank Wang | f5a6c5b | 2020-05-26 11:34:31 +0800 | [diff] [blame] | 32 | |
Jean-Jacques Hiblot | a33aa76 | 2019-09-11 11:33:48 +0200 | [diff] [blame] | 33 | struct dwc3_generic_plat { |
| 34 | fdt_addr_t base; |
| 35 | u32 maximum_speed; |
| 36 | enum usb_dr_mode dr_mode; |
| 37 | }; |
| 38 | |
Jean-Jacques Hiblot | a33aa76 | 2019-09-11 11:33:48 +0200 | [diff] [blame] | 39 | struct dwc3_generic_priv { |
Jean-Jacques Hiblot | 2bf2c35 | 2019-09-11 11:33:49 +0200 | [diff] [blame] | 40 | void *base; |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 41 | struct dwc3 dwc3; |
developer | f8bced1 | 2020-05-02 11:35:13 +0200 | [diff] [blame] | 42 | struct phy_bulk phys; |
Venkatesh Yadav Abbarapu | 5f70b0a | 2023-01-13 10:42:02 +0530 | [diff] [blame] | 43 | struct gpio_desc *ulpi_reset; |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 44 | }; |
| 45 | |
Jean-Jacques Hiblot | 175cd7c | 2019-09-11 11:33:50 +0200 | [diff] [blame] | 46 | struct dwc3_generic_host_priv { |
| 47 | struct xhci_ctrl xhci_ctrl; |
| 48 | struct dwc3_generic_priv gen_priv; |
| 49 | }; |
| 50 | |
Jean-Jacques Hiblot | 2bf2c35 | 2019-09-11 11:33:49 +0200 | [diff] [blame] | 51 | static int dwc3_generic_probe(struct udevice *dev, |
| 52 | struct dwc3_generic_priv *priv) |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 53 | { |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 54 | int rc; |
Simon Glass | fa20e93 | 2020-12-03 16:55:20 -0700 | [diff] [blame] | 55 | struct dwc3_generic_plat *plat = dev_get_plat(dev); |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 56 | struct dwc3 *dwc3 = &priv->dwc3; |
Simon Glass | fa20e93 | 2020-12-03 16:55:20 -0700 | [diff] [blame] | 57 | struct dwc3_glue_data *glue = dev_get_plat(dev->parent); |
Marek Vasut | aacbcb6 | 2022-11-27 15:31:52 +0100 | [diff] [blame] | 58 | int __maybe_unused index; |
| 59 | ofnode __maybe_unused node; |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 60 | |
Jean-Jacques Hiblot | ce868d0 | 2019-09-11 11:33:52 +0200 | [diff] [blame] | 61 | dwc3->dev = dev; |
Jean-Jacques Hiblot | a33aa76 | 2019-09-11 11:33:48 +0200 | [diff] [blame] | 62 | dwc3->maximum_speed = plat->maximum_speed; |
| 63 | dwc3->dr_mode = plat->dr_mode; |
Jean-Jacques Hiblot | ce868d0 | 2019-09-11 11:33:52 +0200 | [diff] [blame] | 64 | #if CONFIG_IS_ENABLED(OF_CONTROL) |
| 65 | dwc3_of_parse(dwc3); |
Marek Vasut | aacbcb6 | 2022-11-27 15:31:52 +0100 | [diff] [blame] | 66 | |
Marek Vasut | 4d28572 | 2023-02-20 14:50:25 +0900 | [diff] [blame] | 67 | /* |
| 68 | * There are currently four disparate placement possibilities of DWC3 |
| 69 | * reference clock phandle in SoC DTs: |
| 70 | * - in top level glue node, with generic subnode without clock (ZynqMP) |
| 71 | * - in top level generic node, with no subnode (i.MX8MQ) |
| 72 | * - in generic subnode, with other clock in top level node (i.MX8MP) |
| 73 | * - in both top level node and generic subnode (Rockchip) |
| 74 | * Cover all the possibilities here by looking into both nodes, start |
| 75 | * with the top level node as that seems to be used in majority of DTs |
| 76 | * to reference the clock. |
| 77 | */ |
Marek Vasut | aacbcb6 | 2022-11-27 15:31:52 +0100 | [diff] [blame] | 78 | node = dev_ofnode(dev->parent); |
| 79 | index = ofnode_stringlist_search(node, "clock-names", "ref"); |
| 80 | if (index < 0) |
| 81 | index = ofnode_stringlist_search(node, "clock-names", "ref_clk"); |
Marek Vasut | 4d28572 | 2023-02-20 14:50:25 +0900 | [diff] [blame] | 82 | if (index < 0) { |
| 83 | node = dev_ofnode(dev); |
| 84 | index = ofnode_stringlist_search(node, "clock-names", "ref"); |
| 85 | if (index < 0) |
| 86 | index = ofnode_stringlist_search(node, "clock-names", "ref_clk"); |
| 87 | } |
Marek Vasut | aacbcb6 | 2022-11-27 15:31:52 +0100 | [diff] [blame] | 88 | if (index >= 0) |
| 89 | dwc3->ref_clk = &glue->clks.clks[index]; |
Jean-Jacques Hiblot | ce868d0 | 2019-09-11 11:33:52 +0200 | [diff] [blame] | 90 | #endif |
Jean-Jacques Hiblot | a33aa76 | 2019-09-11 11:33:48 +0200 | [diff] [blame] | 91 | |
Frank Wang | f5a6c5b | 2020-05-26 11:34:31 +0800 | [diff] [blame] | 92 | /* |
| 93 | * It must hold whole USB3.0 OTG controller in resetting to hold pipe |
| 94 | * power state in P2 before initializing TypeC PHY on RK3399 platform. |
| 95 | */ |
| 96 | if (device_is_compatible(dev->parent, "rockchip,rk3399-dwc3")) { |
| 97 | reset_assert_bulk(&glue->resets); |
| 98 | udelay(1); |
| 99 | } |
| 100 | |
developer | f8bced1 | 2020-05-02 11:35:13 +0200 | [diff] [blame] | 101 | rc = dwc3_setup_phy(dev, &priv->phys); |
Siva Durga Prasad Paladugu | c37f8f3 | 2020-10-21 14:17:31 +0200 | [diff] [blame] | 102 | if (rc && rc != -ENOTSUPP) |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 103 | return rc; |
| 104 | |
T Karthik Reddy | f7adf89 | 2022-07-08 11:21:59 +0200 | [diff] [blame] | 105 | if (CONFIG_IS_ENABLED(DM_GPIO) && |
| 106 | device_is_compatible(dev->parent, "xlnx,zynqmp-dwc3")) { |
Venkatesh Yadav Abbarapu | 5f70b0a | 2023-01-13 10:42:02 +0530 | [diff] [blame] | 107 | priv->ulpi_reset = devm_gpiod_get_optional(dev->parent, "reset", |
Peter Korsgaard | 686a0f0 | 2023-06-28 14:26:48 +0200 | [diff] [blame] | 108 | GPIOD_IS_OUT | GPIOD_ACTIVE_LOW); |
Venkatesh Yadav Abbarapu | 5f70b0a | 2023-01-13 10:42:02 +0530 | [diff] [blame] | 109 | /* property is optional, don't return error! */ |
| 110 | if (priv->ulpi_reset) { |
| 111 | /* Toggle ulpi to reset the phy. */ |
| 112 | rc = dm_gpio_set_value(priv->ulpi_reset, 1); |
| 113 | if (rc) |
| 114 | return rc; |
T Karthik Reddy | f7adf89 | 2022-07-08 11:21:59 +0200 | [diff] [blame] | 115 | |
Venkatesh Yadav Abbarapu | 5f70b0a | 2023-01-13 10:42:02 +0530 | [diff] [blame] | 116 | mdelay(5); |
T Karthik Reddy | f7adf89 | 2022-07-08 11:21:59 +0200 | [diff] [blame] | 117 | |
Venkatesh Yadav Abbarapu | 5f70b0a | 2023-01-13 10:42:02 +0530 | [diff] [blame] | 118 | rc = dm_gpio_set_value(priv->ulpi_reset, 0); |
| 119 | if (rc) |
| 120 | return rc; |
T Karthik Reddy | f7adf89 | 2022-07-08 11:21:59 +0200 | [diff] [blame] | 121 | |
Venkatesh Yadav Abbarapu | 5f70b0a | 2023-01-13 10:42:02 +0530 | [diff] [blame] | 122 | mdelay(5); |
| 123 | } |
T Karthik Reddy | f7adf89 | 2022-07-08 11:21:59 +0200 | [diff] [blame] | 124 | } |
| 125 | |
Frank Wang | f5a6c5b | 2020-05-26 11:34:31 +0800 | [diff] [blame] | 126 | if (device_is_compatible(dev->parent, "rockchip,rk3399-dwc3")) |
| 127 | reset_deassert_bulk(&glue->resets); |
| 128 | |
Jean-Jacques Hiblot | 2bf2c35 | 2019-09-11 11:33:49 +0200 | [diff] [blame] | 129 | priv->base = map_physmem(plat->base, DWC3_OTG_REGS_END, MAP_NOCACHE); |
| 130 | dwc3->regs = priv->base + DWC3_GLOBALS_REGS_START; |
Jean-Jacques Hiblot | ce868d0 | 2019-09-11 11:33:52 +0200 | [diff] [blame] | 131 | |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 132 | |
| 133 | rc = dwc3_init(dwc3); |
| 134 | if (rc) { |
Jean-Jacques Hiblot | 2bf2c35 | 2019-09-11 11:33:49 +0200 | [diff] [blame] | 135 | unmap_physmem(priv->base, MAP_NOCACHE); |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 136 | return rc; |
| 137 | } |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 138 | |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 139 | return 0; |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 140 | } |
| 141 | |
Jean-Jacques Hiblot | 2bf2c35 | 2019-09-11 11:33:49 +0200 | [diff] [blame] | 142 | static int dwc3_generic_remove(struct udevice *dev, |
| 143 | struct dwc3_generic_priv *priv) |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 144 | { |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 145 | struct dwc3 *dwc3 = &priv->dwc3; |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 146 | |
T Karthik Reddy | f7adf89 | 2022-07-08 11:21:59 +0200 | [diff] [blame] | 147 | if (CONFIG_IS_ENABLED(DM_GPIO) && |
Venkatesh Yadav Abbarapu | 63d5d86 | 2023-08-09 09:03:50 +0530 | [diff] [blame] | 148 | device_is_compatible(dev->parent, "xlnx,zynqmp-dwc3") && |
| 149 | priv->ulpi_reset) { |
Venkatesh Yadav Abbarapu | 5f70b0a | 2023-01-13 10:42:02 +0530 | [diff] [blame] | 150 | struct gpio_desc *ulpi_reset = priv->ulpi_reset; |
T Karthik Reddy | f7adf89 | 2022-07-08 11:21:59 +0200 | [diff] [blame] | 151 | |
| 152 | dm_gpio_free(ulpi_reset->dev, ulpi_reset); |
| 153 | } |
| 154 | |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 155 | dwc3_remove(dwc3); |
developer | f8bced1 | 2020-05-02 11:35:13 +0200 | [diff] [blame] | 156 | dwc3_shutdown_phy(dev, &priv->phys); |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 157 | unmap_physmem(dwc3->regs, MAP_NOCACHE); |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 158 | |
| 159 | return 0; |
| 160 | } |
| 161 | |
Simon Glass | aad29ae | 2020-12-03 16:55:21 -0700 | [diff] [blame] | 162 | static int dwc3_generic_of_to_plat(struct udevice *dev) |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 163 | { |
Simon Glass | fa20e93 | 2020-12-03 16:55:20 -0700 | [diff] [blame] | 164 | struct dwc3_generic_plat *plat = dev_get_plat(dev); |
Simon Glass | a7ece58 | 2020-12-19 10:40:14 -0700 | [diff] [blame] | 165 | ofnode node = dev_ofnode(dev); |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 166 | |
Angus Ainslie | 6e382a8 | 2022-02-02 15:08:54 -0800 | [diff] [blame] | 167 | if (!strncmp(dev->name, "port", 4) || !strncmp(dev->name, "hub", 3)) { |
| 168 | /* This is a leaf so check the parent */ |
| 169 | plat->base = dev_read_addr(dev->parent); |
| 170 | } else { |
| 171 | plat->base = dev_read_addr(dev); |
| 172 | } |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 173 | |
Jean-Jacques Hiblot | a33aa76 | 2019-09-11 11:33:48 +0200 | [diff] [blame] | 174 | plat->maximum_speed = usb_get_maximum_speed(node); |
| 175 | if (plat->maximum_speed == USB_SPEED_UNKNOWN) { |
Jean-Jacques Hiblot | 547df0d | 2019-09-11 11:33:51 +0200 | [diff] [blame] | 176 | pr_info("No USB maximum speed specified. Using super speed\n"); |
| 177 | plat->maximum_speed = USB_SPEED_SUPER; |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 178 | } |
| 179 | |
Jean-Jacques Hiblot | a33aa76 | 2019-09-11 11:33:48 +0200 | [diff] [blame] | 180 | plat->dr_mode = usb_get_dr_mode(node); |
| 181 | if (plat->dr_mode == USB_DR_MODE_UNKNOWN) { |
Angus Ainslie | 6e382a8 | 2022-02-02 15:08:54 -0800 | [diff] [blame] | 182 | /* might be a leaf so check the parent for mode */ |
| 183 | node = dev_ofnode(dev->parent); |
| 184 | plat->dr_mode = usb_get_dr_mode(node); |
| 185 | if (plat->dr_mode == USB_DR_MODE_UNKNOWN) { |
| 186 | pr_err("Invalid usb mode setup\n"); |
| 187 | return -ENODEV; |
| 188 | } |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | return 0; |
| 192 | } |
| 193 | |
Jean-Jacques Hiblot | 2bf2c35 | 2019-09-11 11:33:49 +0200 | [diff] [blame] | 194 | #if CONFIG_IS_ENABLED(DM_USB_GADGET) |
| 195 | int dm_usb_gadget_handle_interrupts(struct udevice *dev) |
| 196 | { |
| 197 | struct dwc3_generic_priv *priv = dev_get_priv(dev); |
| 198 | struct dwc3 *dwc3 = &priv->dwc3; |
| 199 | |
| 200 | dwc3_gadget_uboot_handle_interrupt(dwc3); |
| 201 | |
| 202 | return 0; |
| 203 | } |
| 204 | |
| 205 | static int dwc3_generic_peripheral_probe(struct udevice *dev) |
| 206 | { |
| 207 | struct dwc3_generic_priv *priv = dev_get_priv(dev); |
| 208 | |
| 209 | return dwc3_generic_probe(dev, priv); |
| 210 | } |
| 211 | |
| 212 | static int dwc3_generic_peripheral_remove(struct udevice *dev) |
| 213 | { |
| 214 | struct dwc3_generic_priv *priv = dev_get_priv(dev); |
| 215 | |
| 216 | return dwc3_generic_remove(dev, priv); |
| 217 | } |
| 218 | |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 219 | U_BOOT_DRIVER(dwc3_generic_peripheral) = { |
| 220 | .name = "dwc3-generic-peripheral", |
Jean-Jacques Hiblot | 9dc0d5c | 2018-11-29 10:52:46 +0100 | [diff] [blame] | 221 | .id = UCLASS_USB_GADGET_GENERIC, |
Simon Glass | aad29ae | 2020-12-03 16:55:21 -0700 | [diff] [blame] | 222 | .of_to_plat = dwc3_generic_of_to_plat, |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 223 | .probe = dwc3_generic_peripheral_probe, |
| 224 | .remove = dwc3_generic_peripheral_remove, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 225 | .priv_auto = sizeof(struct dwc3_generic_priv), |
Simon Glass | 71fa5b4 | 2020-12-03 16:55:18 -0700 | [diff] [blame] | 226 | .plat_auto = sizeof(struct dwc3_generic_plat), |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 227 | }; |
Jean-Jacques Hiblot | 44aaec7 | 2018-11-29 10:52:42 +0100 | [diff] [blame] | 228 | #endif |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 229 | |
Jonas Karlman | 5e8b61b | 2023-07-30 22:59:56 +0000 | [diff] [blame] | 230 | #if CONFIG_IS_ENABLED(USB_HOST) |
Jean-Jacques Hiblot | 175cd7c | 2019-09-11 11:33:50 +0200 | [diff] [blame] | 231 | static int dwc3_generic_host_probe(struct udevice *dev) |
| 232 | { |
| 233 | struct xhci_hcor *hcor; |
| 234 | struct xhci_hccr *hccr; |
| 235 | struct dwc3_generic_host_priv *priv = dev_get_priv(dev); |
| 236 | int rc; |
| 237 | |
| 238 | rc = dwc3_generic_probe(dev, &priv->gen_priv); |
| 239 | if (rc) |
| 240 | return rc; |
| 241 | |
| 242 | hccr = (struct xhci_hccr *)priv->gen_priv.base; |
| 243 | hcor = (struct xhci_hcor *)(priv->gen_priv.base + |
| 244 | HC_LENGTH(xhci_readl(&(hccr)->cr_capbase))); |
| 245 | |
| 246 | return xhci_register(dev, hccr, hcor); |
| 247 | } |
| 248 | |
| 249 | static int dwc3_generic_host_remove(struct udevice *dev) |
| 250 | { |
| 251 | struct dwc3_generic_host_priv *priv = dev_get_priv(dev); |
| 252 | int rc; |
| 253 | |
| 254 | rc = xhci_deregister(dev); |
| 255 | if (rc) |
| 256 | return rc; |
| 257 | |
| 258 | return dwc3_generic_remove(dev, &priv->gen_priv); |
| 259 | } |
| 260 | |
| 261 | U_BOOT_DRIVER(dwc3_generic_host) = { |
| 262 | .name = "dwc3-generic-host", |
| 263 | .id = UCLASS_USB, |
Simon Glass | aad29ae | 2020-12-03 16:55:21 -0700 | [diff] [blame] | 264 | .of_to_plat = dwc3_generic_of_to_plat, |
Jean-Jacques Hiblot | 175cd7c | 2019-09-11 11:33:50 +0200 | [diff] [blame] | 265 | .probe = dwc3_generic_host_probe, |
| 266 | .remove = dwc3_generic_host_remove, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 267 | .priv_auto = sizeof(struct dwc3_generic_host_priv), |
Simon Glass | 71fa5b4 | 2020-12-03 16:55:18 -0700 | [diff] [blame] | 268 | .plat_auto = sizeof(struct dwc3_generic_plat), |
Jean-Jacques Hiblot | 175cd7c | 2019-09-11 11:33:50 +0200 | [diff] [blame] | 269 | .ops = &xhci_usb_ops, |
| 270 | .flags = DM_FLAG_ALLOC_PRIV_DMA, |
| 271 | }; |
| 272 | #endif |
| 273 | |
Marek Vasut | ae21934 | 2022-04-13 00:42:56 +0200 | [diff] [blame] | 274 | void dwc3_imx8mp_glue_configure(struct udevice *dev, int index, |
| 275 | enum usb_dr_mode mode) |
| 276 | { |
| 277 | /* USB glue registers */ |
| 278 | #define USB_CTRL0 0x00 |
| 279 | #define USB_CTRL1 0x04 |
| 280 | |
| 281 | #define USB_CTRL0_PORTPWR_EN BIT(12) /* 1 - PPC enabled (default) */ |
| 282 | #define USB_CTRL0_USB3_FIXED BIT(22) /* 1 - USB3 permanent attached */ |
| 283 | #define USB_CTRL0_USB2_FIXED BIT(23) /* 1 - USB2 permanent attached */ |
| 284 | |
| 285 | #define USB_CTRL1_OC_POLARITY BIT(16) /* 0 - HIGH / 1 - LOW */ |
| 286 | #define USB_CTRL1_PWR_POLARITY BIT(17) /* 0 - HIGH / 1 - LOW */ |
| 287 | fdt_addr_t regs = dev_read_addr_index(dev, 1); |
| 288 | void *base = map_physmem(regs, 0x8, MAP_NOCACHE); |
| 289 | u32 value; |
| 290 | |
| 291 | value = readl(base + USB_CTRL0); |
| 292 | |
| 293 | if (dev_read_bool(dev, "fsl,permanently-attached")) |
| 294 | value |= (USB_CTRL0_USB2_FIXED | USB_CTRL0_USB3_FIXED); |
| 295 | else |
| 296 | value &= ~(USB_CTRL0_USB2_FIXED | USB_CTRL0_USB3_FIXED); |
| 297 | |
| 298 | if (dev_read_bool(dev, "fsl,disable-port-power-control")) |
| 299 | value &= ~(USB_CTRL0_PORTPWR_EN); |
| 300 | else |
| 301 | value |= USB_CTRL0_PORTPWR_EN; |
| 302 | |
| 303 | writel(value, base + USB_CTRL0); |
| 304 | |
| 305 | value = readl(base + USB_CTRL1); |
| 306 | if (dev_read_bool(dev, "fsl,over-current-active-low")) |
| 307 | value |= USB_CTRL1_OC_POLARITY; |
| 308 | else |
| 309 | value &= ~USB_CTRL1_OC_POLARITY; |
| 310 | |
| 311 | if (dev_read_bool(dev, "fsl,power-active-low")) |
| 312 | value |= USB_CTRL1_PWR_POLARITY; |
| 313 | else |
| 314 | value &= ~USB_CTRL1_PWR_POLARITY; |
| 315 | |
| 316 | writel(value, base + USB_CTRL1); |
| 317 | |
| 318 | unmap_physmem(base, MAP_NOCACHE); |
| 319 | } |
| 320 | |
| 321 | struct dwc3_glue_ops imx8mp_ops = { |
| 322 | .glue_configure = dwc3_imx8mp_glue_configure, |
| 323 | }; |
| 324 | |
Marek Vasut | 68c8656 | 2022-04-13 00:42:55 +0200 | [diff] [blame] | 325 | void dwc3_ti_glue_configure(struct udevice *dev, int index, |
Jean-Jacques Hiblot | 65596f1 | 2018-11-29 10:57:40 +0100 | [diff] [blame] | 326 | enum usb_dr_mode mode) |
| 327 | { |
| 328 | #define USBOTGSS_UTMI_OTG_STATUS 0x0084 |
| 329 | #define USBOTGSS_UTMI_OTG_OFFSET 0x0480 |
| 330 | |
| 331 | /* UTMI_OTG_STATUS REGISTER */ |
| 332 | #define USBOTGSS_UTMI_OTG_STATUS_SW_MODE BIT(31) |
| 333 | #define USBOTGSS_UTMI_OTG_STATUS_POWERPRESENT BIT(9) |
| 334 | #define USBOTGSS_UTMI_OTG_STATUS_TXBITSTUFFENABLE BIT(8) |
| 335 | #define USBOTGSS_UTMI_OTG_STATUS_IDDIG BIT(4) |
| 336 | #define USBOTGSS_UTMI_OTG_STATUS_SESSEND BIT(3) |
| 337 | #define USBOTGSS_UTMI_OTG_STATUS_SESSVALID BIT(2) |
| 338 | #define USBOTGSS_UTMI_OTG_STATUS_VBUSVALID BIT(1) |
| 339 | enum dwc3_omap_utmi_mode { |
| 340 | DWC3_OMAP_UTMI_MODE_UNKNOWN = 0, |
| 341 | DWC3_OMAP_UTMI_MODE_HW, |
| 342 | DWC3_OMAP_UTMI_MODE_SW, |
| 343 | }; |
| 344 | |
| 345 | u32 use_id_pin; |
| 346 | u32 host_mode; |
| 347 | u32 reg; |
| 348 | u32 utmi_mode; |
| 349 | u32 utmi_status_offset = USBOTGSS_UTMI_OTG_STATUS; |
| 350 | |
Simon Glass | fa20e93 | 2020-12-03 16:55:20 -0700 | [diff] [blame] | 351 | struct dwc3_glue_data *glue = dev_get_plat(dev); |
Jean-Jacques Hiblot | 65596f1 | 2018-11-29 10:57:40 +0100 | [diff] [blame] | 352 | void *base = map_physmem(glue->regs, 0x10000, MAP_NOCACHE); |
| 353 | |
| 354 | if (device_is_compatible(dev, "ti,am437x-dwc3")) |
| 355 | utmi_status_offset += USBOTGSS_UTMI_OTG_OFFSET; |
| 356 | |
| 357 | utmi_mode = dev_read_u32_default(dev, "utmi-mode", |
| 358 | DWC3_OMAP_UTMI_MODE_UNKNOWN); |
| 359 | if (utmi_mode != DWC3_OMAP_UTMI_MODE_HW) { |
| 360 | debug("%s: OTG is not supported. defaulting to PERIPHERAL\n", |
| 361 | dev->name); |
| 362 | mode = USB_DR_MODE_PERIPHERAL; |
| 363 | } |
| 364 | |
| 365 | switch (mode) { |
| 366 | case USB_DR_MODE_PERIPHERAL: |
| 367 | use_id_pin = 0; |
| 368 | host_mode = 0; |
| 369 | break; |
| 370 | case USB_DR_MODE_HOST: |
| 371 | use_id_pin = 0; |
| 372 | host_mode = 1; |
| 373 | break; |
| 374 | case USB_DR_MODE_OTG: |
| 375 | default: |
| 376 | use_id_pin = 1; |
| 377 | host_mode = 0; |
| 378 | break; |
| 379 | } |
| 380 | |
| 381 | reg = readl(base + utmi_status_offset); |
| 382 | |
| 383 | reg &= ~(USBOTGSS_UTMI_OTG_STATUS_SW_MODE); |
| 384 | if (!use_id_pin) |
| 385 | reg |= USBOTGSS_UTMI_OTG_STATUS_SW_MODE; |
| 386 | |
| 387 | writel(reg, base + utmi_status_offset); |
| 388 | |
| 389 | reg &= ~(USBOTGSS_UTMI_OTG_STATUS_SESSEND | |
| 390 | USBOTGSS_UTMI_OTG_STATUS_VBUSVALID | |
| 391 | USBOTGSS_UTMI_OTG_STATUS_IDDIG); |
| 392 | |
| 393 | reg |= USBOTGSS_UTMI_OTG_STATUS_SESSVALID | |
| 394 | USBOTGSS_UTMI_OTG_STATUS_POWERPRESENT; |
| 395 | |
| 396 | if (!host_mode) |
| 397 | reg |= USBOTGSS_UTMI_OTG_STATUS_IDDIG | |
| 398 | USBOTGSS_UTMI_OTG_STATUS_VBUSVALID; |
| 399 | |
| 400 | writel(reg, base + utmi_status_offset); |
| 401 | |
| 402 | unmap_physmem(base, MAP_NOCACHE); |
| 403 | } |
| 404 | |
| 405 | struct dwc3_glue_ops ti_ops = { |
Marek Vasut | 68c8656 | 2022-04-13 00:42:55 +0200 | [diff] [blame] | 406 | .glue_configure = dwc3_ti_glue_configure, |
Jean-Jacques Hiblot | 65596f1 | 2018-11-29 10:57:40 +0100 | [diff] [blame] | 407 | }; |
| 408 | |
Jonas Karlman | 04c6ae8 | 2023-07-30 22:59:57 +0000 | [diff] [blame] | 409 | static int dwc3_rk_glue_get_ctrl_dev(struct udevice *dev, ofnode *node) |
| 410 | { |
| 411 | *node = dev_ofnode(dev); |
| 412 | if (!ofnode_valid(*node)) |
| 413 | return -EINVAL; |
| 414 | |
| 415 | return 0; |
| 416 | } |
| 417 | |
| 418 | struct dwc3_glue_ops rk_ops = { |
| 419 | .glue_get_ctrl_dev = dwc3_rk_glue_get_ctrl_dev, |
| 420 | }; |
| 421 | |
Kunihiko Hayashi | 8c42037 | 2023-02-20 14:50:26 +0900 | [diff] [blame] | 422 | static int dwc3_glue_bind_common(struct udevice *parent, ofnode node) |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 423 | { |
Kunihiko Hayashi | 8c42037 | 2023-02-20 14:50:26 +0900 | [diff] [blame] | 424 | const char *name = ofnode_get_name(node); |
Jonas Karlman | 5e8b61b | 2023-07-30 22:59:56 +0000 | [diff] [blame] | 425 | const char *driver; |
Angus Ainslie | 6e382a8 | 2022-02-02 15:08:54 -0800 | [diff] [blame] | 426 | enum usb_dr_mode dr_mode; |
Kunihiko Hayashi | 8c42037 | 2023-02-20 14:50:26 +0900 | [diff] [blame] | 427 | struct udevice *dev; |
| 428 | int ret; |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 429 | |
Kunihiko Hayashi | 8c42037 | 2023-02-20 14:50:26 +0900 | [diff] [blame] | 430 | debug("%s: subnode name: %s\n", __func__, name); |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 431 | |
Kunihiko Hayashi | 8c42037 | 2023-02-20 14:50:26 +0900 | [diff] [blame] | 432 | /* if the parent node doesn't have a mode check the leaf */ |
| 433 | dr_mode = usb_get_dr_mode(dev_ofnode(parent)); |
| 434 | if (!dr_mode) |
| 435 | dr_mode = usb_get_dr_mode(node); |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 436 | |
Jonas Karlman | 5e8b61b | 2023-07-30 22:59:56 +0000 | [diff] [blame] | 437 | if (CONFIG_IS_ENABLED(DM_USB_GADGET) && |
| 438 | (dr_mode == USB_DR_MODE_PERIPHERAL || dr_mode == USB_DR_MODE_OTG)) { |
Kunihiko Hayashi | 8c42037 | 2023-02-20 14:50:26 +0900 | [diff] [blame] | 439 | debug("%s: dr_mode: OTG or Peripheral\n", __func__); |
| 440 | driver = "dwc3-generic-peripheral"; |
Jonas Karlman | 5e8b61b | 2023-07-30 22:59:56 +0000 | [diff] [blame] | 441 | } else if (CONFIG_IS_ENABLED(USB_HOST) && dr_mode == USB_DR_MODE_HOST) { |
Kunihiko Hayashi | 8c42037 | 2023-02-20 14:50:26 +0900 | [diff] [blame] | 442 | debug("%s: dr_mode: HOST\n", __func__); |
| 443 | driver = "dwc3-generic-host"; |
Jonas Karlman | 5e8b61b | 2023-07-30 22:59:56 +0000 | [diff] [blame] | 444 | } else { |
| 445 | debug("%s: unsupported dr_mode %d\n", __func__, dr_mode); |
Kunihiko Hayashi | 8c42037 | 2023-02-20 14:50:26 +0900 | [diff] [blame] | 446 | return -ENODEV; |
Jonas Karlman | 5e8b61b | 2023-07-30 22:59:56 +0000 | [diff] [blame] | 447 | } |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 448 | |
Kunihiko Hayashi | 8c42037 | 2023-02-20 14:50:26 +0900 | [diff] [blame] | 449 | ret = device_bind_driver_to_node(parent, driver, name, |
| 450 | node, &dev); |
| 451 | if (ret) { |
| 452 | debug("%s: not able to bind usb device mode\n", |
| 453 | __func__); |
| 454 | return ret; |
| 455 | } |
| 456 | |
| 457 | return 0; |
| 458 | } |
| 459 | |
Kunihiko Hayashi | 6cf357e | 2023-02-20 14:50:28 +0900 | [diff] [blame] | 460 | int dwc3_glue_bind(struct udevice *parent) |
Kunihiko Hayashi | 8c42037 | 2023-02-20 14:50:26 +0900 | [diff] [blame] | 461 | { |
| 462 | struct dwc3_glue_ops *ops = (struct dwc3_glue_ops *)dev_get_driver_data(parent); |
| 463 | ofnode node; |
| 464 | int ret; |
| 465 | |
| 466 | if (ops && ops->glue_get_ctrl_dev) { |
| 467 | ret = ops->glue_get_ctrl_dev(parent, &node); |
| 468 | if (ret) |
| 469 | return ret; |
| 470 | |
| 471 | return dwc3_glue_bind_common(parent, node); |
| 472 | } |
| 473 | |
| 474 | ofnode_for_each_subnode(node, dev_ofnode(parent)) { |
| 475 | ret = dwc3_glue_bind_common(parent, node); |
| 476 | if (ret == -ENXIO) |
| 477 | continue; |
| 478 | if (ret) |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 479 | return ret; |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 480 | } |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 481 | |
| 482 | return 0; |
| 483 | } |
| 484 | |
| 485 | static int dwc3_glue_reset_init(struct udevice *dev, |
| 486 | struct dwc3_glue_data *glue) |
| 487 | { |
| 488 | int ret; |
| 489 | |
| 490 | ret = reset_get_bulk(dev, &glue->resets); |
Vignesh Raghavendra | e9310fc | 2019-10-25 13:48:05 +0530 | [diff] [blame] | 491 | if (ret == -ENOTSUPP || ret == -ENOENT) |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 492 | return 0; |
| 493 | else if (ret) |
| 494 | return ret; |
| 495 | |
| 496 | ret = reset_deassert_bulk(&glue->resets); |
| 497 | if (ret) { |
| 498 | reset_release_bulk(&glue->resets); |
| 499 | return ret; |
| 500 | } |
| 501 | |
| 502 | return 0; |
| 503 | } |
| 504 | |
| 505 | static int dwc3_glue_clk_init(struct udevice *dev, |
| 506 | struct dwc3_glue_data *glue) |
| 507 | { |
| 508 | int ret; |
| 509 | |
| 510 | ret = clk_get_bulk(dev, &glue->clks); |
Vignesh Raghavendra | e9310fc | 2019-10-25 13:48:05 +0530 | [diff] [blame] | 511 | if (ret == -ENOSYS || ret == -ENOENT) |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 512 | return 0; |
| 513 | if (ret) |
| 514 | return ret; |
| 515 | |
| 516 | #if CONFIG_IS_ENABLED(CLK) |
| 517 | ret = clk_enable_bulk(&glue->clks); |
| 518 | if (ret) { |
| 519 | clk_release_bulk(&glue->clks); |
| 520 | return ret; |
| 521 | } |
| 522 | #endif |
| 523 | |
| 524 | return 0; |
| 525 | } |
| 526 | |
Kunihiko Hayashi | 6cf357e | 2023-02-20 14:50:28 +0900 | [diff] [blame] | 527 | int dwc3_glue_probe(struct udevice *dev) |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 528 | { |
Jean-Jacques Hiblot | ae004d3 | 2018-11-29 10:52:49 +0100 | [diff] [blame] | 529 | struct dwc3_glue_ops *ops = (struct dwc3_glue_ops *)dev_get_driver_data(dev); |
Simon Glass | fa20e93 | 2020-12-03 16:55:20 -0700 | [diff] [blame] | 530 | struct dwc3_glue_data *glue = dev_get_plat(dev); |
Jean-Jacques Hiblot | ae004d3 | 2018-11-29 10:52:49 +0100 | [diff] [blame] | 531 | struct udevice *child = NULL; |
| 532 | int index = 0; |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 533 | int ret; |
Michal Simek | bb19d62 | 2022-03-09 10:05:45 +0100 | [diff] [blame] | 534 | struct phy phy; |
| 535 | |
| 536 | ret = generic_phy_get_by_name(dev, "usb3-phy", &phy); |
| 537 | if (!ret) { |
| 538 | ret = generic_phy_init(&phy); |
| 539 | if (ret) |
| 540 | return ret; |
Jan Kiszka | 2fe2cf0 | 2022-04-25 13:26:45 +0200 | [diff] [blame] | 541 | } else if (ret != -ENOENT && ret != -ENODATA) { |
Michal Simek | bb19d62 | 2022-03-09 10:05:45 +0100 | [diff] [blame] | 542 | debug("could not get phy (err %d)\n", ret); |
| 543 | return ret; |
| 544 | } |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 545 | |
Kunihiko Hayashi | 54c277e | 2023-02-20 14:50:29 +0900 | [diff] [blame] | 546 | glue->regs = dev_read_addr_size_index(dev, 0, &glue->size); |
Jean-Jacques Hiblot | ae004d3 | 2018-11-29 10:52:49 +0100 | [diff] [blame] | 547 | |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 548 | ret = dwc3_glue_clk_init(dev, glue); |
| 549 | if (ret) |
| 550 | return ret; |
| 551 | |
| 552 | ret = dwc3_glue_reset_init(dev, glue); |
| 553 | if (ret) |
| 554 | return ret; |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 555 | |
Jonas Karlman | fd5c3c2 | 2023-08-31 22:16:36 +0000 | [diff] [blame] | 556 | if (generic_phy_valid(&phy)) { |
Michal Simek | bb19d62 | 2022-03-09 10:05:45 +0100 | [diff] [blame] | 557 | ret = generic_phy_power_on(&phy); |
| 558 | if (ret) |
| 559 | return ret; |
| 560 | } |
| 561 | |
Jonas Karlman | ee1e070 | 2023-07-30 22:59:55 +0000 | [diff] [blame] | 562 | device_find_first_child(dev, &child); |
| 563 | if (!child) |
| 564 | return 0; |
Jean-Jacques Hiblot | ae004d3 | 2018-11-29 10:52:49 +0100 | [diff] [blame] | 565 | |
Kunihiko Hayashi | df0f5d3 | 2023-02-20 14:50:27 +0900 | [diff] [blame] | 566 | if (glue->clks.count == 0) { |
| 567 | ret = dwc3_glue_clk_init(child, glue); |
| 568 | if (ret) |
| 569 | return ret; |
| 570 | } |
| 571 | |
Frank Wang | f5a6c5b | 2020-05-26 11:34:31 +0800 | [diff] [blame] | 572 | if (glue->resets.count == 0) { |
| 573 | ret = dwc3_glue_reset_init(child, glue); |
| 574 | if (ret) |
| 575 | return ret; |
| 576 | } |
| 577 | |
Jean-Jacques Hiblot | ae004d3 | 2018-11-29 10:52:49 +0100 | [diff] [blame] | 578 | while (child) { |
| 579 | enum usb_dr_mode dr_mode; |
| 580 | |
Simon Glass | a7ece58 | 2020-12-19 10:40:14 -0700 | [diff] [blame] | 581 | dr_mode = usb_get_dr_mode(dev_ofnode(child)); |
Jean-Jacques Hiblot | ae004d3 | 2018-11-29 10:52:49 +0100 | [diff] [blame] | 582 | device_find_next_child(&child); |
Marek Vasut | 68c8656 | 2022-04-13 00:42:55 +0200 | [diff] [blame] | 583 | if (ops && ops->glue_configure) |
| 584 | ops->glue_configure(dev, index, dr_mode); |
Jean-Jacques Hiblot | ae004d3 | 2018-11-29 10:52:49 +0100 | [diff] [blame] | 585 | index++; |
| 586 | } |
| 587 | |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 588 | return 0; |
| 589 | } |
| 590 | |
Kunihiko Hayashi | 6cf357e | 2023-02-20 14:50:28 +0900 | [diff] [blame] | 591 | int dwc3_glue_remove(struct udevice *dev) |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 592 | { |
Simon Glass | fa20e93 | 2020-12-03 16:55:20 -0700 | [diff] [blame] | 593 | struct dwc3_glue_data *glue = dev_get_plat(dev); |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 594 | |
| 595 | reset_release_bulk(&glue->resets); |
| 596 | |
| 597 | clk_release_bulk(&glue->clks); |
| 598 | |
Jean-Jacques Hiblot | 5a94557 | 2019-07-05 09:33:56 +0200 | [diff] [blame] | 599 | return 0; |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 600 | } |
| 601 | |
| 602 | static const struct udevice_id dwc3_glue_ids[] = { |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 603 | { .compatible = "xlnx,zynqmp-dwc3" }, |
Siva Durga Prasad Paladugu | 1eb3c30 | 2020-05-12 08:36:01 +0200 | [diff] [blame] | 604 | { .compatible = "xlnx,versal-dwc3" }, |
Jean-Jacques Hiblot | 3e0684b | 2018-12-04 11:12:56 +0100 | [diff] [blame] | 605 | { .compatible = "ti,keystone-dwc3"}, |
Jean-Jacques Hiblot | 65596f1 | 2018-11-29 10:57:40 +0100 | [diff] [blame] | 606 | { .compatible = "ti,dwc3", .data = (ulong)&ti_ops }, |
Jean-Jacques Hiblot | ca848df | 2018-12-04 11:30:50 +0100 | [diff] [blame] | 607 | { .compatible = "ti,am437x-dwc3", .data = (ulong)&ti_ops }, |
Vignesh Raghavendra | c628295 | 2019-12-09 10:37:29 +0530 | [diff] [blame] | 608 | { .compatible = "ti,am654-dwc3" }, |
Jagan Teki | e5b9341 | 2023-06-06 22:39:14 +0530 | [diff] [blame] | 609 | { .compatible = "rockchip,rk3328-dwc3", .data = (ulong)&rk_ops }, |
Frank Wang | f5a6c5b | 2020-05-26 11:34:31 +0800 | [diff] [blame] | 610 | { .compatible = "rockchip,rk3399-dwc3" }, |
Jonas Karlman | 04c6ae8 | 2023-07-30 22:59:57 +0000 | [diff] [blame] | 611 | { .compatible = "rockchip,rk3568-dwc3", .data = (ulong)&rk_ops }, |
Robert Marko | 746862b | 2020-09-10 16:00:05 +0200 | [diff] [blame] | 612 | { .compatible = "qcom,dwc3" }, |
Marek Vasut | ae21934 | 2022-04-13 00:42:56 +0200 | [diff] [blame] | 613 | { .compatible = "fsl,imx8mp-dwc3", .data = (ulong)&imx8mp_ops }, |
Angus Ainslie | 6e382a8 | 2022-02-02 15:08:54 -0800 | [diff] [blame] | 614 | { .compatible = "fsl,imx8mq-dwc3" }, |
Andy Shevchenko | 221d7fa | 2020-12-03 19:45:01 +0200 | [diff] [blame] | 615 | { .compatible = "intel,tangier-dwc3" }, |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 616 | { } |
| 617 | }; |
| 618 | |
| 619 | U_BOOT_DRIVER(dwc3_generic_wrapper) = { |
| 620 | .name = "dwc3-generic-wrapper", |
Jean-Jacques Hiblot | b49b5c2 | 2019-07-05 09:33:58 +0200 | [diff] [blame] | 621 | .id = UCLASS_NOP, |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 622 | .of_match = dwc3_glue_ids, |
| 623 | .bind = dwc3_glue_bind, |
| 624 | .probe = dwc3_glue_probe, |
| 625 | .remove = dwc3_glue_remove, |
Simon Glass | 71fa5b4 | 2020-12-03 16:55:18 -0700 | [diff] [blame] | 626 | .plat_auto = sizeof(struct dwc3_glue_data), |
Jean-Jacques Hiblot | aa866a0 | 2018-11-29 10:52:48 +0100 | [diff] [blame] | 627 | |
Michal Simek | 9d8cbbf | 2018-05-18 13:15:06 +0200 | [diff] [blame] | 628 | }; |