Commit 819efee83b7b1f47685dca6fad6bbe17f1c42092

Authored by Robin Gong
1 parent 90c929d7d1

MLK-9986-5 spi: spi-imx: decrease tx fifo wartermark level

We set both wartermark of txfifo and rxfifo 32 as half of fifo length 64.
That will cause easy rxfifo overflow:
If there is 31 bytes in rxfifo, rx script will wait the next dma request
(the 32th data come into the rxfifo) and schedule out to tx script. Once
tx script start to run, the rx script need to wait tx script finish even
if its priority higher than tx. Meanwhile, spi slave device may input
data continous, plus the rx data which triggered by new tx script(32 bytes).
That will quickly consume whole 64 bytes fifo, so we keep 16bytes availbale
even in the worst case new tx script triggered during two rx transfer. That
may slow down tx slightly, but better than overflow and RX DMA timeout.

Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 16043ad0ad96aa04a90614e473aa17980af4b8af)

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

drivers/spi/spi-imx.c
... ... @@ -375,7 +375,7 @@
375 375 if (spi_imx->dma_is_inited) {
376 376 dma = readl(spi_imx->base + MX51_ECSPI_DMA);
377 377  
378   - spi_imx->tx_wml = spi_imx_get_fifosize(spi_imx) / 2;
  378 + spi_imx->tx_wml = spi_imx_get_fifosize(spi_imx) / 4;
379 379 spi_imx->rx_wml = spi_imx_get_fifosize(spi_imx) / 2;
380 380 spi_imx->rxt_wml = spi_imx_get_fifosize(spi_imx) / 2;
381 381 rx_wml_cfg = spi_imx->rx_wml << MX51_ECSPI_DMA_RX_WML_OFFSET;
... ... @@ -838,7 +838,7 @@
838 838 slave_config.direction = DMA_MEM_TO_DEV;
839 839 slave_config.dst_addr = res->start + MXC_CSPITXDATA;
840 840 slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
841   - slave_config.dst_maxburst = spi_imx_get_fifosize(spi_imx) / 2;
  841 + slave_config.dst_maxburst = spi_imx_get_fifosize(spi_imx) / 4;
842 842 ret = dmaengine_slave_config(master->dma_tx, &slave_config);
843 843 if (ret) {
844 844 dev_err(dev, "error in TX dma configuration.\n");