linux-mips
[Top] [All Lists]

Re: Dma addr should use Kuseg1 for MIPS32?

To: Ralf Baechle <ralf@linux-mips.org>
Subject: Re: Dma addr should use Kuseg1 for MIPS32?
From: figo zhang <figo1802@gmail.com>
Date: Wed, 9 Dec 2009 19:47:10 +0800
Cc: David Daney <ddaney@caviumnetworks.com>, macro@linux-mips.org, linux-mips@linux-mips.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=4eWKAXQFOkOjBFTAz7qgc6aPrrDof4uKC4QJdjMcQaM=; b=SYAcdXFm4DA+HHaPPWL6H4xdUTyMFADWwUOgfC6XG+JfSsS1lu4OdLkIxjXIMCtJgA gloHkddR0IG6jCzkFBEhh60jfiWQiYWJnxsORZlxUBsIB3SnB5anContk1gwII6Ixv9I AYjpFldt07/LAee3i10vOao5CLcIoRVY5SQsU=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=yDvgb4wB5/0LVagoigSM4j97VhjPxBZY0Nd8EBGOsGLeDvC8JSiEYhFNGBTpM0Ol4W eXetl2/GoglPbD7PeYuHmaHoJw3EYsY0i+4dJ7at3x3y1mcaIMLZ/wsrpX9zJdg2G20c GfRpjRM1XQ2MKXqoZhjm+XXU2SeI6mwQC8PZ4=
In-reply-to: <c6ed1ac50912071749m49b1e5f5m7ae53384389338d9@mail.gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <c6ed1ac50912070455n736af31fuf2c981fc182b494f@mail.gmail.com> <20091207134502.GB5119@linux-mips.org> <c6ed1ac50912071749m49b1e5f5m7ae53384389338d9@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org


2009/12/8 figo zhang <figo1802@gmail.com>


2009/12/7 Ralf Baechle <ralf@linux-mips.org>

On Mon, Dec 07, 2009 at 08:55:12PM +0800, figo zhang wrote:

> I am writing a driver for MIPS32. i wirte this code for DMA addr:
>
> dma_vaddr =(char*) __get_free_pages(GFP_KERNEL|
> GFP_DMA, order);

You probably don't want to use GFP_DMA - unless your hardware has DMA
restrictions such as the ISA's bus's 16MB limit.

> dma_phy = virt_to_phy(dma_vaddr);

Ouch.  Don't.  See Documentation/DMA-API.txt for how to do it.

hi Ralf,
is it using dma_alloc_coherent()? i see the this funtion in arch/mips/mm/dma_default.c, it also invork the 
__get_free_pages() and return the dma_addr by plat_map_dma_mem()->virt_to_phy() , see include/asm-mips/mach-genric/dma-coherent.h. so i think, i see use __get_free_pages() alloce buffer for DMA.

> i write dma_phy to DMA base register, but why it cannot work? it should
> write Kseg1 space to DMA register?
> I remember that it is ok for ARM/X86 .

It's only happens to work on some systems.

in my puzzle, if i run 
dma_vaddr =(char*) __get_free_pages(GFP_KERNEL,  order);

dma_phy = virt_to_phy(dma_vaddr);

if the result is:
dma_vaddr = 0x801b00000;
dma_phy = 0x1b00000;

so i should write 0x1b00000 to my DMA Base register or wirte (0x1b000000 | 0xa0000000) to DMA?

2. If my system have HIGHMEM, so i alloc highmem pages by :
  page = alloc_pages(__GFP_HIGHMEM, order);
  phy = page_to_phys(page);

how i write this highmem phy addr to DMA base register?

hi all,
 is anbody who would like to give me some advise about it?

Thanks,
Figo.zhang

Best,
Figo.zhang
 


 Ralf


<Prev in Thread] Current Thread [Next in Thread>