40 #include <linux/slab.h>
49 #define EHCI_INSNREG04 (0xA0)
50 #define EHCI_INSNREG04_DISABLE_UNSUSPEND (1 << 5)
51 #define EHCI_INSNREG05_ULPI (0xA4)
52 #define EHCI_INSNREG05_ULPI_CONTROL_SHIFT 31
53 #define EHCI_INSNREG05_ULPI_PORTSEL_SHIFT 24
54 #define EHCI_INSNREG05_ULPI_OPSEL_SHIFT 22
55 #define EHCI_INSNREG05_ULPI_REGADD_SHIFT 16
56 #define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8
57 #define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0
61 static const struct hc_driver ehci_omap_hc_driver;
75 static void omap_ehci_soft_phy_reset(
struct usb_hcd *hcd,
u8 port)
99 "phy reset operation timed out\n");
105 static int omap_ehci_init(
struct usb_hcd *hcd)
107 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
109 struct ehci_hcd_omap_platform_data *
pdata;
111 pdata = hcd->self.controller->platform_data;
114 if (pdata->phy_reset) {
115 if (gpio_is_valid(pdata->reset_gpio_port[0]))
118 if (gpio_is_valid(pdata->reset_gpio_port[1]))
127 omap_ehci_soft_phy_reset(hcd, 0);
129 omap_ehci_soft_phy_reset(hcd, 1);
132 ehci->
caps = hcd->regs;
134 rc = ehci_setup(hcd);
136 if (pdata->phy_reset) {
142 if (gpio_is_valid(pdata->reset_gpio_port[0]))
145 if (gpio_is_valid(pdata->reset_gpio_port[1]))
150 ehci_port_power(ehci, 1);
155 static void disable_put_regulator(
156 struct ehci_hcd_omap_platform_data *pdata)
161 if (pdata->regulator[i]) {
181 struct ehci_hcd_omap_platform_data *pdata = dev->
platform_data;
194 dev_err(dev,
"Missing parent device\n");
200 dev_err(dev,
"EHCI irq failed\n");
207 dev_err(dev,
"UHH EHCI get resource failed\n");
213 dev_err(dev,
"UHH EHCI ioremap failed\n");
220 dev_err(dev,
"failed to create hcd with err %d\n", ret);
225 hcd->rsrc_start = res->
start;
226 hcd->rsrc_len = resource_size(res);
232 pdata->regulator[
i] =
NULL;
235 snprintf(supply,
sizeof(supply),
"hsusb%d", i);
237 if (IS_ERR(pdata->regulator[i])) {
238 pdata->regulator[
i] =
NULL;
240 "failed to get ehci port%d regulator\n", i);
247 pm_runtime_get_sync(dev);
263 dev_err(dev,
"failed to add hcd with err %d\n", ret);
271 disable_put_regulator(pdata);
272 pm_runtime_put_sync(dev);
293 struct ehci_hcd_omap_platform_data *pdata = dev->
platform_data;
300 pm_runtime_put_sync(dev);
301 pm_runtime_disable(dev);
303 if (pdata->phy_reset) {
304 if (gpio_is_valid(pdata->reset_gpio_port[0]))
307 if (gpio_is_valid(pdata->reset_gpio_port[1]))
317 if (hcd->driver->shutdown)
318 hcd->driver->shutdown(hcd);
322 .probe = ehci_hcd_omap_probe,
323 .remove = ehci_hcd_omap_remove,
324 .shutdown = ehci_hcd_omap_shutdown,
334 static const struct hc_driver ehci_omap_hc_driver = {
335 .description = hcd_name,
336 .product_desc =
"OMAP-EHCI Host Controller",
337 .hcd_priv_size =
sizeof(
struct ehci_hcd),
343 .flags = HCD_MEMORY | HCD_USB2,
348 .reset = omap_ehci_init,
351 .shutdown = ehci_shutdown,
356 .urb_enqueue = ehci_urb_enqueue,
357 .urb_dequeue = ehci_urb_dequeue,
358 .endpoint_disable = ehci_endpoint_disable,
359 .endpoint_reset = ehci_endpoint_reset,
364 .get_frame_number = ehci_get_frame,
369 .hub_status_data = ehci_hub_status_data,
370 .hub_control = ehci_hub_control,
374 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,