diff options
author | Daniel Krueger <daniel.krueger@systec-electronic.com> | 2014-03-25 10:32:47 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-03-27 10:20:29 +0100 |
commit | 2ddf6cd67cc561e40454d60126a8a7cb32f3328f (patch) | |
tree | 1a295940e4075d56fd9a80328ac987678ce3cae7 /drivers/gpio/gpio-pch.c | |
parent | fc860356aca3dd7cd3eed74ede29a84c55992d27 (diff) | |
download | linux-2ddf6cd67cc561e40454d60126a8a7cb32f3328f.tar.gz linux-2ddf6cd67cc561e40454d60126a8a7cb32f3328f.tar.bz2 linux-2ddf6cd67cc561e40454d60126a8a7cb32f3328f.zip |
pch_gpio: set value before enabling output direction
This ensures that the output signal does not toggle if set to high.
Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-pch.c')
-rw-r--r-- | drivers/gpio/gpio-pch.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index 9656c196772e..83a156397474 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c @@ -138,9 +138,6 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, unsigned long flags; spin_lock_irqsave(&chip->spinlock, flags); - pm = ioread32(&chip->reg->pm) & ((1 << gpio_pins[chip->ioh]) - 1); - pm |= (1 << nr); - iowrite32(pm, &chip->reg->pm); reg_val = ioread32(&chip->reg->po); if (val) @@ -148,6 +145,11 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, else reg_val &= ~(1 << nr); iowrite32(reg_val, &chip->reg->po); + + pm = ioread32(&chip->reg->pm) & ((1 << gpio_pins[chip->ioh]) - 1); + pm |= (1 << nr); + iowrite32(pm, &chip->reg->pm); + spin_unlock_irqrestore(&chip->spinlock, flags); return 0; |