diff options
Diffstat (limited to 'drivers/spi/spi-rockchip.c')
-rw-r--r-- | drivers/spi/spi-rockchip.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index c0743604b906..3afc266b666d 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c | |||
@@ -220,7 +220,7 @@ static inline void wait_for_idle(struct rockchip_spi *rs) | |||
220 | do { | 220 | do { |
221 | if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)) | 221 | if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)) |
222 | return; | 222 | return; |
223 | } while (time_before(jiffies, timeout)); | 223 | } while (!time_after(jiffies, timeout)); |
224 | 224 | ||
225 | dev_warn(rs->dev, "spi controller is in busy state!\n"); | 225 | dev_warn(rs->dev, "spi controller is in busy state!\n"); |
226 | } | 226 | } |
@@ -499,7 +499,7 @@ static void rockchip_spi_config(struct rockchip_spi *rs) | |||
499 | } | 499 | } |
500 | 500 | ||
501 | /* div doesn't support odd number */ | 501 | /* div doesn't support odd number */ |
502 | div = rs->max_freq / rs->speed; | 502 | div = max_t(u32, rs->max_freq / rs->speed, 1); |
503 | div = (div + 1) & 0xfffe; | 503 | div = (div + 1) & 0xfffe; |
504 | 504 | ||
505 | spi_enable_chip(rs, 0); | 505 | spi_enable_chip(rs, 0); |
@@ -529,7 +529,8 @@ static int rockchip_spi_transfer_one( | |||
529 | int ret = 0; | 529 | int ret = 0; |
530 | struct rockchip_spi *rs = spi_master_get_devdata(master); | 530 | struct rockchip_spi *rs = spi_master_get_devdata(master); |
531 | 531 | ||
532 | WARN_ON((readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)); | 532 | WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && |
533 | (readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)); | ||
533 | 534 | ||
534 | if (!xfer->tx_buf && !xfer->rx_buf) { | 535 | if (!xfer->tx_buf && !xfer->rx_buf) { |
535 | dev_err(rs->dev, "No buffer for transfer\n"); | 536 | dev_err(rs->dev, "No buffer for transfer\n"); |
@@ -678,7 +679,7 @@ static int rockchip_spi_probe(struct platform_device *pdev) | |||
678 | rs->dma_tx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_TXDR); | 679 | rs->dma_tx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_TXDR); |
679 | rs->dma_rx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_RXDR); | 680 | rs->dma_rx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_RXDR); |
680 | rs->dma_tx.direction = DMA_MEM_TO_DEV; | 681 | rs->dma_tx.direction = DMA_MEM_TO_DEV; |
681 | rs->dma_tx.direction = DMA_DEV_TO_MEM; | 682 | rs->dma_rx.direction = DMA_DEV_TO_MEM; |
682 | 683 | ||
683 | master->can_dma = rockchip_spi_can_dma; | 684 | master->can_dma = rockchip_spi_can_dma; |
684 | master->dma_tx = rs->dma_tx.ch; | 685 | master->dma_tx = rs->dma_tx.ch; |