aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Molton <spyro@f2s.com>2008-06-25 17:34:51 -0400
committerIan Molton <spyro@f2s.com>2008-07-10 15:15:10 -0400
commit8fb105f5cc7f31ff37755945378a668f4c21590e (patch)
tree52f2b358d2f6f2c7cb2a9af1b9f022d539d06a2d
parentb3d354b8d8d676c97794a5b984613d51ad683f17 (diff)
PXA UDC - allow use of inverted GPIO for pullup
Signed-off-by: Ian Molton <spyro@f2s.com>
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c6
-rw-r--r--include/asm-arm/mach/udc_pxa2xx.h1
2 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 031dceb93023..5d50031938ab 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -152,9 +152,10 @@ static int is_vbus_present(void)
152static void pullup_off(void) 152static void pullup_off(void)
153{ 153{
154 struct pxa2xx_udc_mach_info *mach = the_controller->mach; 154 struct pxa2xx_udc_mach_info *mach = the_controller->mach;
155 int off_level = mach->gpio_pullup_inverted;
155 156
156 if (mach->gpio_pullup) 157 if (mach->gpio_pullup)
157 gpio_set_value(mach->gpio_pullup, 0); 158 gpio_set_value(mach->gpio_pullup, off_level);
158 else if (mach->udc_command) 159 else if (mach->udc_command)
159 mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); 160 mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
160} 161}
@@ -162,9 +163,10 @@ static void pullup_off(void)
162static void pullup_on(void) 163static void pullup_on(void)
163{ 164{
164 struct pxa2xx_udc_mach_info *mach = the_controller->mach; 165 struct pxa2xx_udc_mach_info *mach = the_controller->mach;
166 int on_level = !mach->gpio_pullup_inverted;
165 167
166 if (mach->gpio_pullup) 168 if (mach->gpio_pullup)
167 gpio_set_value(mach->gpio_pullup, 1); 169 gpio_set_value(mach->gpio_pullup, on_level);
168 else if (mach->udc_command) 170 else if (mach->udc_command)
169 mach->udc_command(PXA2XX_UDC_CMD_CONNECT); 171 mach->udc_command(PXA2XX_UDC_CMD_CONNECT);
170} 172}
diff --git a/include/asm-arm/mach/udc_pxa2xx.h b/include/asm-arm/mach/udc_pxa2xx.h
index f9f3606986c2..9e5ed7c0f27f 100644
--- a/include/asm-arm/mach/udc_pxa2xx.h
+++ b/include/asm-arm/mach/udc_pxa2xx.h
@@ -23,6 +23,7 @@ struct pxa2xx_udc_mach_info {
23 */ 23 */
24 bool gpio_vbus_inverted; 24 bool gpio_vbus_inverted;
25 u16 gpio_vbus; /* high == vbus present */ 25 u16 gpio_vbus; /* high == vbus present */
26 bool gpio_pullup_inverted;
26 u16 gpio_pullup; /* high == pullup activated */ 27 u16 gpio_pullup; /* high == pullup activated */
27}; 28};
28 29