From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] nios2: fix virt_to_phys for nios2 with MMU
Date: Thu, 22 Oct 2015 03:43:22 +0200 [thread overview]
Message-ID: <201510220343.22672.marex@denx.de> (raw)
In-Reply-To: <1445433044-22465-1-git-send-email-thomas@wytron.com.tw>
On Wednesday, October 21, 2015 at 03:10:44 PM, Thomas Chou wrote:
> As the virtual address and physical address mapping of nios2 with
> MMU are different. Add a check of MMU, and fix the mapping.
>
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> arch/nios2/include/asm/io.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
> index d0adf08..fdfc14e 100644
> --- a/arch/nios2/include/asm/io.h
> +++ b/arch/nios2/include/asm/io.h
> @@ -39,7 +39,11 @@ static inline void unmap_physmem(void *vaddr, unsigned
> long flags)
>
> static inline phys_addr_t virt_to_phys(void * vaddr)
> {
> - return (phys_addr_t)(vaddr);
> + DECLARE_GLOBAL_DATA_PTR;
> + if (gd->arch.has_mmu)
> + return (phys_addr_t)(vaddr) & 0x1fffffff;
> + else
> + return (phys_addr_t)(vaddr) & 0x7fffffff;
I _think_ the parenthesis around vaddr are not necessary, but otherwise,
I really like to see this patch:
Acked-by: Marek Vasut <marex@denx.de>
> }
>
> static inline void *ioremap(unsigned long physaddr, unsigned long size)
Best regards,
Marek Vasut
next prev parent reply other threads:[~2015-10-22 1:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-21 13:10 [U-Boot] [PATCH] nios2: fix virt_to_phys for nios2 with MMU Thomas Chou
2015-10-22 1:43 ` Marek Vasut [this message]
2015-10-22 1:49 ` Ley Foon Tan
2015-10-22 7:47 ` [U-Boot] [PATCH v2] " Thomas Chou
2015-10-23 0:20 ` Thomas Chou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201510220343.22672.marex@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox