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>
This commit is contained in:
Phil Sutter 2008-11-28 20:46:09 +01:00 коммит произвёл Ralf Baechle
Родитель 4aa0f4d726
Коммит 33763d571d
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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); gpch = container_of(chip, struct rb532_gpio_chip, chip);
if (rb532_get_bit(offset, gpch->regbase + GPIOFUNC)) /* disable alternate function in case it's set */
return 1; /* alternate function, GPIOCFG is ignored */ rb532_set_bit(0, offset, gpch->regbase + GPIOFUNC);
rb532_set_bit(0, offset, gpch->regbase + GPIOCFG); rb532_set_bit(0, offset, gpch->regbase + GPIOCFG);
return 0; 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); gpch = container_of(chip, struct rb532_gpio_chip, chip);
if (rb532_get_bit(offset, gpch->regbase + GPIOFUNC)) /* disable alternate function in case it's set */
return 1; /* alternate function, GPIOCFG is ignored */ rb532_set_bit(0, offset, gpch->regbase + GPIOFUNC);
/* set the initial output value */ /* set the initial output value */
rb532_set_bit(value, offset, gpch->regbase + GPIOD); rb532_set_bit(value, offset, gpch->regbase + GPIOD);