From e0a1e9b7cded261847ac972311082724afb75cbd Mon Sep 17 00:00:00 2001 From: Huibin Hong Date: Wed, 15 Jun 2016 17:40:42 +0800 Subject: [PATCH] spi: rockchip: set tx burst len 16, rx burst len 1. Set ROCKCHIP_SPI_DMATDLR (rs->fifo_len - 16 - 1), which can keep spi transferring. By the way, rx burst len must be set 1, because it is hard to deal with the unaligned length. Such as burst leng 16, ROCKCHIP_SPI_DMARDLR 16, when rx fifo reaches 16, dma receive 16 bytes. But if the last bytes is less than 16, dma will miss the bytes left in the rx fifo. Change-Id: I846db94a87955453e617620ade32f2e68f01c01d Signed-off-by: Huibin Hong --- drivers/spi/spi-rockchip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index c8c1ada0989d..9e86ec35c450 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -446,7 +446,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) rxconf.direction = rs->dma_rx.direction; rxconf.src_addr = rs->dma_rx.addr; rxconf.src_addr_width = rs->n_bytes; - rxconf.src_maxburst = rs->n_bytes; + rxconf.src_maxburst = 1; dmaengine_slave_config(rs->dma_rx.ch, &rxconf); rxdesc = dmaengine_prep_slave_sg( @@ -465,7 +465,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) txconf.direction = rs->dma_tx.direction; txconf.dst_addr = rs->dma_tx.addr; txconf.dst_addr_width = rs->n_bytes; - txconf.dst_maxburst = rs->n_bytes; + txconf.dst_maxburst = 16; dmaengine_slave_config(rs->dma_tx.ch, &txconf); txdesc = dmaengine_prep_slave_sg( @@ -557,7 +557,7 @@ static void rockchip_spi_config(struct rockchip_spi *rs) writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_TXFTLR); writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_RXFTLR); - writel_relaxed(0, rs->regs + ROCKCHIP_SPI_DMATDLR); + writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_DMATDLR); writel_relaxed(0, rs->regs + ROCKCHIP_SPI_DMARDLR); writel_relaxed(dmacr, rs->regs + ROCKCHIP_SPI_DMACR); -- 2.34.1