summaryrefslogtreecommitdiff
path: root/arch/nios2/include
diff options
context:
space:
mode:
authorThomas Chou <thomas@wytron.com.tw>2015-10-22 15:38:24 +0800
committerThomas Chou <thomas@wytron.com.tw>2015-10-23 14:55:48 +0800
commit8a3ea979666799d09b57efd05d0b41bda1ac7d69 (patch)
tree2f1677f5f21400b2c6b8d7ca28ce00df3313a3f9 /arch/nios2/include
parent485e2d8edd3a3f87d9475bf1396143a3ab5097e5 (diff)
downloadu-boot-imx-8a3ea979666799d09b57efd05d0b41bda1ac7d69.zip
u-boot-imx-8a3ea979666799d09b57efd05d0b41bda1ac7d69.tar.gz
u-boot-imx-8a3ea979666799d09b57efd05d0b41bda1ac7d69.tar.bz2
nios2: fix virt_to_phys for nios2 with MMU
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> Acked-by: Marek Vasut <marex@denx.de> Reviewed-by: Ley Foon Tan <lftan@altera.com>
Diffstat (limited to 'arch/nios2/include')
-rw-r--r--arch/nios2/include/asm/io.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
index d0adf08..e7da35b 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;
}
static inline void *ioremap(unsigned long physaddr, unsigned long size)