Skip to content

Commit

Permalink
spi: rockchip: configure CTRLR1 according to size and data frame
Browse files Browse the repository at this point in the history
CTRLR1 is number of data frames, when rx only.
When data frame is 8 bit, CTRLR1 is len-1.
When data frame is 16 bit, CTRLR1 is (len/2)-1.

Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Huibin Hong authored and Mark Brown committed Aug 16, 2017
1 parent 6b860e6 commit 04b37d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/spi/spi-rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,13 @@ static void rockchip_spi_config(struct rockchip_spi *rs)

writel_relaxed(cr0, rs->regs + ROCKCHIP_SPI_CTRLR0);

writel_relaxed(rs->len - 1, rs->regs + ROCKCHIP_SPI_CTRLR1);
if (rs->n_bytes == 1)
writel_relaxed(rs->len - 1, rs->regs + ROCKCHIP_SPI_CTRLR1);
else if (rs->n_bytes == 2)
writel_relaxed((rs->len / 2) - 1, rs->regs + ROCKCHIP_SPI_CTRLR1);
else
writel_relaxed((rs->len * 2) - 1, rs->regs + ROCKCHIP_SPI_CTRLR1);

writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_TXFTLR);
writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_RXFTLR);

Expand Down

0 comments on commit 04b37d2

Please sign in to comment.