]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/usb-ehci.c
USB: Generalize usb initialization for omap hw
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / usb-ehci.c
similarity index 71%
rename from arch/arm/mach-omap2/board-3430sdp-usb.c
rename to arch/arm/mach-omap2/usb-ehci.c
index 048f01702bb9ff3aae95618e44ad66f99aefc098..ffd1108fed03e99e40e85ed106847de10e3d8a5e 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * linux/arch/arm/mach-omap2/board-3430sdp-usb.c
+ * linux/arch/arm/mach-omap2/usb-ehci.c
  *
  * This file will contain the board specific details for the
- * MENTOR USB OTG and Synopsys EHCI host controllers on OMAP3430
+ * Synopsys EHCI host controller on OMAP3430
  *
- * Copyright (C) 2007 Texas Instruments
- * Author: Vikram Pandita
+ * Copyright (C) 2008 Nokia Corporation
+ * Author: Felipe Balbi <felipe.balbi@nokia.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
 #include <asm/arch/pm.h>
 #include <asm/arch/usb.h>
 
-#ifdef CONFIG_USB_MUSB_SOC
-static struct resource musb_resources[] = {
-       [0] = {
-               .start  = OMAP34XX_HSUSB_OTG_BASE,
-               .end    = OMAP34XX_HSUSB_OTG_BASE + SZ_8K - 1,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = { /* general IRQ */
-               .start  = INT_243X_HS_USB_MC,
-               .flags  = IORESOURCE_IRQ,
-       },
-       [2] = { /* DMA IRQ */
-               .start  = INT_243X_HS_USB_DMA,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static int hsotgusb_ick_on;
-
-static int musb_set_clock(struct clk *clk, int state)
-{
-       if (state) {
-               if (hsotgusb_ick_on > 0)
-                       return -ENODEV;
-
-               omap2_block_sleep();
-               clk_enable(clk);
-               hsotgusb_ick_on = 1;
-       } else {
-               if (hsotgusb_ick_on == 0)
-                       return -ENODEV;
-
-               clk_disable(clk);
-               hsotgusb_ick_on = 0;
-               omap2_allow_sleep();
-       }
-
-       return 0;
-}
-
-static struct musb_hdrc_platform_data musb_plat = {
-#ifdef CONFIG_USB_MUSB_OTG
-       .mode           = MUSB_OTG,
-#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
-       .mode           = MUSB_HOST,
-#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
-       .mode           = MUSB_PERIPHERAL,
-#endif
-       .multipoint     = 1,
-       .clock          = "hsotgusb_ick",
-       .set_clock      = musb_set_clock,
-};
-
-static u64 musb_dmamask = ~(u32)0;
-
-static struct platform_device musb_device = {
-       .name           = "musb_hdrc",
-       .id             = 0,
-       .dev = {
-               .dma_mask               = &musb_dmamask,
-               .coherent_dma_mask      = 0xffffffff,
-               .platform_data          = &musb_plat,
-       },
-       .num_resources  = ARRAY_SIZE(musb_resources),
-       .resource       = musb_resources,
-};
-#endif
-
-
-/* EHCI platform specific data */
-
 #if    defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
 static struct resource ehci_resources[] = {
        [0] = {
@@ -217,25 +146,17 @@ static void setup_ehci_io_mux(void)
 
 #endif /* EHCI specific data */
 
-void __init sdp3430_usb_init(void)
+void __init usb_ehci_init(void)
 {
-#ifdef CONFIG_USB_MUSB_SOC
-       if (platform_device_register(&musb_device) < 0) {
-               printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
-               return;
-       }
-#endif
-
 #if     defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
-
        /* Setup Pin IO MUX for EHCI */
-       setup_ehci_io_mux();
+       if (cpu_is_omap34xx())
+               setup_ehci_io_mux();
 
        if (platform_device_register(&ehci_device) < 0) {
                printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
                return;
        }
 #endif
-
 }