Re: [PATCH v2 09/19] spi: dw: Parameterize the DMA Rx/Tx burst length
From: Andy Shevchenko
Date: Fri May 15 2020 - 10:01:38 EST
On Fri, May 15, 2020 at 01:47:48PM +0300, Serge Semin wrote:
> It isn't good to have numeric literals in the code especially if there
> are multiple of them and they are related. Moreover in current
> implementation the Tx DMA transfer activation level isn't optimal,
> since it's hardwired to be at 16-32 bytes level, while it's better
> to keep the SPI FIFO buffer as full as possible until all available
> data is submitted. So lets introduce the DMA burst level
> parametrization macros with optimal values - issue Rx transfer if at
> least 16 bytes are available in the buffer and execute Tx transaction
> if at least 16 bytes room is opened in SPI Tx FIFO.
> - dw_writel(dws, DW_SPI_DMARDLR, 0xf);
> - dw_writel(dws, DW_SPI_DMATDLR, 0x10);
> + dw_writel(dws, DW_SPI_DMARDLR, RX_BURST_LEVEL - 1);
> + dw_writel(dws, DW_SPI_DMATDLR, dws->fifo_len - TX_BURST_LEVEL);
...and if FIFO length is less than TX_BURST_LEVEL?
For the patch that introduces definitions, i.e. keeping the last line here as
dw_writel(dws, DW_SPI_DMATDLR, TX_BURST_LEVEL);
I'm good. You may put your tag in that case. For fifo_len case we need to
discuss in separate patch, perhaps.
--
With Best Regards,
Andy Shevchenko