diff options
author | Phil Sutter <n0-1@freewrt.org> | 2008-11-28 14:46:09 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-01-30 16:32:59 -0500 |
commit | 33763d571da995913299cd0509425decfa9e4be0 (patch) | |
tree | 73b23605980e686256d7901f70c38368e7e11067 | |
parent | 4aa0f4d7264bc4f54603de5db1ffcaf8912ddd23 (diff) |
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>
-rw-r--r-- | arch/mips/rb532/gpio.c | 8 |
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) | |||
169 | 169 | ||
170 | gpch = container_of(chip, struct rb532_gpio_chip, chip); | 170 | gpch = container_of(chip, struct rb532_gpio_chip, chip); |
171 | 171 | ||
172 | if (rb532_get_bit(offset, gpch->regbase + GPIOFUNC)) | 172 | /* disable alternate function in case it's set */ |
173 | return 1; /* alternate function, GPIOCFG is ignored */ | 173 | rb532_set_bit(0, offset, gpch->regbase + GPIOFUNC); |
174 | 174 | ||
175 | rb532_set_bit(0, offset, gpch->regbase + GPIOCFG); | 175 | rb532_set_bit(0, offset, gpch->regbase + GPIOCFG); |
176 | return 0; | 176 | return 0; |
@@ -186,8 +186,8 @@ static int rb532_gpio_direction_output(struct gpio_chip *chip, | |||
186 | 186 | ||
187 | gpch = container_of(chip, struct rb532_gpio_chip, chip); | 187 | gpch = container_of(chip, struct rb532_gpio_chip, chip); |
188 | 188 | ||
189 | if (rb532_get_bit(offset, gpch->regbase + GPIOFUNC)) | 189 | /* disable alternate function in case it's set */ |
190 | return 1; /* alternate function, GPIOCFG is ignored */ | 190 | rb532_set_bit(0, offset, gpch->regbase + GPIOFUNC); |
191 | 191 | ||
192 | /* set the initial output value */ | 192 | /* set the initial output value */ |
193 | rb532_set_bit(value, offset, gpch->regbase + GPIOD); | 193 | rb532_set_bit(value, offset, gpch->regbase + GPIOD); |