diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2019-03-05 12:54:33 -0500 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2019-03-20 13:19:07 -0400 |
commit | 03f85e380f9237da436ab050a4ff0f8b541c8ee7 (patch) | |
tree | f3af3fc643adc4bd1532a23920cbc2af9d2f1434 /drivers/i2c | |
parent | ed5a81046bf7a1b665eb5bf178c4139503f4637e (diff) |
i2c: rcar: let DMA enable routine return success status
We will need to know if enabling DMA was successful in a later patch.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-rcar.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 57083e91f2cf..b0d85f5957d4 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c | |||
@@ -399,7 +399,7 @@ static void rcar_i2c_dma_callback(void *data) | |||
399 | rcar_i2c_dma_unmap(priv); | 399 | rcar_i2c_dma_unmap(priv); |
400 | } | 400 | } |
401 | 401 | ||
402 | static void rcar_i2c_dma(struct rcar_i2c_priv *priv) | 402 | static bool rcar_i2c_dma(struct rcar_i2c_priv *priv) |
403 | { | 403 | { |
404 | struct device *dev = rcar_i2c_priv_to_dev(priv); | 404 | struct device *dev = rcar_i2c_priv_to_dev(priv); |
405 | struct i2c_msg *msg = priv->msg; | 405 | struct i2c_msg *msg = priv->msg; |
@@ -415,7 +415,7 @@ static void rcar_i2c_dma(struct rcar_i2c_priv *priv) | |||
415 | /* Do various checks to see if DMA is feasible at all */ | 415 | /* Do various checks to see if DMA is feasible at all */ |
416 | if (IS_ERR(chan) || msg->len < RCAR_MIN_DMA_LEN || | 416 | if (IS_ERR(chan) || msg->len < RCAR_MIN_DMA_LEN || |
417 | !(msg->flags & I2C_M_DMA_SAFE) || (read && priv->flags & ID_P_NO_RXDMA)) | 417 | !(msg->flags & I2C_M_DMA_SAFE) || (read && priv->flags & ID_P_NO_RXDMA)) |
418 | return; | 418 | return false; |
419 | 419 | ||
420 | if (read) { | 420 | if (read) { |
421 | /* | 421 | /* |
@@ -435,7 +435,7 @@ static void rcar_i2c_dma(struct rcar_i2c_priv *priv) | |||
435 | dma_addr = dma_map_single(chan->device->dev, buf, len, dir); | 435 | dma_addr = dma_map_single(chan->device->dev, buf, len, dir); |
436 | if (dma_mapping_error(chan->device->dev, dma_addr)) { | 436 | if (dma_mapping_error(chan->device->dev, dma_addr)) { |
437 | dev_dbg(dev, "dma map failed, using PIO\n"); | 437 | dev_dbg(dev, "dma map failed, using PIO\n"); |
438 | return; | 438 | return false; |
439 | } | 439 | } |
440 | 440 | ||
441 | sg_dma_len(&priv->sg) = len; | 441 | sg_dma_len(&priv->sg) = len; |
@@ -449,7 +449,7 @@ static void rcar_i2c_dma(struct rcar_i2c_priv *priv) | |||
449 | if (!txdesc) { | 449 | if (!txdesc) { |
450 | dev_dbg(dev, "dma prep slave sg failed, using PIO\n"); | 450 | dev_dbg(dev, "dma prep slave sg failed, using PIO\n"); |
451 | rcar_i2c_cleanup_dma(priv); | 451 | rcar_i2c_cleanup_dma(priv); |
452 | return; | 452 | return false; |
453 | } | 453 | } |
454 | 454 | ||
455 | txdesc->callback = rcar_i2c_dma_callback; | 455 | txdesc->callback = rcar_i2c_dma_callback; |
@@ -459,7 +459,7 @@ static void rcar_i2c_dma(struct rcar_i2c_priv *priv) | |||
459 | if (dma_submit_error(cookie)) { | 459 | if (dma_submit_error(cookie)) { |
460 | dev_dbg(dev, "submitting dma failed, using PIO\n"); | 460 | dev_dbg(dev, "submitting dma failed, using PIO\n"); |
461 | rcar_i2c_cleanup_dma(priv); | 461 | rcar_i2c_cleanup_dma(priv); |
462 | return; | 462 | return false; |
463 | } | 463 | } |
464 | 464 | ||
465 | /* Enable DMA Master Received/Transmitted */ | 465 | /* Enable DMA Master Received/Transmitted */ |
@@ -469,6 +469,7 @@ static void rcar_i2c_dma(struct rcar_i2c_priv *priv) | |||
469 | rcar_i2c_write(priv, ICDMAER, TMDMAE); | 469 | rcar_i2c_write(priv, ICDMAER, TMDMAE); |
470 | 470 | ||
471 | dma_async_issue_pending(chan); | 471 | dma_async_issue_pending(chan); |
472 | return true; | ||
472 | } | 473 | } |
473 | 474 | ||
474 | static void rcar_i2c_irq_send(struct rcar_i2c_priv *priv, u32 msr) | 475 | static void rcar_i2c_irq_send(struct rcar_i2c_priv *priv, u32 msr) |