Re: [PATCH v2 1/2] i2c: xiic: Wait for TX empty to avoid missed TX NAKs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > > diff --git a/drivers/i2c/busses/i2c-xiic.c
> > > b/drivers/i2c/busses/i2c-xiic.c
> > > index 71391b590ada..fd623e8ad08a 100644
> > > --- a/drivers/i2c/busses/i2c-xiic.c
> > > +++ b/drivers/i2c/busses/i2c-xiic.c
> > > @@ -772,14 +772,17 @@ static irqreturn_t xiic_process(int irq, void
> > > *dev_id)
> > >                       goto out;
> > >               }
> > > 
> > > -             xiic_fill_tx_fifo(i2c);
> > > -
> > > -             /* current message sent and there is space in the
> > > fifo */
> > > -             if (!xiic_tx_space(i2c) && xiic_tx_fifo_space(i2c) >=
> > > 2) {
> > > +             if (xiic_tx_space(i2c)) {
> > > +                     xiic_fill_tx_fifo(i2c);
> > > +             } else {
> > > +                     /* current message fully written */
> > >                       dev_dbg(i2c->adap.dev.parent,
> > >                               "%s end of message sent, nmsgs:
> > > %d\n",
> > >                               __func__, i2c->nmsgs);
> > > -                     if (i2c->nmsgs > 1) {
> > > +                     /* Don't move onto the next message until the
> > > TX FIFO empties,
> > > +                      * to ensure that a NAK is not missed.
> > > +                      */
> > > +                     if (i2c->nmsgs > 1 && (pend &
> > > XIIC_INTR_TX_EMPTY_MASK)) {
> > 
> > can "pend" be both XIIC_INTR_TX_EMPTY_MASK and
> > XIIC_INTR_TX_HALF_MASK?
> > 
> 
> It's been a while since I looked at this, but I believe it potentially
> could be.

yeah... I've been fishing patches that have been left behind :-)

> However, it seems like the behavior should still be correct -
> if the TX FIFO is empty then it is also half empty, but really the fact
> it is empty is what we care about in that situation...

oh yes, sorry, because you are chekcking for:

	if (pend & (XIIC_INTR_TX_EMPTY_MASK | XIIC_INTR_TX_HALF_MASK)) {
		...
		...
		if (... && (pend & XIIC_INTR_TX_EMPTY_MASK)) {
			...
			...
		}
		...
		...
	}

So that yes, it's possible. I misread the first 'if' :-)

Then this is good to go, I'm taking both in.

The second patch had some issues as patch formatting, but I will
take care of them.

Thanks,
Andi




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux