Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux...
[pandora-kernel.git] / drivers / usb / musb / davinci.c
index 3477800..4e97d53 100644 (file)
 #include <linux/list.h>
 #include <linux/delay.h>
 #include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
 
-#include <asm/io.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/memory.h>
-#include <asm/arch/gpio.h>
+#include <mach/hardware.h>
+#include <mach/gpio.h>
+#include <asm/memory.h>
 #include <asm/mach-types.h>
 
 #include "musb_core.h"
 
-
 #ifdef CONFIG_MACH_DAVINCI_EVM
-#include <asm/arch/i2c-client.h>
+#define GPIO_nVBUS_DRV         87
 #endif
 
 #include "davinci.h"
@@ -93,7 +93,7 @@ void musb_platform_enable(struct musb *musb)
 
        if (is_dma_capable() && !dma_off)
                printk(KERN_WARNING "%s %s: dma not reactivated\n",
-                               __FILE__, __FUNCTION__);
+                               __FILE__, __func__);
        else
                dma_off = 0;
 
@@ -121,7 +121,7 @@ void musb_platform_disable(struct musb *musb)
        musb_writel(musb->ctrl_base, DAVINCI_USB_EOI_REG, 0);
 
        if (is_dma_capable() && !dma_off)
-               WARN("dma still active\n");
+               WARNING("dma still active\n");
 }
 
 
@@ -139,7 +139,6 @@ static int vbus_state = -1;
 /* VBUS SWITCHING IS BOARD-SPECIFIC */
 
 #ifdef CONFIG_MACH_DAVINCI_EVM
-#ifndef CONFIG_MACH_DAVINCI_EVM_OTG
 
 /* I2C operations are always synchronous, and require a task context.
  * With unloaded systems, using the shared workqueue seems to suffice
@@ -147,12 +146,11 @@ static int vbus_state = -1;
  */
 static void evm_deferred_drvvbus(struct work_struct *ignored)
 {
-       davinci_i2c_expander_op(0x3a, USB_DRVVBUS, vbus_state);
+       gpio_set_value_cansleep(GPIO_nVBUS_DRV, vbus_state);
        vbus_state = !vbus_state;
 }
 static DECLARE_WORK(evm_vbus_work, evm_deferred_drvvbus);
 
-#endif /* modified board */
 #endif /* EVM */
 
 static void davinci_source_power(struct musb *musb, int is_on, int immediate)
@@ -166,21 +164,10 @@ static void davinci_source_power(struct musb *musb, int is_on, int immediate)
 
 #ifdef CONFIG_MACH_DAVINCI_EVM
        if (machine_is_davinci_evm()) {
-#ifdef CONFIG_MACH_DAVINCI_EVM_OTG
-               /* modified EVM board switching VBUS with GPIO(6) not I2C
-                * NOTE:  PINMUX0.RGB888 (bit23) must be clear
-                */
-               if (is_on)
-                       gpio_set(GPIO(6));
-               else
-                       gpio_clear(GPIO(6));
-               immediate = 1;
-#else
                if (immediate)
-                       davinci_i2c_expander_op(0x3a, USB_DRVVBUS, !is_on);
+                       gpio_set_value_cansleep(GPIO_nVBUS_DRV, vbus_state);
                else
                        schedule_work(&evm_vbus_work);
-#endif
        }
 #endif
        if (immediate)
@@ -330,7 +317,7 @@ static irqreturn_t davinci_interrupt(int irq, void *__hci)
                        musb->int_usb &= ~MUSB_INTR_VBUSERROR;
                        musb->xceiv.state = OTG_STATE_A_WAIT_VFALL;
                        mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
-                       WARN("VBUS error workaround (delay coming)\n");
+                       WARNING("VBUS error workaround (delay coming)\n");
                } else if (is_host_enabled(musb) && drvvbus) {
                        musb->is_active = 1;
                        MUSB_HST_MODE(musb);
@@ -446,7 +433,8 @@ int musb_platform_exit(struct musb *musb)
                                break;
                        if ((devctl & MUSB_DEVCTL_VBUS) != warn) {
                                warn = devctl & MUSB_DEVCTL_VBUS;
-                               DBG(1, "VBUS %d\n", warn >> MUSB_DEVCTL_VBUS_SHIFT);
+                               DBG(1, "VBUS %d\n",
+                                       warn >> MUSB_DEVCTL_VBUS_SHIFT);
                        }
                        msleep(1000);
                        maxdelay--;