Re: [PATCH/RFC 0/2] simple SPI framework, refresh + ads7864 driver

David Brownell
2005-10-05T15:18:22Z

> > > can you please describe the data flow in case of DMA transfer? Thanks!
> >
> > In the current model, the controller driver handles it (assuming
> > that it uses DMA not PIO):
> >
> > - Use dma_map_single() at some point between the master->transfer()
> > call and the time the DMA address is handed to DMA hardware.

> So that implies calling dma_map_single() for the memory allocated in stack?

Calling that for whatever is passed, certainly.

But the <linux/spi.h> header does have a comment right next to the
declarations of spi_transfer.tx_buf and rx_buf, saying that "buffers
must work with dma_*map_single() calls.

In general all APIs that use DMA will follow the rules listed under
"What memory is DMA'able?" in:

linux/Documentation/DMA-mapping.txt

The rest of that file is a bit PCI-centric, but that section remains
the primary description of what can be DMA'd. I had assumed that went
without saying; permaps wrongly.

- Dave