diff options
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.c | 16 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.h | 15 | ||||
-rw-r--r-- | include/asm-arm/arch-ixp4xx/udc.h | 22 | ||||
-rw-r--r-- | include/asm-arm/arch-pxa/udc.h | 30 |
4 files changed, 59 insertions, 24 deletions
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index b78de9694665..3547f049237e 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -156,7 +156,7 @@ static int is_vbus_present(void) | |||
156 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; | 156 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; |
157 | 157 | ||
158 | if (mach->gpio_vbus) | 158 | if (mach->gpio_vbus) |
159 | return pxa_gpio_get(mach->gpio_vbus); | 159 | return udc_gpio_get(mach->gpio_vbus); |
160 | if (mach->udc_is_connected) | 160 | if (mach->udc_is_connected) |
161 | return mach->udc_is_connected(); | 161 | return mach->udc_is_connected(); |
162 | return 1; | 162 | return 1; |
@@ -168,7 +168,7 @@ static void pullup_off(void) | |||
168 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; | 168 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; |
169 | 169 | ||
170 | if (mach->gpio_pullup) | 170 | if (mach->gpio_pullup) |
171 | pxa_gpio_set(mach->gpio_pullup, 0); | 171 | udc_gpio_set(mach->gpio_pullup, 0); |
172 | else if (mach->udc_command) | 172 | else if (mach->udc_command) |
173 | mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); | 173 | mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); |
174 | } | 174 | } |
@@ -178,7 +178,7 @@ static void pullup_on(void) | |||
178 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; | 178 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; |
179 | 179 | ||
180 | if (mach->gpio_pullup) | 180 | if (mach->gpio_pullup) |
181 | pxa_gpio_set(mach->gpio_pullup, 1); | 181 | udc_gpio_set(mach->gpio_pullup, 1); |
182 | else if (mach->udc_command) | 182 | else if (mach->udc_command) |
183 | mach->udc_command(PXA2XX_UDC_CMD_CONNECT); | 183 | mach->udc_command(PXA2XX_UDC_CMD_CONNECT); |
184 | } | 184 | } |
@@ -1756,7 +1756,7 @@ lubbock_vbus_irq(int irq, void *_dev) | |||
1756 | static irqreturn_t udc_vbus_irq(int irq, void *_dev) | 1756 | static irqreturn_t udc_vbus_irq(int irq, void *_dev) |
1757 | { | 1757 | { |
1758 | struct pxa2xx_udc *dev = _dev; | 1758 | struct pxa2xx_udc *dev = _dev; |
1759 | int vbus = pxa_gpio_get(dev->mach->gpio_vbus); | 1759 | int vbus = udc_gpio_get(dev->mach->gpio_vbus); |
1760 | 1760 | ||
1761 | pxa2xx_udc_vbus_session(&dev->gadget, vbus); | 1761 | pxa2xx_udc_vbus_session(&dev->gadget, vbus); |
1762 | return IRQ_HANDLED; | 1762 | return IRQ_HANDLED; |
@@ -2546,15 +2546,13 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2546 | dev->dev = &pdev->dev; | 2546 | dev->dev = &pdev->dev; |
2547 | dev->mach = pdev->dev.platform_data; | 2547 | dev->mach = pdev->dev.platform_data; |
2548 | if (dev->mach->gpio_vbus) { | 2548 | if (dev->mach->gpio_vbus) { |
2549 | vbus_irq = IRQ_GPIO(dev->mach->gpio_vbus & GPIO_MD_MASK_NR); | 2549 | udc_gpio_init_vbus(dev->mach->gpio_vbus); |
2550 | pxa_gpio_mode((dev->mach->gpio_vbus & GPIO_MD_MASK_NR) | 2550 | vbus_irq = udc_gpio_to_irq(dev->mach->gpio_vbus); |
2551 | | GPIO_IN); | ||
2552 | set_irq_type(vbus_irq, IRQT_BOTHEDGE); | 2551 | set_irq_type(vbus_irq, IRQT_BOTHEDGE); |
2553 | } else | 2552 | } else |
2554 | vbus_irq = 0; | 2553 | vbus_irq = 0; |
2555 | if (dev->mach->gpio_pullup) | 2554 | if (dev->mach->gpio_pullup) |
2556 | pxa_gpio_mode((dev->mach->gpio_pullup & GPIO_MD_MASK_NR) | 2555 | udc_gpio_init_pullup(dev->mach->gpio_pullup); |
2557 | | GPIO_OUT | GPIO_DFLT_LOW); | ||
2558 | 2556 | ||
2559 | init_timer(&dev->timer); | 2557 | init_timer(&dev->timer); |
2560 | dev->timer.function = udc_watchdog; | 2558 | dev->timer.function = udc_watchdog; |
diff --git a/drivers/usb/gadget/pxa2xx_udc.h b/drivers/usb/gadget/pxa2xx_udc.h index 8e598c8bf4e3..773e549aff3f 100644 --- a/drivers/usb/gadget/pxa2xx_udc.h +++ b/drivers/usb/gadget/pxa2xx_udc.h | |||
@@ -177,21 +177,6 @@ struct pxa2xx_udc { | |||
177 | 177 | ||
178 | static struct pxa2xx_udc *the_controller; | 178 | static struct pxa2xx_udc *the_controller; |
179 | 179 | ||
180 | static inline int pxa_gpio_get(unsigned gpio) | ||
181 | { | ||
182 | return (GPLR(gpio) & GPIO_bit(gpio)) != 0; | ||
183 | } | ||
184 | |||
185 | static inline void pxa_gpio_set(unsigned gpio, int is_on) | ||
186 | { | ||
187 | int mask = GPIO_bit(gpio); | ||
188 | |||
189 | if (is_on) | ||
190 | GPSR(gpio) = mask; | ||
191 | else | ||
192 | GPCR(gpio) = mask; | ||
193 | } | ||
194 | |||
195 | /*-------------------------------------------------------------------------*/ | 180 | /*-------------------------------------------------------------------------*/ |
196 | 181 | ||
197 | /* | 182 | /* |
diff --git a/include/asm-arm/arch-ixp4xx/udc.h b/include/asm-arm/arch-ixp4xx/udc.h index dbdec36ff0d1..79b850a3be47 100644 --- a/include/asm-arm/arch-ixp4xx/udc.h +++ b/include/asm-arm/arch-ixp4xx/udc.h | |||
@@ -6,3 +6,25 @@ | |||
6 | 6 | ||
7 | extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info); | 7 | extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info); |
8 | 8 | ||
9 | static inline int udc_gpio_to_irq(unsigned gpio) | ||
10 | { | ||
11 | return 0; | ||
12 | } | ||
13 | |||
14 | static inline void udc_gpio_init_vbus(unsigned gpio) | ||
15 | { | ||
16 | } | ||
17 | |||
18 | static inline void udc_gpio_init_pullup(unsigned gpio) | ||
19 | { | ||
20 | } | ||
21 | |||
22 | static inline int udc_gpio_get(unsigned gpio) | ||
23 | { | ||
24 | return 0; | ||
25 | } | ||
26 | |||
27 | static inline void udc_gpio_set(unsigned gpio, int is_on) | ||
28 | { | ||
29 | } | ||
30 | |||
diff --git a/include/asm-arm/arch-pxa/udc.h b/include/asm-arm/arch-pxa/udc.h index 646480d37256..8bc6f9c3e3ea 100644 --- a/include/asm-arm/arch-pxa/udc.h +++ b/include/asm-arm/arch-pxa/udc.h | |||
@@ -9,3 +9,33 @@ | |||
9 | 9 | ||
10 | extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info); | 10 | extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info); |
11 | 11 | ||
12 | static inline int udc_gpio_to_irq(unsigned gpio) | ||
13 | { | ||
14 | return IRQ_GPIO(gpio & GPIO_MD_MASK_NR); | ||
15 | } | ||
16 | |||
17 | static inline void udc_gpio_init_vbus(unsigned gpio) | ||
18 | { | ||
19 | pxa_gpio_mode((gpio & GPIO_MD_MASK_NR) | GPIO_IN); | ||
20 | } | ||
21 | |||
22 | static inline void udc_gpio_init_pullup(unsigned gpio) | ||
23 | { | ||
24 | pxa_gpio_mode((gpio & GPIO_MD_MASK_NR) | GPIO_OUT | GPIO_DFLT_LOW); | ||
25 | } | ||
26 | |||
27 | static inline int udc_gpio_get(unsigned gpio) | ||
28 | { | ||
29 | return (GPLR(gpio) & GPIO_bit(gpio)) != 0; | ||
30 | } | ||
31 | |||
32 | static inline void udc_gpio_set(unsigned gpio, int is_on) | ||
33 | { | ||
34 | int mask = GPIO_bit(gpio); | ||
35 | |||
36 | if (is_on) | ||
37 | GPSR(gpio) = mask; | ||
38 | else | ||
39 | GPCR(gpio) = mask; | ||
40 | } | ||
41 | |||