]> git.karo-electronics.de Git - linux-beck.git/commitdiff
pch_gpio: set value before enabling output direction
authorDaniel Krueger <daniel.krueger@systec-electronic.com>
Tue, 25 Mar 2014 09:32:47 +0000 (10:32 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 27 Mar 2014 09:20:29 +0000 (10:20 +0100)
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>
drivers/gpio/gpio-pch.c

index 9656c196772ed0d2512074b053d360928c6cd869..83a15639747415e0d27cdc6979ce60950f2e484d 100644 (file)
@@ -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;