22 #ifndef CONFIG_ARCH_DAVINCI_DA8XX
23 #error "This file is DA8xx bus glue. Define CONFIG_ARCH_DAVINCI_DA8XX."
26 #define CFGCHIP2 DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)
28 static struct clk *usb11_clk;
29 static struct clk *usb20_clk;
32 static volatile u16 ocic_mask;
34 static void ohci_da8xx_clock(
int on)
54 pr_info(
"Waiting for USB PHY clock good...\n");
78 ocic_mask |= 1 <<
port;
85 static int ohci_da8xx_init(
struct usb_hcd *hcd)
87 struct device *
dev = hcd->self.controller;
93 dev_dbg(dev,
"starting USB controller\n");
103 result = ohci_init(ohci);
123 rh_a |= hub->
potpgt << 24;
129 static void ohci_da8xx_stop(
struct usb_hcd *hcd)
135 static int ohci_da8xx_start(
struct usb_hcd *hcd)
137 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
140 result = ohci_run(ohci);
142 ohci_da8xx_stop(hcd);
150 static int ohci_da8xx_hub_status_data(
struct usb_hcd *hcd,
char *
buf)
152 int length = ohci_hub_status_data(hcd, buf);
155 if (ocic_mask & (1 << 1)) {
156 dev_dbg(hcd->self.controller,
"over-current indicator change "
170 static int ohci_da8xx_hub_control(
struct usb_hcd *hcd,
u16 typeReq,
u16 wValue,
173 struct device *dev = hcd->self.controller;
183 dev_dbg(dev,
"GetPortStatus(%u)\n", wIndex);
185 temp = roothub_portstatus(hcd_to_ohci(hcd), wIndex - 1);
196 if (ocic_mask & (1 << wIndex))
204 case ClearPortFeature:
214 dev_dbg(dev,
"%sPortFeature(%u): %s\n",
215 temp ?
"Set" :
"Clear", wIndex,
"POWER");
222 dev_dbg(dev,
"%sPortFeature(%u): %s\n",
223 temp ?
"Set" :
"Clear", wIndex,
229 ocic_mask &= ~(1 <<
wIndex);
234 return ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
237 static const struct hc_driver ohci_da8xx_hc_driver = {
238 .description = hcd_name,
239 .product_desc =
"DA8xx OHCI",
240 .hcd_priv_size =
sizeof(
struct ohci_hcd),
246 .flags = HCD_USB11 | HCD_MEMORY,
251 .reset = ohci_da8xx_init,
252 .start = ohci_da8xx_start,
253 .stop = ohci_da8xx_stop,
254 .shutdown = ohci_shutdown,
259 .urb_enqueue = ohci_urb_enqueue,
260 .urb_dequeue = ohci_urb_dequeue,
261 .endpoint_disable = ohci_endpoint_disable,
266 .get_frame_number = ohci_get_frame,
271 .hub_status_data = ohci_da8xx_hub_status_data,
272 .hub_control = ohci_da8xx_hub_control,
275 .bus_suspend = ohci_bus_suspend,
276 .bus_resume = ohci_bus_resume,
292 static int usb_hcd_da8xx_probe(
const struct hc_driver *
driver,
304 if (IS_ERR(usb11_clk))
305 return PTR_ERR(usb11_clk);
308 if (IS_ERR(usb20_clk)) {
309 error = PTR_ERR(usb20_clk);
324 hcd->rsrc_start = mem->
start;
325 hcd->rsrc_len = resource_size(mem);
328 dev_dbg(&pdev->
dev,
"request_mem_region failed\n");
333 hcd->regs =
ioremap(hcd->rsrc_start, hcd->rsrc_len);
340 ohci_hcd_init(hcd_to_ohci(hcd));
381 usb_hcd_da8xx_remove(
struct usb_hcd *hcd,
struct platform_device *pdev)
396 return usb_hcd_da8xx_probe(&ohci_da8xx_hc_driver, dev);
401 struct usb_hcd *hcd = platform_get_drvdata(dev);
403 usb_hcd_da8xx_remove(hcd, dev);
404 platform_set_drvdata(dev,
NULL);
412 struct usb_hcd *hcd = platform_get_drvdata(dev);
413 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
420 hcd->state = HC_STATE_SUSPENDED;
427 struct usb_hcd *hcd = platform_get_drvdata(dev);
428 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
436 usb_hcd_resume_root_hub(hcd);
445 .probe = ohci_hcd_da8xx_drv_probe,
446 .remove = ohci_hcd_da8xx_drv_remove,
449 .suspend = ohci_da8xx_suspend,
450 .resume = ohci_da8xx_resume,