Message ID | 20221212180732.79167-11-sudip.mukherjee@sifive.com |
---|---|
State | New |
Headers | show |
Series | Add support for enhanced SPI for Designware SPI controllers | expand |
diff --git a/drivers/spi/spi-dw-core.c b/drivers/spi/spi-dw-core.c index 10d453228368f..75f5ce5f377ca 100644 --- a/drivers/spi/spi-dw-core.c +++ b/drivers/spi/spi-dw-core.c @@ -428,6 +428,14 @@ static void dw_spi_irq_setup(struct dw_spi *dws, */ level = min_t(u16, dws->fifo_len / 2, dws->tx_len); dw_writel(dws, DW_SPI_TXFTLR, level); + + /* + * In enhanced mode if we are reading then tx_len is 0 as we + * have nothing to transmit. Calculate DW_SPI_RXFTLR with + * rx_len. + */ + if (t_handler == dw_spi_enh_handler) + level = min_t(u16, dws->fifo_len / 2, dws->rx_len); dw_writel(dws, DW_SPI_RXFTLR, level - 1); dws->transfer_handler = t_handler;
In enhanced mode we need to calculate RXFTLR based on the length of data we are expecting to receive or the fifo length. Signed-off-by: Sudip Mukherjee <sudip.mukherjee@sifive.com> --- drivers/spi/spi-dw-core.c | 8 ++++++++ 1 file changed, 8 insertions(+)