17 #include <linux/signal.h>
30 #include <mach/hardware.h>
31 #include <mach/irqs.h>
36 #define OMAP1510_LB_MEMSIZE 32
37 #define OMAP1510_LB_CLOCK_DIV 0xfffec10c
38 #define OMAP1510_LB_MMU_CTL 0xfffec208
39 #define OMAP1510_LB_MMU_LCK 0xfffec224
40 #define OMAP1510_LB_MMU_LD_TLB 0xfffec228
41 #define OMAP1510_LB_MMU_CAM_H 0xfffec22c
42 #define OMAP1510_LB_MMU_CAM_L 0xfffec230
43 #define OMAP1510_LB_MMU_RAM_H 0xfffec234
44 #define OMAP1510_LB_MMU_RAM_L 0xfffec238
47 #ifndef CONFIG_ARCH_OMAP
48 #error "This file is OMAP bus glue. CONFIG_OMAP must be defined."
51 #ifdef CONFIG_TPS65010
70 static struct clk *usb_host_ck;
71 static struct clk *usb_dc_ck;
72 static int host_enabled;
73 static int host_initialized;
75 static void omap_ohci_clock_power(
int on)
92 static int omap_ohci_transceiver_power(
int on)
97 | ((1 << 5) | (1 << 3)),
99 else if (machine_is_omap_osk())
104 & ~((1 << 5) | (1 << 3)),
106 else if (machine_is_omap_osk())
113 #ifdef CONFIG_ARCH_OMAP15XX
139 unsigned long lbaddr, physaddr;
146 lbaddr = tlb * 0x00100000 + OMAP1510_LB_OFFSET;
164 #define omap_1510_local_bus_power(x) {}
165 #define omap_1510_local_bus_init() {}
168 #ifdef CONFIG_USB_OTG
172 struct usb_hcd *hcd = ohci_to_hcd(ohci);
173 const unsigned port = hcd->self.otg_port - 1;
177 otg_start_hnp(hcd->phy->otg);
192 static int ohci_omap_init(
struct usb_hcd *hcd)
196 int need_transceiver = (config->
otg != 0);
199 dev_dbg(hcd->self.controller,
"starting USB Controller\n");
202 ohci_to_hcd(ohci)->self.otg_port = config->
otg;
204 ohci_to_hcd(ohci)->power_budget = 8;
208 need_transceiver = need_transceiver
209 || machine_is_omap_h2() || machine_is_omap_h3();
215 #ifdef CONFIG_USB_OTG
216 if (need_transceiver) {
218 if (!IS_ERR_OR_NULL(hcd->phy)) {
219 int status = otg_set_host(hcd->phy->otg,
220 &ohci_to_hcd(ohci)->
self);
221 dev_dbg(hcd->self.controller,
"init %s phy, status %d\n",
222 hcd->phy->label, status);
228 dev_err(hcd->self.controller,
"can't find phy\n");
235 omap_ohci_clock_power(1);
242 if ((ret = ohci_init(ohci)) < 0)
246 if (machine_is_omap_osk() || machine_is_omap_innovator()) {
247 u32 rh = roothub_a (ohci);
253 if (machine_is_omap_osk()) {
254 ohci_to_hcd(ohci)->power_budget = 250;
268 }
else if (machine_is_nokia770()) {
271 ohci_to_hcd(ohci)->power_budget = 0;
275 omap_ohci_transceiver_power(1);
285 static void ohci_omap_stop(
struct usb_hcd *hcd)
287 dev_dbg(hcd->self.controller,
"stopping USB Controller\n");
289 omap_ohci_clock_power(0);
303 static int usb_hcd_omap_probe (
const struct hc_driver *
driver,
307 struct usb_hcd *hcd = 0;
322 usb_host_ck =
clk_get(&pdev->
dev,
"usb_hhc_ck");
323 if (IS_ERR(usb_host_ck))
324 return PTR_ERR(usb_host_ck);
331 if (IS_ERR(usb_dc_ck)) {
333 return PTR_ERR(usb_dc_ck);
342 hcd->rsrc_start = pdev->
resource[0].start;
346 dev_dbg(&pdev->
dev,
"request_mem_region failed\n");
351 hcd->regs =
ioremap(hcd->rsrc_start, hcd->rsrc_len);
353 dev_err(&pdev->
dev,
"can't ioremap OHCI HCD\n");
358 ohci = hcd_to_ohci(hcd);
361 host_initialized = 0;
373 host_initialized = 1;
376 omap_ohci_clock_power(0);
404 usb_hcd_omap_remove (
struct usb_hcd *hcd,
struct platform_device *pdev)
407 if (!IS_ERR_OR_NULL(hcd->phy)) {
408 (
void) otg_set_host(hcd->phy->otg, 0);
411 if (machine_is_omap_osk())
423 ohci_omap_start (
struct usb_hcd *hcd)
426 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
431 config = hcd->self.controller->platform_data;
432 if (config->
otg || config->
rwc) {
437 if ((ret = ohci_run (ohci)) < 0) {
438 dev_err(hcd->self.controller,
"can't start\n");
447 static const struct hc_driver ohci_omap_hc_driver = {
448 .description = hcd_name,
449 .product_desc =
"OMAP OHCI",
450 .hcd_priv_size =
sizeof(
struct ohci_hcd),
456 .flags = HCD_USB11 | HCD_MEMORY,
461 .reset = ohci_omap_init,
462 .start = ohci_omap_start,
463 .stop = ohci_omap_stop,
464 .shutdown = ohci_shutdown,
469 .urb_enqueue = ohci_urb_enqueue,
470 .urb_dequeue = ohci_urb_dequeue,
471 .endpoint_disable = ohci_endpoint_disable,
476 .get_frame_number = ohci_get_frame,
481 .hub_status_data = ohci_hub_status_data,
482 .hub_control = ohci_hub_control,
484 .bus_suspend = ohci_bus_suspend,
485 .bus_resume = ohci_bus_resume,
494 return usb_hcd_omap_probe(&ohci_omap_hc_driver, dev);
499 struct usb_hcd *hcd = platform_get_drvdata(dev);
501 usb_hcd_omap_remove(hcd, dev);
502 platform_set_drvdata(dev,
NULL);
513 struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev));
519 omap_ohci_clock_power(0);
525 struct usb_hcd *hcd = platform_get_drvdata(dev);
526 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
532 omap_ohci_clock_power(1);
533 ohci_finish_controller_resume(hcd);
545 .probe = ohci_hcd_omap_drv_probe,
546 .remove = ohci_hcd_omap_drv_remove,
549 .suspend = ohci_omap_suspend,
550 .resume = ohci_omap_resume,