Re: [PATCH 4.19 182/267] spi: dw: Return any value retrieved from the dma_transfer callback

Pavel Machek
2020-06-19T21:07:25Z

[-- Attachment #1: Type: text/plain, Size: 1574 bytes --]

On Fri 2020-06-19 16:32:47, Greg Kroah-Hartman wrote:
> From: Serge Semin <Sergey.Semin@baikalelectronics.ru>
>
> [ Upstream commit f0410bbf7d0fb80149e3b17d11d31f5b5197873e ]
>
> 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.

As far as I understand, this is support for new SoC, not a fix?

> +++ b/drivers/spi/spi-dw.c
> @@ -383,11 +383,8 @@ static int dw_spi_transfer_one(struct spi_controller *master,
>
> spi_enable_chip(dws, 1);
>
> - if (dws->dma_mapped) {
> - ret = dws->dma_ops->dma_transfer(dws, transfer);
> - if (ret < 0)
> - return ret;
> - }
> + if (dws->dma_mapped)
> + return dws->dma_ops->dma_transfer(dws, transfer);
>
> if (chip->poll_mode)
> return poll_transfer(dws);

Mainline patch simply changes return value, but code is different in
v4.19, and poll_transfer will now be avoided when dws->dma_mapped. Is
that a problem?

Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]