diff options
| -rw-r--r-- | drivers/spi/spi-rockchip.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index c0743604b906..1fa4eda4b432 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c | |||
| @@ -415,7 +415,7 @@ static void rockchip_spi_dma_txcb(void *data) | |||
| 415 | spin_unlock_irqrestore(&rs->lock, flags); | 415 | spin_unlock_irqrestore(&rs->lock, flags); |
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | static int rockchip_spi_dma_transfer(struct rockchip_spi *rs) | 418 | static void rockchip_spi_prepare_dma(struct rockchip_spi *rs) |
| 419 | { | 419 | { |
| 420 | unsigned long flags; | 420 | unsigned long flags; |
| 421 | struct dma_slave_config rxconf, txconf; | 421 | struct dma_slave_config rxconf, txconf; |
| @@ -474,8 +474,6 @@ static int rockchip_spi_dma_transfer(struct rockchip_spi *rs) | |||
| 474 | dmaengine_submit(txdesc); | 474 | dmaengine_submit(txdesc); |
| 475 | dma_async_issue_pending(rs->dma_tx.ch); | 475 | dma_async_issue_pending(rs->dma_tx.ch); |
| 476 | } | 476 | } |
| 477 | |||
| 478 | return 1; | ||
| 479 | } | 477 | } |
| 480 | 478 | ||
| 481 | static void rockchip_spi_config(struct rockchip_spi *rs) | 479 | static void rockchip_spi_config(struct rockchip_spi *rs) |
| @@ -556,16 +554,17 @@ static int rockchip_spi_transfer_one( | |||
| 556 | else if (rs->rx) | 554 | else if (rs->rx) |
| 557 | rs->tmode = CR0_XFM_RO; | 555 | rs->tmode = CR0_XFM_RO; |
| 558 | 556 | ||
| 559 | if (master->can_dma && master->can_dma(master, spi, xfer)) | 557 | /* we need prepare dma before spi was enabled */ |
| 558 | if (master->can_dma && master->can_dma(master, spi, xfer)) { | ||
| 560 | rs->use_dma = 1; | 559 | rs->use_dma = 1; |
| 561 | else | 560 | rockchip_spi_prepare_dma(rs); |
| 561 | } else { | ||
| 562 | rs->use_dma = 0; | 562 | rs->use_dma = 0; |
| 563 | } | ||
| 563 | 564 | ||
| 564 | rockchip_spi_config(rs); | 565 | rockchip_spi_config(rs); |
| 565 | 566 | ||
| 566 | if (rs->use_dma) | 567 | if (!rs->use_dma) |
| 567 | ret = rockchip_spi_dma_transfer(rs); | ||
| 568 | else | ||
| 569 | ret = rockchip_spi_pio_transfer(rs); | 568 | ret = rockchip_spi_pio_transfer(rs); |
| 570 | 569 | ||
| 571 | return ret; | 570 | return ret; |
