Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 48922
b: refs/heads/master
c: 32f3f49
h: refs/heads/master
v: v3
  • Loading branch information
Milan Svoboda authored and Russell King committed Feb 8, 2007
1 parent 0b0bc81 commit 24e6162
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 45cf5eef4fa8bcd8d3aca3c2a0703d791c9ea56c
refs/heads/master: 32f3f49910c7e228839c1cd144dbed8da342703b
16 changes: 7 additions & 9 deletions trunk/drivers/usb/gadget/pxa2xx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static int is_vbus_present(void)
struct pxa2xx_udc_mach_info *mach = the_controller->mach;

if (mach->gpio_vbus)
return pxa_gpio_get(mach->gpio_vbus);
return udc_gpio_get(mach->gpio_vbus);
if (mach->udc_is_connected)
return mach->udc_is_connected();
return 1;
Expand All @@ -168,7 +168,7 @@ static void pullup_off(void)
struct pxa2xx_udc_mach_info *mach = the_controller->mach;

if (mach->gpio_pullup)
pxa_gpio_set(mach->gpio_pullup, 0);
udc_gpio_set(mach->gpio_pullup, 0);
else if (mach->udc_command)
mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
}
Expand All @@ -178,7 +178,7 @@ static void pullup_on(void)
struct pxa2xx_udc_mach_info *mach = the_controller->mach;

if (mach->gpio_pullup)
pxa_gpio_set(mach->gpio_pullup, 1);
udc_gpio_set(mach->gpio_pullup, 1);
else if (mach->udc_command)
mach->udc_command(PXA2XX_UDC_CMD_CONNECT);
}
Expand Down Expand Up @@ -1756,7 +1756,7 @@ lubbock_vbus_irq(int irq, void *_dev)
static irqreturn_t udc_vbus_irq(int irq, void *_dev)
{
struct pxa2xx_udc *dev = _dev;
int vbus = pxa_gpio_get(dev->mach->gpio_vbus);
int vbus = udc_gpio_get(dev->mach->gpio_vbus);

pxa2xx_udc_vbus_session(&dev->gadget, vbus);
return IRQ_HANDLED;
Expand Down Expand Up @@ -2546,15 +2546,13 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev)
dev->dev = &pdev->dev;
dev->mach = pdev->dev.platform_data;
if (dev->mach->gpio_vbus) {
vbus_irq = IRQ_GPIO(dev->mach->gpio_vbus & GPIO_MD_MASK_NR);
pxa_gpio_mode((dev->mach->gpio_vbus & GPIO_MD_MASK_NR)
| GPIO_IN);
udc_gpio_init_vbus(dev->mach->gpio_vbus);
vbus_irq = udc_gpio_to_irq(dev->mach->gpio_vbus);
set_irq_type(vbus_irq, IRQT_BOTHEDGE);
} else
vbus_irq = 0;
if (dev->mach->gpio_pullup)
pxa_gpio_mode((dev->mach->gpio_pullup & GPIO_MD_MASK_NR)
| GPIO_OUT | GPIO_DFLT_LOW);
udc_gpio_init_pullup(dev->mach->gpio_pullup);

init_timer(&dev->timer);
dev->timer.function = udc_watchdog;
Expand Down
15 changes: 0 additions & 15 deletions trunk/drivers/usb/gadget/pxa2xx_udc.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,6 @@ struct pxa2xx_udc {

static struct pxa2xx_udc *the_controller;

static inline int pxa_gpio_get(unsigned gpio)
{
return (GPLR(gpio) & GPIO_bit(gpio)) != 0;
}

static inline void pxa_gpio_set(unsigned gpio, int is_on)
{
int mask = GPIO_bit(gpio);

if (is_on)
GPSR(gpio) = mask;
else
GPCR(gpio) = mask;
}

/*-------------------------------------------------------------------------*/

/*
Expand Down
22 changes: 22 additions & 0 deletions trunk/include/asm-arm/arch-ixp4xx/udc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,25 @@

extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info);

static inline int udc_gpio_to_irq(unsigned gpio)
{
return 0;
}

static inline void udc_gpio_init_vbus(unsigned gpio)
{
}

static inline void udc_gpio_init_pullup(unsigned gpio)
{
}

static inline int udc_gpio_get(unsigned gpio)
{
return 0;
}

static inline void udc_gpio_set(unsigned gpio, int is_on)
{
}

30 changes: 30 additions & 0 deletions trunk/include/asm-arm/arch-pxa/udc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,33 @@

extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);

static inline int udc_gpio_to_irq(unsigned gpio)
{
return IRQ_GPIO(gpio & GPIO_MD_MASK_NR);
}

static inline void udc_gpio_init_vbus(unsigned gpio)
{
pxa_gpio_mode((gpio & GPIO_MD_MASK_NR) | GPIO_IN);
}

static inline void udc_gpio_init_pullup(unsigned gpio)
{
pxa_gpio_mode((gpio & GPIO_MD_MASK_NR) | GPIO_OUT | GPIO_DFLT_LOW);
}

static inline int udc_gpio_get(unsigned gpio)
{
return (GPLR(gpio) & GPIO_bit(gpio)) != 0;
}

static inline void udc_gpio_set(unsigned gpio, int is_on)
{
int mask = GPIO_bit(gpio);

if (is_on)
GPSR(gpio) = mask;
else
GPCR(gpio) = mask;
}

0 comments on commit 24e6162

Please sign in to comment.