Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91223
b: refs/heads/master
c: 689c04a
h: refs/heads/master
i:
  91221: 277fbe6
  91219: 70646ea
  91215: c5745b0
v: v3
  • Loading branch information
eric miao authored and Russell King committed Apr 19, 2008
1 parent dda81da commit 53f2447
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 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: 663707c1a99b23a79f9e21117b7c1bdbfe80a899
refs/heads/master: 689c04a3904d68343a9258e2de12412e3bb89d09
20 changes: 18 additions & 2 deletions trunk/arch/arm/mach-pxa/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,20 @@ static long GPIO_IRQ_rising_edge[4];
static long GPIO_IRQ_falling_edge[4];
static long GPIO_IRQ_mask[4];

/*
* On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
* function of a GPIO, and GPDRx cannot be altered once configured. It
* is attributed as "occupied" here (I know this terminology isn't
* accurate, you are welcome to propose a better one :-)
*/
static int __gpio_is_occupied(unsigned gpio)
{
if (cpu_is_pxa25x() || cpu_is_pxa27x())
return GAFR(gpio) & (0x3 << (((gpio) & 0xf) * 2));
else
return 0;
}

static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
{
int gpio, idx;
Expand All @@ -179,12 +193,14 @@ static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
GPIO_IRQ_falling_edge[idx] |
GPDR(gpio)) & GPIO_bit(gpio))
return 0;
if (GAFR(gpio) & (0x3 << (((gpio) & 0xf)*2)))

if (__gpio_is_occupied(gpio))
return 0;

type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
}

pxa_gpio_mode(gpio | GPIO_IN);
GPDR(gpio) &= ~GPIO_bit(gpio);

if (type & IRQ_TYPE_EDGE_RISING)
__set_bit(gpio, GPIO_IRQ_rising_edge);
Expand Down

0 comments on commit 53f2447

Please sign in to comment.