Message ID | 20200911150139.13690-1-matthias.schiffer@ew.tq-group.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | i2c: mxs: use MXS_DMA_CTRL_WAIT4END instead of DMA_CTRL_ACK | expand |
Hi Matthias, On Fri, Sep 11, 2020 at 12:01 PM Matthias Schiffer <matthias.schiffer@ew.tq-group.com> wrote: > > The driver-specific usage of the DMA_CTRL_ACK flag was replaced with a > custom flag in commit ceeeb99cd821 ("dmaengine: mxs: rename custom flag"), > but i2c-mxs was not updated to use the new flag, completely breaking I2C > transactions using DMA. > > Fixes: ceeeb99cd821 ("dmaengine: mxs: rename custom flag") > Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Thanks for the fix: Reviewed-by: Fabio Estevam <festevam@gmail.com>
On Fri, Sep 11, 2020 at 05:01:39PM +0200, Matthias Schiffer wrote: > The driver-specific usage of the DMA_CTRL_ACK flag was replaced with a > custom flag in commit ceeeb99cd821 ("dmaengine: mxs: rename custom flag"), > but i2c-mxs was not updated to use the new flag, completely breaking I2C > transactions using DMA. > > Fixes: ceeeb99cd821 ("dmaengine: mxs: rename custom flag") > Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Applied to for-current, thanks!
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 9587347447f0..c4b08a924461 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c @@ -25,6 +25,7 @@ #include <linux/of_device.h> #include <linux/dma-mapping.h> #include <linux/dmaengine.h> +#include <linux/dma/mxs-dma.h> #define DRIVER_NAME "mxs-i2c" @@ -200,7 +201,8 @@ static int mxs_i2c_dma_setup_xfer(struct i2c_adapter *adap, dma_map_sg(i2c->dev, &i2c->sg_io[0], 1, DMA_TO_DEVICE); desc = dmaengine_prep_slave_sg(i2c->dmach, &i2c->sg_io[0], 1, DMA_MEM_TO_DEV, - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + DMA_PREP_INTERRUPT | + MXS_DMA_CTRL_WAIT4END); if (!desc) { dev_err(i2c->dev, "Failed to get DMA data write descriptor.\n"); @@ -228,7 +230,8 @@ static int mxs_i2c_dma_setup_xfer(struct i2c_adapter *adap, dma_map_sg(i2c->dev, &i2c->sg_io[1], 1, DMA_FROM_DEVICE); desc = dmaengine_prep_slave_sg(i2c->dmach, &i2c->sg_io[1], 1, DMA_DEV_TO_MEM, - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + DMA_PREP_INTERRUPT | + MXS_DMA_CTRL_WAIT4END); if (!desc) { dev_err(i2c->dev, "Failed to get DMA data write descriptor.\n"); @@ -260,7 +263,8 @@ static int mxs_i2c_dma_setup_xfer(struct i2c_adapter *adap, dma_map_sg(i2c->dev, i2c->sg_io, 2, DMA_TO_DEVICE); desc = dmaengine_prep_slave_sg(i2c->dmach, i2c->sg_io, 2, DMA_MEM_TO_DEV, - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + DMA_PREP_INTERRUPT | + MXS_DMA_CTRL_WAIT4END); if (!desc) { dev_err(i2c->dev, "Failed to get DMA data write descriptor.\n");
The driver-specific usage of the DMA_CTRL_ACK flag was replaced with a custom flag in commit ceeeb99cd821 ("dmaengine: mxs: rename custom flag"), but i2c-mxs was not updated to use the new flag, completely breaking I2C transactions using DMA. Fixes: ceeeb99cd821 ("dmaengine: mxs: rename custom flag") Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> --- I'm a bit out of my depth here - I have no idea what these flags are supposed to do. Looking at ceeeb99cd821, this is what I came up with, and it fixes I2C communication with multiple devices (an EEPROM and a PCF85063TP RTC) on one of our i.MX28 boards. I run-tested this on a 5.4.y kernel; given how little is happening in these drivers nowadays, I assume that the fix is still valid on newer kernels... drivers/i2c/busses/i2c-mxs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)