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 3afc266b666d..f96ea8a38d64 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) |
| @@ -557,16 +555,17 @@ static int rockchip_spi_transfer_one( | |||
| 557 | else if (rs->rx) | 555 | else if (rs->rx) |
| 558 | rs->tmode = CR0_XFM_RO; | 556 | rs->tmode = CR0_XFM_RO; |
| 559 | 557 | ||
| 560 | if (master->can_dma && master->can_dma(master, spi, xfer)) | 558 | /* we need prepare dma before spi was enabled */ |
| 559 | if (master->can_dma && master->can_dma(master, spi, xfer)) { | ||
| 561 | rs->use_dma = 1; | 560 | rs->use_dma = 1; |
| 562 | else | 561 | rockchip_spi_prepare_dma(rs); |
| 562 | } else { | ||
| 563 | rs->use_dma = 0; | 563 | rs->use_dma = 0; |
| 564 | } | ||
| 564 | 565 | ||
| 565 | rockchip_spi_config(rs); | 566 | rockchip_spi_config(rs); |
| 566 | 567 | ||
| 567 | if (rs->use_dma) | 568 | if (!rs->use_dma) |
| 568 | ret = rockchip_spi_dma_transfer(rs); | ||
| 569 | else | ||
| 570 | ret = rockchip_spi_pio_transfer(rs); | 569 | ret = rockchip_spi_pio_transfer(rs); |
| 571 | 570 | ||
| 572 | return ret; | 571 | return ret; |
