DMA take 3

Charles Krinke ckrinke at istor.com
Sat Mar 3 06:52:27 EST 2007


Dear Ed:
Thank you for the two hints. Please bear with me for another question or two as I try to converge this today.
 
I have incorporated your two ideas and still have something else going awry. First of all, I do not have to be changing a POTAR at this point in the program for a while. So I am trying to simplify it until it works. Here is the current state.
 
write(0, SR0)  //clear anything and everything
write(0x00040000, SATR0)  //READTTYPE=Read, do not snoop 
write(0x00040000, DATR0)  //READTTYPE=Write, do not snoop 
write(sourceLow32bits, SAR0)  //usually 0x07xxxxxx near the top of 128Mbyte physical memory 
write(size, BCR0)  
printk(various things including some of the registers recently written
//I am assuming this is benign in a Linux driver at this point
asm("sync") //got this in here now
write(destLow32bits, DAR0)  //This should now trigger the DMA
//potar already has the destHi32Bits and it is always 0x1_0000_0000 in 64bit memory space in
//At this point, I would expect the DMA engine to DMA through the window previously setup in potar
 
Charles
 
________________________________

From: Swarthout Edward L-SWARTHOU [mailto:ed.swarthout at freescale.com]
Sent: Fri 3/2/2007 11:28 AM
To: Charles Krinke; linuxppc-embedded at ozlabs.org
Subject: RE: To DMA or not to DMA



It could be a lot of other things, but I see two things wrong:

> From: Charles Krinke
...
> origPotar = readl(POTAR2) //save outbound address translation
> writel(0x00040000, SATR0) //source attribute for normal read/write
> writel(0x00040000, DATR0) //dest attribute for normal read/write
> writel(destHigh32bits >> 8, POTAR2) //put address into window conside
> writel(destLow32bits, DAR0) //setup the destination address register
> writel(sourceLow32bits, SAR0) //setup the source address register
> writel(size, BCR0) //setup the number of words to transfer

Add a sync here to ensure the previous stores are out of the cpu.

> writel(1, MRx[CS]) //trigger the DMA to go
> writel(origPotar, POTAR2) //restor outbound address translation

Don't destroy the outbound window brefore the dma is complete!

> And I would expect the DMA to work, but it doesn't. Can someone help
me
> get my mind around how the DMA in the 8541 is supposed to work?

-EdS




More information about the Linuxppc-embedded mailing list