USB: musb: allow the Blackfin vrsel gpio to be active low
authorCliff Cai <cliff.cai@analog.com>
Fri, 12 Mar 2010 08:29:10 +0000 (10:29 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 20 May 2010 20:21:32 +0000 (13:21 -0700)
Rather than hardcoding the gpio levels for vrsel, allow the platform
resources to handle this so boards can be active high or low.

Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/musb/blackfin.c
include/linux/usb/musb.h

index 7c71eb422a9c840ed5d46f8ed5c838ae4395cfa8..eb4392f904e48ef01eeb305bd133b5d3fb520287 100644 (file)
@@ -238,10 +238,10 @@ static void bfin_vbus_power(struct musb *musb, int is_on, int sleeping)
 
 static void bfin_set_vbus(struct musb *musb, int is_on)
 {
-       if (is_on)
-               gpio_set_value(musb->config->gpio_vrsel, 1);
-       else
-               gpio_set_value(musb->config->gpio_vrsel, 0);
+       int value = musb->config->gpio_vrsel_active;
+       if (!is_on)
+               value = !value;
+       gpio_set_value(musb->config->gpio_vrsel, value);
 
        DBG(1, "VBUS %s, devctl %02x "
                /* otg %3x conf %08x prcm %08x */ "\n",
index f3d68f62dae89557edbbfac2670f98e154d77973..fbb83fe21851275cc78a7c2d7a76b84643209dc5 100644 (file)
@@ -88,6 +88,7 @@ struct musb_hdrc_config {
 #ifdef CONFIG_BLACKFIN
         /* A GPIO controlling VRSEL in Blackfin */
         unsigned int    gpio_vrsel;
+       unsigned int    gpio_vrsel_active;
 #endif
 
 };