diff options
author | Huibin Hong <huibin.hong@rock-chips.com> | 2017-08-16 09:32:30 +0800 |
---|---|---|
committer | Huang, Tao <huangtao@rock-chips.com> | 2017-08-22 12:04:41 +0800 |
commit | 6891be86bb06fa71cc5236e3d00eb84843fc5392 (patch) | |
tree | 3193e5480df3e214fc3e2dd5b103bbcd3c4df937 /drivers/spi/spi-rockchip.c | |
parent | 6d994f02ab8eb9164862b3fc0263a2767ac598d6 (diff) |
spi: rockchip: configure CTRLR1 according to size and data frame
CTRLR1 is number of data frames.
When data frame is 8 bit, CTRLR1 is len-1.
When data frame is 16 bit, CTRLR1 is (len/2)-1.
Change-Id: I40b7ebd382f60bdfdab902394637c107d90531db
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Diffstat (limited to 'drivers/spi/spi-rockchip.c')
-rw-r--r-- | drivers/spi/spi-rockchip.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 573b8a4b4cc9..12b7a780df13 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -553,7 +553,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); |