Re: [PATCH SPI for-next 2/3] spi: mchp-pci1xxxx: DMA Read support for copying data into SPI Buf

From: Mark Brown
Date: Fri Dec 15 2023 - 08:29:38 EST


On Fri, Dec 15, 2023 at 05:17:47PM +0530, Thangaraj Samynathan wrote:

> + tx_dma_addr = dma_map_single(dev, (void *)xfer->tx_buf, xfer->len, DMA_TO_DEVICE);
> + if (dma_mapping_error(NULL, tx_dma_addr)) {
> + tx_dma_addr = 0;
> + ret = -ENOMEM;
> + goto error;
> + }

The core can do all the DMA mapping for you if you provide a can_dma()
operation, this supports switching between DMA and non-DMA modes per
transfer - often you'll get better performance from PIO for smaller
lengths due to the overhead of setting up DMA and taking the interrupt
on completion.

Attachment: signature.asc
Description: PGP signature