aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorDaniel Krueger <daniel.krueger@systec-electronic.com>2014-03-25 05:32:47 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-03-27 05:20:29 -0400
commit2ddf6cd67cc561e40454d60126a8a7cb32f3328f (patch)
tree1a295940e4075d56fd9a80328ac987678ce3cae7 /drivers/gpio
parentfc860356aca3dd7cd3eed74ede29a84c55992d27 (diff)
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')
-rw-r--r--drivers/gpio/gpio-pch.c8
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,
138 unsigned long flags; 138 unsigned long flags;
139 139
140 spin_lock_irqsave(&chip->spinlock, flags); 140 spin_lock_irqsave(&chip->spinlock, flags);
141 pm = ioread32(&chip->reg->pm) & ((1 << gpio_pins[chip->ioh]) - 1);
142 pm |= (1 << nr);
143 iowrite32(pm, &chip->reg->pm);
144 141
145 reg_val = ioread32(&chip->reg->po); 142 reg_val = ioread32(&chip->reg->po);
146 if (val) 143 if (val)
@@ -148,6 +145,11 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr,
148 else 145 else
149 reg_val &= ~(1 << nr); 146 reg_val &= ~(1 << nr);
150 iowrite32(reg_val, &chip->reg->po); 147 iowrite32(reg_val, &chip->reg->po);
148
149 pm = ioread32(&chip->reg->pm) & ((1 << gpio_pins[chip->ioh]) - 1);
150 pm |= (1 << nr);
151 iowrite32(pm, &chip->reg->pm);
152
151 spin_unlock_irqrestore(&chip->spinlock, flags); 153 spin_unlock_irqrestore(&chip->spinlock, flags);
152 154
153 return 0; 155 return 0;