Skip to content

Commit 04b37d2

Browse files
Huibin Hongbroonie
authored andcommitted
spi: rockchip: configure CTRLR1 according to size and data frame
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 <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 6b860e6 commit 04b37d2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/spi/spi-rockchip.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,13 @@ static void rockchip_spi_config(struct rockchip_spi *rs)
568568

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

571-
writel_relaxed(rs->len - 1, rs->regs + ROCKCHIP_SPI_CTRLR1);
571+
if (rs->n_bytes == 1)
572+
writel_relaxed(rs->len - 1, rs->regs + ROCKCHIP_SPI_CTRLR1);
573+
else if (rs->n_bytes == 2)
574+
writel_relaxed((rs->len / 2) - 1, rs->regs + ROCKCHIP_SPI_CTRLR1);
575+
else
576+
writel_relaxed((rs->len * 2) - 1, rs->regs + ROCKCHIP_SPI_CTRLR1);
577+
572578
writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_TXFTLR);
573579
writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_RXFTLR);
574580

0 commit comments

Comments
 (0)