linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* MPC8349 DMA
@ 2008-11-11 14:16 jay_chen
  2008-11-11 18:18 ` Scott Wood
  0 siblings, 1 reply; 4+ messages in thread
From: jay_chen @ 2008-11-11 14:16 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 917 bytes --]

Hi,
 
I am using 2.6.14.5 and MPC8349.
I got some DMA problems with PCI devices.
So, I tried to understand the DMA stuff of linux.
 
I have one question about cache coherency.
In dma-mapping.h, I found some functions are defined as NULL.
For example:
#define dma_cache_inv(_start,_size)  do { } while (0)
#define dma_cache_wback(_start,_size)  do { } while (0)
#define dma_cache_wback_inv(_start,_size) do { } while (0)
 
#define __dma_alloc_coherent(gfp, size, handle) NULL
#define __dma_free_coherent(size, addr)  do { } while (0)
#define __dma_sync(addr, size, rw)  do { } while (0)
#define __dma_sync_page(pg, off, sz, rw) do { } while (0)

Does this mean that I don't need to take care of cache coherency in MPC83xx
platform?
So, I could use any range of memory for DMA transferring and the hardware
will take care of the cache coherency for me?
 
Thanks a lot.
 
                                    Jay Chen.
 

[-- Attachment #2: Type: text/html, Size: 3499 bytes --]

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

* Re: MPC8349 DMA
  2008-11-11 14:16 MPC8349 DMA jay_chen
@ 2008-11-11 18:18 ` Scott Wood
  2008-11-19 11:14   ` jay_chen
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Wood @ 2008-11-11 18:18 UTC (permalink / raw)
  To: jay_chen; +Cc: linuxppc-embedded

jay_chen wrote:
> I am using 2.6.14.5 and MPC8349.
> I got some DMA problems with PCI devices.
> So, I tried to understand the DMA stuff of linux.

That's very old; have you tried the latest kernel?

> I have one question about cache coherency.
> In dma-mapping.h, I found some functions are defined as NULL.
> For example:
> #define dma_cache_inv(_start,_size)  do { } while (0)
> #define dma_cache_wback(_start,_size)  do { } while (0)
> #define dma_cache_wback_inv(_start,_size) do { } while (0)
>  
> #define __dma_alloc_coherent(gfp, size, handle) NULL
> #define __dma_free_coherent(size, addr)  do { } while (0)
> #define __dma_sync(addr, size, rw)  do { } while (0)
> #define __dma_sync_page(pg, off, sz, rw) do { } while (0)
> Does this mean that I don't need to take care of cache coherency in 
> MPC83xx platform?
> So, I could use any range of memory for DMA transferring and the 
> hardware will take care of the cache coherency for me?

Yes, however it's still a good idea to call the DMA functions in case 
the code gets run on hardware that doesn't have coherent DMA, or that 
needs special DMA mapping for highmem.

Make sure that the PCI bridge is configured to snoop, and that you map 
your memory as coherence-required (normally not necessary on 
uniprocessor, but there's some weirdness in the 82xx/83xx PCI controller 
that requires it).

-Scott

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

* Re: MPC8349 DMA
  2008-11-11 18:18 ` Scott Wood
@ 2008-11-19 11:14   ` jay_chen
  2008-11-19 16:05     ` Scott Wood
  0 siblings, 1 reply; 4+ messages in thread
From: jay_chen @ 2008-11-19 11:14 UTC (permalink / raw)
  To: linuxppc-embedded

Thanks for your help.
Could you give some hints about how to  "map your memory as
coherence-required"?

                Jay Chen...

-----Original Message-----
From: linuxppc-embedded-bounces+jay_chen=alphanetworks.com@ozlabs.org
[mailto:linuxppc-embedded-bounces+jay_chen=alphanetworks.com@ozlabs.org] 
Sent: Wednesday, November 12, 2008 2:19 AM
To: jay_chen
Cc: linuxppc-embedded@ozlabs.org
Subject: [Spam Mail] Re: MPC8349 DMA

jay_chen wrote:
> I am using 2.6.14.5 and MPC8349.
> I got some DMA problems with PCI devices.
> So, I tried to understand the DMA stuff of linux.

That's very old; have you tried the latest kernel?

> I have one question about cache coherency.
> In dma-mapping.h, I found some functions are defined as NULL.
> For example:
> #define dma_cache_inv(_start,_size)  do { } while (0) #define 
> dma_cache_wback(_start,_size)  do { } while (0) #define 
> dma_cache_wback_inv(_start,_size) do { } while (0)
>  
> #define __dma_alloc_coherent(gfp, size, handle) NULL #define 
> __dma_free_coherent(size, addr)  do { } while (0) #define 
> __dma_sync(addr, size, rw)  do { } while (0) #define 
> __dma_sync_page(pg, off, sz, rw) do { } while (0) Does this mean that 
> I don't need to take care of cache coherency in MPC83xx platform?
> So, I could use any range of memory for DMA transferring and the 
> hardware will take care of the cache coherency for me?

Yes, however it's still a good idea to call the DMA functions in case the
code gets run on hardware that doesn't have coherent DMA, or that needs
special DMA mapping for highmem.

Make sure that the PCI bridge is configured to snoop, and that you map your
memory as coherence-required (normally not necessary on uniprocessor, but
there's some weirdness in the 82xx/83xx PCI controller that requires it).

-Scott

_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

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

* Re: MPC8349 DMA
  2008-11-19 11:14   ` jay_chen
@ 2008-11-19 16:05     ` Scott Wood
  0 siblings, 0 replies; 4+ messages in thread
From: Scott Wood @ 2008-11-19 16:05 UTC (permalink / raw)
  To: jay_chen; +Cc: linuxppc-embedded

jay_chen wrote:
> Thanks for your help.
> Could you give some hints about how to  "map your memory as
> coherence-required"?

The M bit needs to be set in the BATs and PTEs.  Current kernels do 
this; I don't know about really old ones such as 2.6.14.

-Scott

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

end of thread, other threads:[~2008-11-19 16:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-11 14:16 MPC8349 DMA jay_chen
2008-11-11 18:18 ` Scott Wood
2008-11-19 11:14   ` jay_chen
2008-11-19 16:05     ` Scott Wood

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).