aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorMilan Svoboda <msvoboda@ra.rockwell.com>2007-02-07 02:43:35 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2007-02-08 09:56:51 -0500
commit32f3f49910c7e228839c1cd144dbed8da342703b (patch)
tree5ec3ad94819aed7ea5a692bd01bea587acb85084 /drivers/usb/gadget
parent45cf5eef4fa8bcd8d3aca3c2a0703d791c9ea56c (diff)
[ARM] 4141/1: consolidate functions that handles gpio in pxa2xx_udc
This patch renames pxa_gpio_set/get functions defined in drivers/usb/gadget/pxa2xx_udc.h to udc_gpio_set/get. These functions are moved from drivers/usb/gadget/pxa2xx_udc.h to include/asm-arm/arch-pxa2xx/udc.h Creates new functions: udc_gpio_to_irq, udc_gpio_init_vbus, udc_gpio_init_pullup in include/asm-arm/arch-pxa2xx/udc.h. These functions are used in drivers/usb/gadget/pxa2xx_udc.c instead of direct low-level (pxa2xx only) functions. Creates all these udc_gpio_* functions in include/asm-arm/arch-ixp4xx/udc.h. This implementation has no real code because ixp4xx doesn't use vbus - only vbus uses all these gpio functions (and because ixp4xx misses any function which converts number of gpio pin into it's irq). This is next step to make pxa2xx_udc fully work on ixp4xx platform. Signed-off-by: Milan Svoboda <msvoboda@ra.rockwell.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c16
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.h15
2 files changed, 7 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)
1756static irqreturn_t udc_vbus_irq(int irq, void *_dev) 1756static 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
178static struct pxa2xx_udc *the_controller; 178static struct pxa2xx_udc *the_controller;
179 179
180static inline int pxa_gpio_get(unsigned gpio)
181{
182 return (GPLR(gpio) & GPIO_bit(gpio)) != 0;
183}
184
185static 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/*