Commit 4a5aeb9e authored by Stefan Wahren's avatar Stefan Wahren Committed by Luis Henriques

pinctrl: bcm2835: Fix initial value for direction_output

commit 4c02cba1 upstream.

Currently the provided initial value for bcm2835_gpio_direction_output
has no effect. So fix this issue by changing the value before
changing the GPIO direction. As a result we need to move the function below
bcm2835_gpio_set.
Suggested-by: default avatarMartin Sperl <kernel@martin.sperl.org>
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Acked-by: default avatarEric Anholt <eric@anholt.net>
Acked-by: default avatarStephen Warren <swarren@wwwdotorg.org>
Fixes: e1b2dc70 ("pinctrl: add bcm2835 driver")
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
[ luis: backported to 3.16:
  - file rename: drivers/pinctrl/bcm/pinctrl-bcm2835.c ->
    drivers/pinctrl/pinctrl-bcm2835.c ]
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 7d7ded54
...@@ -352,12 +352,6 @@ static int bcm2835_gpio_get(struct gpio_chip *chip, unsigned offset) ...@@ -352,12 +352,6 @@ static int bcm2835_gpio_get(struct gpio_chip *chip, unsigned offset)
return bcm2835_gpio_get_bit(pc, GPLEV0, offset); return bcm2835_gpio_get_bit(pc, GPLEV0, offset);
} }
static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
return pinctrl_gpio_direction_output(chip->base + offset);
}
static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{ {
struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev); struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev);
...@@ -365,6 +359,13 @@ static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) ...@@ -365,6 +359,13 @@ static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset); bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset);
} }
static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
bcm2835_gpio_set(chip, offset, value);
return pinctrl_gpio_direction_output(chip->base + offset);
}
static int bcm2835_gpio_to_irq(struct gpio_chip *chip, unsigned offset) static int bcm2835_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{ {
struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev); struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment