]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
usb: musb: make Davinci *work* in mainline
authorDavid Brownell <dbrownell@users.sourceforge.net>
Fri, 20 Feb 2009 21:45:17 +0000 (13:45 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 27 Feb 2009 22:40:51 +0000 (14:40 -0800)
Now that the musb build fixes for DaVinci got merged (RC3?), kick in
the other bits needed to get it finally *working* in mainline:

 - Use clk_enable()/clk_disable() ... the "always enable USB clocks"
   code this originally relied on has since been removed.

 - Initialize the USB device only after the relevant I2C GPIOs are
   available, so the host side can properly enable VBUS.

 - Tweak init sequencing to cope with mainline's relatively late init
   of the I2C system bus for power switches, transceivers, and so on.

Sanity tested on DM6664 EVM for host and peripheral modes; that system
won't boot with CONFIG_PM enabled, so OTG can't yet be tested.  Also
verified on OMAP3.

(Unrelated:  correct the MODULE_PARM_DESC spelling of musb_debug.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Felipe Balbi <me@felipebalbi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/arm/mach-davinci/board-evm.c
arch/arm/mach-davinci/clock.c
arch/arm/mach-davinci/usb.c
drivers/usb/musb/davinci.c
drivers/usb/musb/musb_core.c

index a957d239a6838f20458525a2710fa094073f674e..38b6a9ce2a93cc8caecaa2d471e30c3198ce4421 100644 (file)
@@ -311,6 +311,9 @@ evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
        gpio_request(gpio + 7, "nCF_SEL");
        gpio_direction_output(gpio + 7, 1);
 
+       /* irlml6401 sustains over 3A, switches 5V in under 8 msec */
+       setup_usb(500, 8);
+
        return 0;
 }
 
@@ -417,9 +420,6 @@ static __init void davinci_evm_init(void)
        platform_add_devices(davinci_evm_devices,
                             ARRAY_SIZE(davinci_evm_devices));
        evm_init_i2c();
-
-       /* irlml6401 sustains over 3A, switches 5V in under 8 msec */
-       setup_usb(500, 8);
 }
 
 static __init void davinci_evm_irq_init(void)
index 28f6dbc95bd7afe8303abf89d4efb479a71c488f..abb92b7eca0c4adf20284e35ad9dac81961a12ae 100644 (file)
@@ -230,6 +230,11 @@ static struct clk davinci_clks[] = {
                .rate = &commonrate,
                .lpsc = DAVINCI_LPSC_GPIO,
        },
+       {
+               .name = "usb",
+               .rate = &commonrate,
+               .lpsc = DAVINCI_LPSC_USB,
+       },
        {
                .name = "AEMIFCLK",
                .rate = &commonrate,
index 867ead2559adf9e6b0f41f12e8af6c40b2083cc1..69680784448a20a259f96ef059e2c4c375b0ea17 100644 (file)
@@ -47,6 +47,7 @@ static struct musb_hdrc_platform_data usb_data = {
 #elif defined(CONFIG_USB_MUSB_HOST)
        .mode           = MUSB_HOST,
 #endif
+       .clock          = "usb",
        .config         = &musb_config,
 };
 
index 5a8fd5d57a11a9e303969f623157e01030d3c569..2dc7606f319c1e0e857e6c70a0178e0f477a5d6c 100644 (file)
@@ -377,18 +377,8 @@ int __init musb_platform_init(struct musb *musb)
        u32             revision;
 
        musb->mregs += DAVINCI_BASE_OFFSET;
-#if 0
-       /* REVISIT there's something odd about clocking, this
-        * didn't appear do the job ...
-        */
-       musb->clock = clk_get(pDevice, "usb");
-       if (IS_ERR(musb->clock))
-               return PTR_ERR(musb->clock);
 
-       status = clk_enable(musb->clock);
-       if (status < 0)
-               return -ENODEV;
-#endif
+       clk_enable(musb->clock);
 
        /* returns zero if e.g. not clocked */
        revision = musb_readl(tibase, DAVINCI_USB_VERSION_REG);
@@ -453,5 +443,8 @@ int musb_platform_exit(struct musb *musb)
        }
 
        phy_off();
+
+       clk_disable(musb->clock);
+
        return 0;
 }
index 2cc34fa05b7391813cb386342849b15bab714bc5..b120fdcd8894892bdbab5bacf37a8c7cbdd541df 100644 (file)
 
 
 unsigned musb_debug;
-module_param(musb_debug, uint, S_IRUGO | S_IWUSR);
+module_param_named(debug, musb_debug, uint, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug message level. Default = 0");
 
 #define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia"
@@ -2243,10 +2243,10 @@ static int __init musb_init(void)
        return platform_driver_probe(&musb_driver, musb_probe);
 }
 
-/* make us init after usbcore and before usb
- * gadget and host-side drivers start to register
+/* make us init after usbcore and i2c (transceivers, regulators, etc)
+ * and before usb gadget and host-side drivers start to register
  */
-subsys_initcall(musb_init);
+fs_initcall(musb_init);
 
 static void __exit musb_cleanup(void)
 {