11 #include <linux/kernel.h>
12 #include <linux/module.h>
18 #define rdl(off) __raw_readl(hcd->regs + (off))
19 #define wrl(off, val) __raw_writel((val), hcd->regs + (off))
22 #define USB_MODE 0x1a8
23 #define USB_CAUSE 0x310
24 #define USB_MASK 0x314
25 #define USB_WINDOW_CTRL(i) (0x320 + ((i) << 4))
26 #define USB_WINDOW_BASE(i) (0x324 + ((i) << 4))
28 #define USB_PHY_PWR_CTRL 0x400
29 #define USB_PHY_TX_CTRL 0x420
30 #define USB_PHY_RX_CTRL 0x430
31 #define USB_PHY_IVREF_CTRL 0x440
32 #define USB_PHY_TST_GRP_CTRL 0x450
37 static void orion_usb_phy_v1_setup(
struct usb_hcd *hcd)
104 static int ehci_orion_setup(
struct usb_hcd *hcd)
106 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
109 retval = ehci_setup(hcd);
113 ehci_port_power(ehci, 0);
118 static const struct hc_driver ehci_orion_hc_driver = {
119 .description = hcd_name,
120 .product_desc =
"Marvell Orion EHCI",
121 .hcd_priv_size =
sizeof(
struct ehci_hcd),
127 .flags = HCD_MEMORY | HCD_USB2,
132 .reset = ehci_orion_setup,
135 .shutdown = ehci_shutdown,
140 .urb_enqueue = ehci_urb_enqueue,
141 .urb_dequeue = ehci_urb_dequeue,
142 .endpoint_disable = ehci_endpoint_disable,
143 .endpoint_reset = ehci_endpoint_reset,
148 .get_frame_number = ehci_get_frame,
153 .hub_status_data = ehci_hub_status_data,
154 .hub_control = ehci_hub_control,
157 .relinquish_port = ehci_relinquish_port,
158 .port_handed_over = ehci_port_handed_over,
160 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
164 ehci_orion_conf_mbus_windows(
struct usb_hcd *hcd,
169 for (i = 0; i < 4; i++) {
174 for (i = 0; i < dram->
num_cs; i++) {
175 const struct mbus_dram_window *
cs = dram->
cs +
i;
178 (cs->mbus_attr << 8) |
198 pr_debug(
"Initializing Orion-SoC USB Host Controller\n");
203 "Found HC with no IRQ. Check %s setup!\n",
204 dev_name(&pdev->
dev));
212 "Found HC with no register addr. Check %s setup!\n",
213 dev_name(&pdev->
dev));
219 ehci_orion_hc_driver.description)) {
220 dev_dbg(&pdev->
dev,
"controller already in use\n");
227 dev_dbg(&pdev->
dev,
"error mapping memory\n");
236 clk_prepare_enable(clk);
241 &pdev->
dev, dev_name(&pdev->
dev));
247 hcd->rsrc_start = res->
start;
248 hcd->rsrc_len = resource_size(res);
251 ehci = hcd_to_ehci(hcd);
252 ehci->
caps = hcd->regs + 0x100;
260 ehci_orion_conf_mbus_windows(hcd, dram);
269 orion_usb_phy_v1_setup(hcd);
287 clk_disable_unprepare(clk);
295 dev_name(&pdev->
dev), err);
302 struct usb_hcd *hcd = platform_get_drvdata(pdev);
312 clk_disable_unprepare(clk);
321 .probe = ehci_orion_drv_probe,
322 .remove =
__exit_p(ehci_orion_drv_remove),
324 .driver.name =
"orion-ehci",