[PATCH linux dev-4.13 1/6] gpio/aspeed: Set output latch before changing direction

Andrew Jeffery andrew at aj.id.au
Thu May 10 12:50:16 AEST 2018


On Wed, 9 May 2018, at 01:43, Christopher Bostic wrote:
> Reviewed-by: Christopher Bostic <cbostic at linux.vnet.ibm.com>
> 
> 
> On 5/7/18 8:06 PM, Benjamin Herrenschmidt wrote:
> > In aspeed_gpio_dir_out(), we need to establish the new output
> > value in the output latch *before* we change the direction
> > to output in order to avoid a glitch on the output line if
> > the previous value of the latch was different.
> >

I think Milton mentioned this in a review way back when I was upstreaming the driver, but looks like I forgot to address it.

> > Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>

Reviewed-by: Andrew Jeffery <andrew at aj.id.au>

> > ---
> >   drivers/gpio/gpio-aspeed.c | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
> > index 67f3eae3b550..ac54b9b25f74 100644
> > --- a/drivers/gpio/gpio-aspeed.c
> > +++ b/drivers/gpio/gpio-aspeed.c
> > @@ -287,11 +287,10 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc,
> >
> >   	spin_lock_irqsave(&gpio->lock, flags);
> >
> > +	__aspeed_gpio_set(gc, offset, val);
> >   	reg = ioread32(bank_val_reg(gpio, bank, GPIO_DIR));
> >   	iowrite32(reg | GPIO_BIT(offset), bank_val_reg(gpio, bank, GPIO_DIR));
> >
> > -	__aspeed_gpio_set(gc, offset, val);
> > -
> >   	spin_unlock_irqrestore(&gpio->lock, flags);
> >
> >   	return 0;
> 


More information about the openbmc mailing list