Commit f4f2bb24 authored by Serge Semin's avatar Serge Semin Committed by Khalid Elmously

spi: dw: Return any value retrieved from the dma_transfer callback

BugLink: https://bugs.launchpad.net/bugs/1884564

[ Upstream commit f0410bbf ]

DW APB SSI DMA-part of the driver may need to perform the requested
SPI-transfer synchronously. In that case the dma_transfer() callback
will return 0 as a marker of the SPI transfer being finished so the
SPI core doesn't need to wait and may proceed with the SPI message
trasnfers pumping procedure. This will be needed to fix the problem
when DMA transactions are finished, but there is still data left in
the SPI Tx/Rx FIFOs being sent/received. But for now make dma_transfer
to return 1 as the normal dw_spi_transfer_one() method.
Signed-off-by: default avatarSerge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Georgy Vlasov <Georgy.Vlasov@baikalelectronics.ru>
Cc: Ramil Zaripov <Ramil.Zaripov@baikalelectronics.ru>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Feng Tang <feng.tang@intel.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: devicetree@vger.kernel.org
Link: https://lore.kernel.org/r/20200529131205.31838-3-Sergey.Semin@baikalelectronics.ruSigned-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent c2902dd0
...@@ -274,7 +274,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer) ...@@ -274,7 +274,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer)
dma_async_issue_pending(dws->txchan); dma_async_issue_pending(dws->txchan);
} }
return 0; return 1;
} }
static void mid_spi_dma_stop(struct dw_spi *dws) static void mid_spi_dma_stop(struct dw_spi *dws)
......
...@@ -385,11 +385,8 @@ static int dw_spi_transfer_one(struct spi_master *master, ...@@ -385,11 +385,8 @@ static int dw_spi_transfer_one(struct spi_master *master,
spi_enable_chip(dws, 1); spi_enable_chip(dws, 1);
if (dws->dma_mapped) { if (dws->dma_mapped)
ret = dws->dma_ops->dma_transfer(dws, transfer); return dws->dma_ops->dma_transfer(dws, transfer);
if (ret < 0)
return ret;
}
if (chip->poll_mode) if (chip->poll_mode)
return poll_transfer(dws); return poll_transfer(dws);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment