Skip to content
Snippets Groups Projects
Commit 8a3ea979 authored by Thomas Chou's avatar Thomas Chou
Browse files

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: default avatarThomas Chou <thomas@wytron.com.tw>
Acked-by: default avatarMarek Vasut <marex@denx.de>
Reviewed-by: default avatarLey Foon Tan <lftan@altera.com>
parent 485e2d8e
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags) ...@@ -39,7 +39,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
static inline phys_addr_t virt_to_phys(void * vaddr) 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) static inline void *ioremap(unsigned long physaddr, unsigned long size)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment