Re: [PATCH V7 3/5] i2c: tegra: Add DMA Support

From: Dmitry Osipenko
Date: Wed Jan 30 2019 - 23:01:04 EST


Ð Thu, 31 Jan 2019 03:34:59 +0000
Sowjanya Komatineni <skomatineni@xxxxxxxxxx> ÐÐÑÐÑ:

> > I2C_INT_ALL_PACKETS_XFER_COMPLETE shall be masked for the PIO mode
> > I2C_INT_PACKET_XFER_COMPLETE shall be masked for the DMA mode, if
> > I'm not missing something.
> for packets with repeated start or continue xfer,
> PACKET_XFER_COMPLETE will be triggers for packets with stop bit, both
> PACKET_XFER_COMPLETE and ALL_PACKET_XFER_COMPLETE will be triggered.
> To be align with what PIO mode is doing, will not use
> ALL_PACKETS_XFER_COMPLETE for DMA in next version.

Sounds good.

> >
> > Handle the error-case here:
> >
> > if (i2c_dev->msg_err != I2C_ERR_NONE) {
> > dev_err(i2c_dev->dev, "i2c dma transfer failed\n");
> > goto i2c_recover;
> > }
> >
> >...
> > <--- end of tegra_i2c_xfer_msg() -->
> >
> > if (likely(i2c_dev->msg_err == I2C_ERR_NONE))
> > return 0;
> >
> > i2c_recover:
> > tegra_i2c_init(i2c_dev);
> > /* start recovery upon arbitration loss in single master
> > mode */ if (i2c_dev->msg_err == I2C_ERR_ARBITRATION_LOST) {
> > if (!i2c_dev->is_multimaster_mode)
> > return tegra_i2c_issue_bus_clear(i2c_dev);
> > return -EAGAIN;
> > }
> > if (i2c_dev->msg_err == I2C_ERR_NO_ACK) {
> > if (msg->flags & I2C_M_IGNORE_NAK)
> > return 0;
> > return -EREMOTEIO;
> > }
> >
> > return -EIO;
>
> When DMA transfer timeout, no need to check for ARB LOST or NO_ACK as
> if any of those interrupts trigger interrupt handler will terminate
> dmaengine and completes so DMA timeout will not be seen in those
> cases and falls thru msg_err check
>

Okay.