From: Vitaly Wool <vwool@ru.mvista.com>
To: David Brownell <david-b@pacbell.net>
Cc: linux-kernel@vger.kernel.org, spi-devel-general@lists.sourceforge.net
Subject: Re: [PATCH/RFC 0/2] simple SPI framework, refresh + ads7864 driver
Date: Wed, 05 Oct 2005 12:07:57 +0400 [thread overview]
Message-ID: <434389DD.8030309@ru.mvista.com> (raw)
In-Reply-To: <20051004201835.8DC32EE96F@adsl-69-107-32-110.dsl.pltn13.pacbell.net>
Hi David,
David Brownell wrote:
>Hi Vitaly,
>
>
>
>>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?
I'm afraid I know at least one target which won't work with this
approach (Philips ARM926-driven board with ARM PrimeCell DMA controller).
> - Probably store those addresses in the spi_transfer struct, using
> rx_dma and/or tx_dma as appropriate.
>
> - After the DMA transfer completes, call dma_unmap_single() before
> calling spi_message.complete(spi_message.context).
>
>There are two fancier approaches to consider for sometime later, both
>of which have been used for several years now by host-side USB.
>
> * SPI controller drivers could require the mappings to already
> have been done, and stored in {rx,tx}_dma fields. When those
> drivers are using DMA, they'd only use those DMA addresses.
>
> The way host-side USB does that is by having usbcore do work
> on all the submit and giveback paths. Currently this SPI
> framework doesn't do "core" work on those paths; spi_async()
> just calls directly to the controller driver (no overhead!)
> and the completion reports likewise go right from controller
> driver back to the submitter (also, no overhead).
>
> * Drivers for SPI slave chips might sometimes want to provide their
> own rx_dma and/or tx_dma values ... either because they mapped the
> buffers themselves -- great for dma_map_sg()! -- or because the
> memory came from dma_alloc_coherent().
>
>
Of course we want to use scatter-gather lists. The DMA controller
mentioned above can handle only 0xFFF transfer units at a transfer so we
have to split the large transfers into SG lists.
> This implies that the controller drivers are ready to accept
> those DMA addresses, and that there are per-buffer flags saying
> whether its DMA address is also valid (vs just its CPU address).
>
>Note that the slave-side USB support only supports the latter, which
>means the USB peripheral controller drivers with DMA support decide
>on a per-request basis whether to do the DMA mappings. I'd lean
>towards doing that with SPI; it's a bunch simpler.
>
>
Doesn't look straightforward to me.
Moreover, that looks like it may imply redundant data copying.
Can you please elaborate what you meant by 'readiness to accept DMA
addresses' for the controller drivers?
As far as I see it now, the whole thing looks wrong. The thing that we
suggest (i. e. abstract handles for memory allocation set to kmalloc by
default) is looking far better IMHO and doesn't require any flags which
usage increases uncertainty in the core.
>Right now DMA isn't on my priority list, but I'd be glad to see
>someone else take further steps there. Anyone doing bulk I/O to an
>SPI flash chip at 50 MHz is surely going to want DMA for it!
>
>
Yep, as well as for SPI SD/MMC controllers, SPI WiFi modules, SPI
Bluetooth modules, etc. etc.
Best regards,
Vitaly
next prev parent reply other threads:[~2005-10-05 8:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-04 20:18 [PATCH/RFC 0/2] simple SPI framework, refresh + ads7864 driver David Brownell
2005-10-05 8:07 ` Vitaly Wool [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-10-05 16:21 David Brownell
2005-10-05 16:24 ` Russell King
2005-10-05 17:27 ` David Brownell
2005-10-06 4:57 ` Vitaly Wool
2005-10-06 18:13 ` Mark Underwood
2005-10-06 18:20 ` Vitaly Wool
2005-10-05 15:18 David Brownell
2005-10-05 15:10 David Brownell
2005-10-13 19:37 ` Lee Revell
2005-10-04 18:02 David Brownell
2005-10-04 19:08 ` Vitaly Wool
2005-10-05 7:56 ` Vitaly Wool
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=434389DD.8030309@ru.mvista.com \
--to=vwool@ru.mvista.com \
--cc=david-b@pacbell.net \
--cc=linux-kernel@vger.kernel.org \
--cc=spi-devel-general@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox