summaryrefslogtreecommitdiffstats
path: root/arch/mips/rb532
diff options
context:
space:
mode:
authorPhil Sutter <n0-1@freewrt.org>2008-11-28 20:46:09 +0100
committerRalf Baechle <ralf@linux-mips.org>2009-01-30 22:32:59 +0100
commit33763d571da995913299cd0509425decfa9e4be0 (patch)
tree73b23605980e686256d7901f70c38368e7e11067 /arch/mips/rb532
parentMIPS: RB532: Add set_type() function to IRQ struct. (diff)
downloadlinux-33763d571da995913299cd0509425decfa9e4be0.tar.xz
linux-33763d571da995913299cd0509425decfa9e4be0.zip
MIPS: RB532: Auto disable GPIO alternate function
When a driver calls gpio_set_direction_{input,output}(), it obviously doesn't want the alternate function for that pin to be active (as the direction would not matter in that case). This patch ensures alternate function is disabled when the direction is being changed. Signed-off-by: Phil Sutter <n0-1@freewrt.org> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/rb532')
-rw-r--r--arch/mips/rb532/gpio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
index e35cb75a3ae7..f5b15a17432f 100644
--- a/arch/mips/rb532/gpio.c
+++ b/arch/mips/rb532/gpio.c
@@ -169,8 +169,8 @@ static int rb532_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
gpch = container_of(chip, struct rb532_gpio_chip, chip);
- if (rb532_get_bit(offset, gpch->regbase + GPIOFUNC))
- return 1; /* alternate function, GPIOCFG is ignored */
+ /* disable alternate function in case it's set */
+ rb532_set_bit(0, offset, gpch->regbase + GPIOFUNC);
rb532_set_bit(0, offset, gpch->regbase + GPIOCFG);
return 0;
@@ -186,8 +186,8 @@ static int rb532_gpio_direction_output(struct gpio_chip *chip,
gpch = container_of(chip, struct rb532_gpio_chip, chip);
- if (rb532_get_bit(offset, gpch->regbase + GPIOFUNC))
- return 1; /* alternate function, GPIOCFG is ignored */
+ /* disable alternate function in case it's set */
+ rb532_set_bit(0, offset, gpch->regbase + GPIOFUNC);
/* set the initial output value */
rb532_set_bit(value, offset, gpch->regbase + GPIOD);