linux-mips
[Top] [All Lists]

Re: Question: about Physical Address mapping

To: linux-mips@linux-mips.org
Subject: Re: Question: about Physical Address mapping
From: "Dennis.Yxun" <dennis.yxun@gmail.com>
Date: Wed, 9 Dec 2009 09:58:26 +0800
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:content-type; bh=8w1kWHiVqUBQakr8iN6vmd9d/yK4h5kZly9AFD6Luzw=; b=avjfvxS9qsZejKKkD5kCOXFq6wETvyXxpXphX/IYEYJJ8tJWZMSeiLqCIRYqg7kjgr f+Ptu0/sK8yHTG27xEgYuf/XydaxwaZ5NMe+F/+K4fkuwbsilqmyEZGMHdzY9SpeStYj cGAtnUIjZSs38UKRBE8K28OkSO1b7+KXXgpWk=
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 :content-type; b=HBbk/mWuf8dD2lEvSmBhvxnD/zDpy8AsrCoWSdEP2kBqg6rl8YFAZR+MqvZKH9Q8aC 5qem+jGfzkacTgKO0ODM/VbdaNeftoOEnrEc0gT3p8N8xrqkzcbYEXlGK/eX/mJ78wJR DC2J3jfWVY7fMZMYuUSVPDXKCqgA/nq+nZktQ=
In-reply-to: <20091207131034.GA5119@linux-mips.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <7b09df4c0912062339g418f432cr28d92c18ed273d2@mail.gmail.com> <20091207131034.GA5119@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
On Mon, Dec 7, 2009 at 9:10 PM, Ralf Baechle <ralf@linux-mips.org> wrote:
On Mon, Dec 07, 2009 at 03:39:15PM +0800, Dennis.Yxun wrote:

> HI ALL:
>    I have a problem, that our MIPS hardware put registers location from
> 0x7000,0000 -0x7040,0000.
> So, I need to init TLB to access those registers.
>    My question is: can I map those range to Kseg2 (mapped,uncached)? I found
> "add_wired_entry" sit in
> kernel code, seems I should use this function.
>
>    I found code in arch/mips/jazz/irq.c, and the comment tells me
> /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
>    add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);
>
> does that mean after add_wired_entry, virtual address 0xe400,0000 map to
> physical address 0x600005C0?
> why the address is 0x6000,05C0, not 0x6000,0000

I probably knew 15 years ago when I wrote this code :)

add_wired_entry() is a very awkard API and its use in the Jazz code is
broken so I suggest you use ioremap() instead.

 Ralf

As you suggested, I plan to use ioremap()
it generally works if I use in my driver code after kernel initialization finished
but I still have a problem:

How can I access hardware register very early?
say that, use early_printk() to access UART registers,
And I try to put ioremap() at prom_init() to try to remap UART register
but, found that kernel will hang..
the UART register is start from physical address 0x700007c0 (> 512M)
but address below 512M can be remaped successfully

I spend a few minutes digging into the ioremap() function
it simply remap <512M space to KSEG1,
while other physical space use different scheme (map to KSEG2), quite complicated....
<Prev in Thread] Current Thread [Next in Thread>