Skip to content

Commit f0410bb

Browse files
fancerbroonie
authored andcommitted
spi: dw: Return any value retrieved from the dma_transfer callback
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: Serge Semin <[email protected]> Cc: Georgy Vlasov <[email protected]> Cc: Ramil Zaripov <[email protected]> Cc: Alexey Malahov <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Feng Tang <[email protected]> Cc: Rob Herring <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent de4c287 commit f0410bb

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

drivers/spi/spi-dw-mid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer)
288288
dma_async_issue_pending(dws->txchan);
289289
}
290290

291-
return 0;
291+
return 1;
292292
}
293293

294294
static void mid_spi_dma_stop(struct dw_spi *dws)

drivers/spi/spi-dw.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,8 @@ static int dw_spi_transfer_one(struct spi_controller *master,
389389

390390
spi_enable_chip(dws, 1);
391391

392-
if (dws->dma_mapped) {
393-
ret = dws->dma_ops->dma_transfer(dws, transfer);
394-
if (ret < 0)
395-
return ret;
396-
}
392+
if (dws->dma_mapped)
393+
return dws->dma_ops->dma_transfer(dws, transfer);
397394

398395
return 1;
399396
}

0 commit comments

Comments
 (0)