linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* atmel_spi: DMA-imposed xfer buffer requirements
@ 2008-10-20 15:56 Andrei Rylin
       [not found] ` <106f03a70810200856q4af97370h6cd456f3a42d70e5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Rylin @ 2008-10-20 15:56 UTC (permalink / raw)
  To: Haavard Skinnemoen; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Haavard,
thanks for clarification about cs_change.
I have another (hopefully last) question about atmel_spi driver.
atmel_spi driver DMA-maps the buffers pointed to by spi_transfer.
What are alignment and size requirements for the buffers ?
How to expressed them in a platform-independent way,
i.e. suitable for use with other SPI master drivers ?
Can the buffers be in stack ? Or do they always have to be
allocated from a non-paged pool ?
Thanks,
Andrei.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: atmel_spi: DMA-imposed xfer buffer requirements
       [not found] ` <106f03a70810200856q4af97370h6cd456f3a42d70e5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2008-10-20 16:11   ` Haavard Skinnemoen
  2008-10-20 17:02   ` Ben Dooks
  1 sibling, 0 replies; 3+ messages in thread
From: Haavard Skinnemoen @ 2008-10-20 16:11 UTC (permalink / raw)
  To: Andrei Rylin; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

"Andrei Rylin" <port777-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Haavard,
> thanks for clarification about cs_change.
> I have another (hopefully last) question about atmel_spi driver.
> atmel_spi driver DMA-maps the buffers pointed to by spi_transfer.
> What are alignment and size requirements for the buffers ?
> How to expressed them in a platform-independent way,
> i.e. suitable for use with other SPI master drivers ?

Please see Documentation/dma-mapping.txt, in particular the section
called "What memory is DMA'able?"

The actual size and alignment requirements are platform-dependent, but
in general, cache-aligned buffers are required. You can however use
fields embedded in other structs as long as you can guarantee that
  - The struct itself is properly aligned.
  - Any fields sharing a cacheline with the buffer must not be accessed
    while the transfer is ongoing.

The latter requirement usually boils down to "don't access any fields
at all" unless you know extremely well what you're doing.

> Can the buffers be in stack ? Or do they always have to be
> allocated from a non-paged pool ?

No, they can not be allocated on the stack. kmalloc() is ok, however.

Haavard

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: atmel_spi: DMA-imposed xfer buffer requirements
       [not found] ` <106f03a70810200856q4af97370h6cd456f3a42d70e5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2008-10-20 16:11   ` Haavard Skinnemoen
@ 2008-10-20 17:02   ` Ben Dooks
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Dooks @ 2008-10-20 17:02 UTC (permalink / raw)
  To: Andrei Rylin
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Haavard Skinnemoen

On Mon, Oct 20, 2008 at 08:56:41AM -0700, Andrei Rylin wrote:
> Haavard,
> thanks for clarification about cs_change.
> I have another (hopefully last) question about atmel_spi driver.
> atmel_spi driver DMA-maps the buffers pointed to by spi_transfer.
> What are alignment and size requirements for the buffers ?
> How to expressed them in a platform-independent way,
> i.e. suitable for use with other SPI master drivers ?
> Can the buffers be in stack ? Or do they always have to be
> allocated from a non-paged pool ?

no, I belive no linux arch allows dma to/from the stack.

dma_alloc_xxx() and friends are your best bet for allocating such
memory.

> Thanks,
> Andrei.
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> spi-devel-general mailing list
> spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/spi-devel-general

-- 
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-10-20 17:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-20 15:56 atmel_spi: DMA-imposed xfer buffer requirements Andrei Rylin
     [not found] ` <106f03a70810200856q4af97370h6cd456f3a42d70e5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-10-20 16:11   ` Haavard Skinnemoen
2008-10-20 17:02   ` Ben Dooks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).