25 #define to_spear_ehci(hcd) (struct spear_ehci *)hcd_to_ehci(hcd)
27 static void spear_start_ehci(
struct spear_ehci *ehci)
29 clk_prepare_enable(ehci->
clk);
32 static void spear_stop_ehci(
struct spear_ehci *ehci)
34 clk_disable_unprepare(ehci->
clk);
37 static int ehci_spear_setup(
struct usb_hcd *hcd)
39 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
43 ehci->
caps = hcd->regs;
45 retval = ehci_setup(hcd);
49 ehci_port_power(ehci, 0);
54 static const struct hc_driver ehci_spear_hc_driver = {
55 .description = hcd_name,
56 .product_desc =
"SPEAr EHCI",
61 .flags = HCD_MEMORY | HCD_USB2,
64 .reset = ehci_spear_setup,
67 .shutdown = ehci_shutdown,
70 .urb_enqueue = ehci_urb_enqueue,
71 .urb_dequeue = ehci_urb_dequeue,
72 .endpoint_disable = ehci_endpoint_disable,
73 .endpoint_reset = ehci_endpoint_reset,
76 .get_frame_number = ehci_get_frame,
79 .hub_status_data = ehci_hub_status_data,
80 .hub_control = ehci_hub_control,
83 .relinquish_port = ehci_relinquish_port,
84 .port_handed_over = ehci_port_handed_over,
85 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
89 static int ehci_spear_drv_suspend(
struct device *
dev)
92 bool do_wakeup = device_may_wakeup(dev);
94 return ehci_suspend(hcd, do_wakeup);
97 static int ehci_spear_drv_resume(
struct device *
dev)
101 ehci_resume(hcd,
false);
107 ehci_spear_drv_resume);
113 struct usb_hcd *hcd ;
116 struct clk *usbh_clk;
117 const struct hc_driver *
driver = &ehci_spear_hc_driver;
119 char clk_name[20] =
"usbh_clk";
120 static int instance = -1;
136 if (!pdev->
dev.dma_mask)
137 pdev->
dev.dma_mask = &spear_ehci_dma_mask;
146 sprintf(clk_name,
"usbh.%01d_clk", instance);
149 if (IS_ERR(usbh_clk)) {
150 dev_err(&pdev->
dev,
"Error getting interface clock\n");
151 retval = PTR_ERR(usbh_clk);
152 goto fail_get_usbh_clk;
158 goto fail_create_hcd;
164 goto fail_request_resource;
167 hcd->rsrc_start = res->
start;
168 hcd->rsrc_len = resource_size(res);
170 driver->description)) {
172 goto fail_request_resource;
175 hcd->regs =
ioremap(hcd->rsrc_start, hcd->rsrc_len);
176 if (hcd->regs ==
NULL) {
177 dev_dbg(&pdev->
dev,
"error mapping memory\n");
183 ehci->
clk = usbh_clk;
185 spear_start_ehci(ehci);
193 spear_stop_ehci(ehci);
197 fail_request_resource:
203 dev_err(&pdev->
dev,
"init fail, %d\n", retval);
210 struct usb_hcd *hcd = platform_get_drvdata(pdev);
220 spear_stop_ehci(ehci_p);
232 { .compatible =
"st,spear600-ehci", },
237 .probe = spear_ehci_hcd_drv_probe,
238 .remove = spear_ehci_hcd_drv_remove,
241 .name =
"spear-ehci",
243 .pm = &ehci_spear_pm_ops,