* virt_to_bus and DMA
@ 2006-11-24 15:37 Ilse Reyneke
0 siblings, 0 replies; 3+ messages in thread
From: Ilse Reyneke @ 2006-11-24 15:37 UTC (permalink / raw)
To: linuxppc-embedded
Hi there,
Question from a relative newby.
Can someone please tell me how to get the bus/physical address from a
virtual address? To familiarise myself with the PPC4xx DMA API I'm trying to
get a simple mem-mem DMA working (any good samples out there??). The
following code snippet seems to be the way of allocating memory buffers for
the transfer:
int size = 2*1024;
uint32_t* sourceaddr = (uint32_t *)__get_free_pages(GFP_KERNEL
|GFP_DMA,get_order(size));
uint32_t* destaddr = (uint32_t *)__get_free_pages(GFP_KERNEL |GFP_DMA,
get_order(size));
phys_addr_t physdest = virt_to_bus((u32 *)destaddr);
phys_addr_t physsource = virt_to_bus((u32 *)sourceaddr);
The problem is that virt_to_bus seems to be returning 0. I understand that
it is generally undesirable to use the deprecated virt_to_bus, but what are
the alternatives?
Am I also correct in saying the "standard DMA API" (request_dma,
set_dma_addr etc) is NOT available on the 4xx?
We're making use of the 440EPx, Linux 2.6.14 kernel.
Cheers
Jan Reyneke
_________________________________________________________________
Windows Live Messenger has arrived. Click here to download it for free!
http://imagine-msn.com/messenger/launch80/?locale=en-gb
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: virt_to_bus and DMA
@ 2006-11-24 17:18 Manish Joshi
2006-12-21 21:18 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Manish Joshi @ 2006-11-24 17:18 UTC (permalink / raw)
To: Ilse Reyneke, linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 1883 bytes --]
you can use __pa() along with kmalloc(..., GFP_KERNEL | GFP_DMA).
----- Original Message ----
From: Ilse Reyneke <reynekejunk@hotmail.com>
To: linuxppc-embedded@ozlabs.org
Sent: Friday, November 24, 2006 9:07:58 PM
Subject: virt_to_bus and DMA
Hi there,
Question from a relative newby.
Can someone please tell me how to get the bus/physical address from a
virtual address? To familiarise myself with the PPC4xx DMA API I'm trying to
get a simple mem-mem DMA working (any good samples out there??). The
following code snippet seems to be the way of allocating memory buffers for
the transfer:
int size = 2*1024;
uint32_t* sourceaddr = (uint32_t *)__get_free_pages(GFP_KERNEL
|GFP_DMA,get_order(size));
uint32_t* destaddr = (uint32_t *)__get_free_pages(GFP_KERNEL |GFP_DMA,
get_order(size));
phys_addr_t physdest = virt_to_bus((u32 *)destaddr);
phys_addr_t physsource = virt_to_bus((u32 *)sourceaddr);
The problem is that virt_to_bus seems to be returning 0. I understand that
it is generally undesirable to use the deprecated virt_to_bus, but what are
the alternatives?
Am I also correct in saying the "standard DMA API" (request_dma,
set_dma_addr etc) is NOT available on the 4xx?
We're making use of the 440EPx, Linux 2.6.14 kernel.
Cheers
Jan Reyneke
_________________________________________________________________
Windows Live™ Messenger has arrived. Click here to download it for free!
http://imagine-msn.com/messenger/launch80/?locale=en-gb
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded
____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com
[-- Attachment #2: Type: text/html, Size: 2573 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: virt_to_bus and DMA
2006-11-24 17:18 virt_to_bus and DMA Manish Joshi
@ 2006-12-21 21:18 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-21 21:18 UTC (permalink / raw)
To: Manish Joshi; +Cc: linuxppc-embedded, Ilse Reyneke
>
>
> Am I also correct in saying the "standard DMA API" (request_dma,
> set_dma_addr etc) is NOT available on the 4xx?
The standard DMA mapping API is: dma_map_* and that's what you should be
using.
At one point, virt_to_bus() will be removed and use of __pa in drivers
is highly discouraged.
Ben.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-12-21 21:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-24 17:18 virt_to_bus and DMA Manish Joshi
2006-12-21 21:18 ` Benjamin Herrenschmidt
-- strict thread matches above, loose matches on Subject: below --
2006-11-24 15:37 Ilse Reyneke
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).