i2c: rcar: skip DMA if buffer is not safe
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Sat, 4 Nov 2017 20:20:09 +0000 (21:20 +0100)
committerWolfram Sang <wsa@the-dreams.de>
Sun, 3 Dec 2017 20:25:00 +0000 (21:25 +0100)
This HW is prone to races, so it needs to setup new messages in irq
context. That means we can't alloc bounce buffers if a message buffer is
not DMA safe. So, in that case, simply fall back to PIO.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-rcar.c

index 15d764afec3b29db443e5c225153270181fb2137..8a2ae3e6c561c41a2f7752debbdec145468d8024 100644 (file)
@@ -359,7 +359,7 @@ static void rcar_i2c_dma(struct rcar_i2c_priv *priv)
        int len;
 
        /* Do not use DMA if it's not available or for messages < 8 bytes */
-       if (IS_ERR(chan) || msg->len < 8)
+       if (IS_ERR(chan) || msg->len < 8 || !(msg->flags & I2C_M_DMA_SAFE))
                return;
 
        if (read) {