Re: [PATCH] spi: use dmaengine_get_dma_device() for DMA mapping

From: Mark Brown

Date: Thu Sep 24 2026 - 13:03:34 EST


On Wed, Sep 16, 2026 at 11:30:55PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@xxxxxxx>
>
> Replace chan->device->dev with dmaengine_get_dma_device(chan) in the
> SPI core (spi.c) and SPI mem (spi-mem.c) DMA mapping helpers so that
> DMA mapping goes through the correct device when the DMA controller
> has per-channel IOMMU domains (chan_dma_dev=true).

> @@ -46,9 +46,9 @@ int spi_controller_dma_map_mem_op_data(struct spi_controller *ctlr,
> return -EINVAL;
>
> if (op->data.dir == SPI_MEM_DATA_OUT && ctlr->dma_tx)
> - dmadev = ctlr->dma_tx->device->dev;
> + dmadev = dmaengine_get_dma_device(ctlr->dma_tx);
> else if (op->data.dir == SPI_MEM_DATA_IN && ctlr->dma_rx)
> - dmadev = ctlr->dma_rx->device->dev;
> + dmadev = dmaengine_get_dma_device(ctlr->dma_rx);
> else
> dmadev = ctlr->dev.parent;
>

At least OMAP McSPI has different DMA channels per chip select for some
reason, that's broken either way though I think.

Attachment: signature.asc
Description: PGP signature