diff options
Diffstat (limited to 'arch/arm/mach-omap2/usb-host.c')
-rw-r--r-- | arch/arm/mach-omap2/usb-host.c | 100 |
1 files changed, 34 insertions, 66 deletions
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c index 89ae29847c5..771dc781b74 100644 --- a/arch/arm/mach-omap2/usb-host.c +++ b/arch/arm/mach-omap2/usb-host.c | |||
@@ -28,51 +28,28 @@ | |||
28 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
29 | #include <mach/irqs.h> | 29 | #include <mach/irqs.h> |
30 | #include <plat/usb.h> | 30 | #include <plat/usb.h> |
31 | #include <plat/omap_device.h> | ||
31 | 32 | ||
32 | #include "mux.h" | 33 | #include "mux.h" |
33 | 34 | ||
34 | #ifdef CONFIG_MFD_OMAP_USB_HOST | 35 | #ifdef CONFIG_MFD_OMAP_USB_HOST |
35 | 36 | ||
36 | #define OMAP_USBHS_DEVICE "usbhs-omap" | 37 | #define OMAP_USBHS_DEVICE "usbhs_omap" |
37 | 38 | #define USBHS_UHH_HWMODNAME "usb_host_hs" | |
38 | static struct resource usbhs_resources[] = { | 39 | #define USBHS_TLL_HWMODNAME "usb_tll_hs" |
39 | { | ||
40 | .name = "uhh", | ||
41 | .flags = IORESOURCE_MEM, | ||
42 | }, | ||
43 | { | ||
44 | .name = "tll", | ||
45 | .flags = IORESOURCE_MEM, | ||
46 | }, | ||
47 | { | ||
48 | .name = "ehci", | ||
49 | .flags = IORESOURCE_MEM, | ||
50 | }, | ||
51 | { | ||
52 | .name = "ehci-irq", | ||
53 | .flags = IORESOURCE_IRQ, | ||
54 | }, | ||
55 | { | ||
56 | .name = "ohci", | ||
57 | .flags = IORESOURCE_MEM, | ||
58 | }, | ||
59 | { | ||
60 | .name = "ohci-irq", | ||
61 | .flags = IORESOURCE_IRQ, | ||
62 | } | ||
63 | }; | ||
64 | |||
65 | static struct platform_device usbhs_device = { | ||
66 | .name = OMAP_USBHS_DEVICE, | ||
67 | .id = 0, | ||
68 | .num_resources = ARRAY_SIZE(usbhs_resources), | ||
69 | .resource = usbhs_resources, | ||
70 | }; | ||
71 | 40 | ||
72 | static struct usbhs_omap_platform_data usbhs_data; | 41 | static struct usbhs_omap_platform_data usbhs_data; |
73 | static struct ehci_hcd_omap_platform_data ehci_data; | 42 | static struct ehci_hcd_omap_platform_data ehci_data; |
74 | static struct ohci_hcd_omap_platform_data ohci_data; | 43 | static struct ohci_hcd_omap_platform_data ohci_data; |
75 | 44 | ||
45 | static struct omap_device_pm_latency omap_uhhtll_latency[] = { | ||
46 | { | ||
47 | .deactivate_func = omap_device_idle_hwmods, | ||
48 | .activate_func = omap_device_enable_hwmods, | ||
49 | .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, | ||
50 | }, | ||
51 | }; | ||
52 | |||
76 | /* MUX settings for EHCI pins */ | 53 | /* MUX settings for EHCI pins */ |
77 | /* | 54 | /* |
78 | * setup_ehci_io_mux - initialize IO pad mux for USBHOST | 55 | * setup_ehci_io_mux - initialize IO pad mux for USBHOST |
@@ -508,7 +485,10 @@ static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) | |||
508 | 485 | ||
509 | void __init usbhs_init(const struct usbhs_omap_board_data *pdata) | 486 | void __init usbhs_init(const struct usbhs_omap_board_data *pdata) |
510 | { | 487 | { |
511 | int i; | 488 | struct omap_hwmod *oh[2]; |
489 | struct omap_device *od; | ||
490 | int bus_id = -1; | ||
491 | int i; | ||
512 | 492 | ||
513 | for (i = 0; i < OMAP3_HS_USB_PORTS; i++) { | 493 | for (i = 0; i < OMAP3_HS_USB_PORTS; i++) { |
514 | usbhs_data.port_mode[i] = pdata->port_mode[i]; | 494 | usbhs_data.port_mode[i] = pdata->port_mode[i]; |
@@ -523,44 +503,34 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata) | |||
523 | usbhs_data.ohci_data = &ohci_data; | 503 | usbhs_data.ohci_data = &ohci_data; |
524 | 504 | ||
525 | if (cpu_is_omap34xx()) { | 505 | if (cpu_is_omap34xx()) { |
526 | usbhs_resources[0].start = OMAP34XX_UHH_CONFIG_BASE; | ||
527 | usbhs_resources[0].end = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1; | ||
528 | usbhs_resources[1].start = OMAP34XX_USBTLL_BASE; | ||
529 | usbhs_resources[1].end = OMAP34XX_USBTLL_BASE + SZ_4K - 1; | ||
530 | usbhs_resources[2].start = OMAP34XX_EHCI_BASE; | ||
531 | usbhs_resources[2].end = OMAP34XX_EHCI_BASE + SZ_1K - 1; | ||
532 | usbhs_resources[3].start = INT_34XX_EHCI_IRQ; | ||
533 | usbhs_resources[4].start = OMAP34XX_OHCI_BASE; | ||
534 | usbhs_resources[4].end = OMAP34XX_OHCI_BASE + SZ_1K - 1; | ||
535 | usbhs_resources[5].start = INT_34XX_OHCI_IRQ; | ||
536 | setup_ehci_io_mux(pdata->port_mode); | 506 | setup_ehci_io_mux(pdata->port_mode); |
537 | setup_ohci_io_mux(pdata->port_mode); | 507 | setup_ohci_io_mux(pdata->port_mode); |
538 | } else if (cpu_is_omap44xx()) { | 508 | } else if (cpu_is_omap44xx()) { |
539 | usbhs_resources[0].start = OMAP44XX_UHH_CONFIG_BASE; | ||
540 | usbhs_resources[0].end = OMAP44XX_UHH_CONFIG_BASE + SZ_1K - 1; | ||
541 | usbhs_resources[1].start = OMAP44XX_USBTLL_BASE; | ||
542 | usbhs_resources[1].end = OMAP44XX_USBTLL_BASE + SZ_4K - 1; | ||
543 | usbhs_resources[2].start = OMAP44XX_HSUSB_EHCI_BASE; | ||
544 | usbhs_resources[2].end = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1; | ||
545 | usbhs_resources[3].start = OMAP44XX_IRQ_EHCI; | ||
546 | usbhs_resources[4].start = OMAP44XX_HSUSB_OHCI_BASE; | ||
547 | usbhs_resources[4].end = OMAP44XX_HSUSB_OHCI_BASE + SZ_1K - 1; | ||
548 | usbhs_resources[5].start = OMAP44XX_IRQ_OHCI; | ||
549 | setup_4430ehci_io_mux(pdata->port_mode); | 509 | setup_4430ehci_io_mux(pdata->port_mode); |
550 | setup_4430ohci_io_mux(pdata->port_mode); | 510 | setup_4430ohci_io_mux(pdata->port_mode); |
551 | } | 511 | } |
552 | 512 | ||
553 | if (platform_device_add_data(&usbhs_device, | 513 | oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME); |
554 | &usbhs_data, sizeof(usbhs_data)) < 0) { | 514 | if (!oh[0]) { |
555 | printk(KERN_ERR "USBHS platform_device_add_data failed\n"); | 515 | pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME); |
556 | goto init_end; | 516 | return; |
557 | } | 517 | } |
558 | 518 | ||
559 | if (platform_device_register(&usbhs_device) < 0) | 519 | oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME); |
560 | printk(KERN_ERR "USBHS platform_device_register failed\n"); | 520 | if (!oh[1]) { |
521 | pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME); | ||
522 | return; | ||
523 | } | ||
561 | 524 | ||
562 | init_end: | 525 | od = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2, |
563 | return; | 526 | (void *)&usbhs_data, sizeof(usbhs_data), |
527 | omap_uhhtll_latency, | ||
528 | ARRAY_SIZE(omap_uhhtll_latency), false); | ||
529 | if (IS_ERR(od)) { | ||
530 | pr_err("Could not build hwmod devices %s,%s\n", | ||
531 | USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME); | ||
532 | return; | ||
533 | } | ||
564 | } | 534 | } |
565 | 535 | ||
566 | #else | 536 | #else |
@@ -570,5 +540,3 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata) | |||
570 | } | 540 | } |
571 | 541 | ||
572 | #endif | 542 | #endif |
573 | |||
574 | |||