When setting a GPIO pin to an output, it is important to set the value
correctly before enabling the output so that a glitch is not seen on the
pin. This glitch may be very short, but can be important if this is a
reset signal.
Fixes: b64333ce769c ("pinctrl: cygnus: add gpio/pinconf driver")
Signed-off-by: Mark Tomlinson <[email protected]>
---
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
index e2bd2dce6bb4..cadcf5eb0466 100644
--- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
+++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
@@ -348,8 +348,8 @@ static int iproc_gpio_direction_output(struct gpio_chip *gc, unsigned gpio,
unsigned long flags;
raw_spin_lock_irqsave(&chip->lock, flags);
- iproc_set_bit(chip, IPROC_GPIO_OUT_EN_OFFSET, gpio, true);
iproc_set_bit(chip, IPROC_GPIO_DATA_OUT_OFFSET, gpio, !!(val));
+ iproc_set_bit(chip, IPROC_GPIO_OUT_EN_OFFSET, gpio, true);
raw_spin_unlock_irqrestore(&chip->lock, flags);
dev_dbg(chip->dev, "gpio:%u set output, value:%d\n", gpio, val);
--
2.29.2
On 11/16/2020 1:58 PM, Mark Tomlinson wrote:
> When setting a GPIO pin to an output, it is important to set the value
> correctly before enabling the output so that a glitch is not seen on the
> pin. This glitch may be very short, but can be important if this is a
> reset signal.
>
> Fixes: b64333ce769c ("pinctrl: cygnus: add gpio/pinconf driver")
> Signed-off-by: Mark Tomlinson <[email protected]>
> ---
> drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
> index e2bd2dce6bb4..cadcf5eb0466 100644
> --- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
> +++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
> @@ -348,8 +348,8 @@ static int iproc_gpio_direction_output(struct gpio_chip *gc, unsigned gpio,
> unsigned long flags;
>
> raw_spin_lock_irqsave(&chip->lock, flags);
> - iproc_set_bit(chip, IPROC_GPIO_OUT_EN_OFFSET, gpio, true);
> iproc_set_bit(chip, IPROC_GPIO_DATA_OUT_OFFSET, gpio, !!(val));
> + iproc_set_bit(chip, IPROC_GPIO_OUT_EN_OFFSET, gpio, true);
> raw_spin_unlock_irqrestore(&chip->lock, flags);
>
> dev_dbg(chip->dev, "gpio:%u set output, value:%d\n", gpio, val);
>
Thanks. The fix looks good. Would you be able to also help fix this in
pinctrl-nsp-gpio.c ?
Acked-by: Ray Jui <[email protected]>