Skip to content

Commit

Permalink
spi: rockchip: set tx burst len 16, rx burst len 1.
Browse files Browse the repository at this point in the history
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 <huibin.hong@rock-chips.com>
  • Loading branch information
Huibin Hong authored and rkhuangtao committed Jun 23, 2016
1 parent c66ecf1 commit e0a1e9b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/spi/spi-rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit e0a1e9b

Please sign in to comment.