DMA take 3
Charles Krinke
ckrinke at istor.com
Sat Mar 3 10:42:57 EST 2007
Dear Ed:
Your uboot script works fine with the DMA engine. I can transfer a few bytes from 0xfff8_0000 to 0x1_0000 with no difficulty. However, I have not yet gotten to an understanding when DMA'ing through an address translation window, but at least I know how to make it work in local memory (LM) space.
In our design, we have two outbound translation address windows setup and the BAR's in our ASIC are dual, meaning BAR0/BAR1 work together to form a 64bit address and BAR2/BAR3 work together to form a different 64bit address. One is translated from 0x8400_0000 to 0x3_0000_0000 which we call RM (Register Memory) and the other is translated from 0x8800_0000 to 0x1_0000_0000 which we call SM (System Memory).
I have setup POWBAR1/POTAR1/POWAR1 for the 0x8400_0000 translation and POWBAR2/POTAR2/POWAR2 for the 0x8800_0000 translation. Using those translations, we can write & read single memory locations in both RM & SM space from LM space using these settings.
Next is the burst mode of the PCI for which, I believe, the only recourse is to use the DMA engine. Here things get a bit trickier.
I am DMA'ing to the window at 0x8800_0000 plus the destination offset within that window and the issue is that although LM->LM DMA is now working, LM->SM is not working.
So, her are the questions:
Is there any special consideration in trying to DMA from a 32bit PCI to a 64bit address using DAC (Dual Address Cycles) in the 8541?
Are there any special considerations relating to using an outbound address translation window to do this?
Where else might things be going awry?
Charles
________________________________
From: Swarthout Edward L-SWARTHOU [mailto:ed.swarthout at freescale.com]
Sent: Fri 3/2/2007 1:27 PM
To: Charles Krinke; linuxppc-embedded at ozlabs.org
Subject: RE: DMA take 3
Maybe even a more basic question - are you setting the controller up
correctly for this mode (SRW=1 and CTM=1)?
One suggestion is to try it once by hand in u-boot to ensure the
hardware is working as expected before trying it in Linux.
-EdS
#simple u-boot Direct Mode dma example - Ed.Swarthout
setenv sad fff80000 #source
setenv dad 10000 #dest
setenv bc 10 #byte count
setenv b e0021 #ccsr
mw ${b}104 ffffffff #sr clear
mw ${b}110 50000 #satr SREADTTYPE=5 read snoop
mw ${b}114 $sad #sar
mw ${b}118 50000 #datr write snoop
mw ${b}120 $bc #bcr
mw ${b}100 0f03c404 #mr BWC=f, DAHTS=3, SAHTS=3, SRW=1 CTM
md $dad 5 #before
mw ${b}11c $dad #set dar and go
md ${b}100 9 #show status
md $dad 5 #after
Or make a dma command and run it:
setenv dma 'mw ${b}104 ffffffff;mw ${b}110 50000;mw ${b}114 $sad;mw
${b}118 50000;mw ${b}120 $bc;mw ${b}100 0f03c404; mw ${b}11c $dad; md
${b}100 9'
setenv b e0021; setenv sad fff80000; setenv dad 10000; setenv bc 10
run dma
--- results ---
=> md $dad 5
md $dad
00010000: deadbeef deadbeef deadbeef deadbeef ................
00010010: deadbeef ....
=> run dma
run dma
e0021100: 0f03c405 00000000 00000000 00000000 ................
e0021110: 00050000 fff80010 00050000 00010010 ................
e0021120: 00000000 ....
=> md $dad 5
md $dad 5
00010000: 27051956 552d426f 6f742031 2e322e30 '..VU-Boot 1.2.0
00010010: deadbeef ....
More information about the Linuxppc-embedded
mailing list