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

nios2: fix map_physmem to do real cache mapping


Fix the map_physmem() to do real cache mapping.

Signed-off-by: default avatarThomas Chou <thomas@wytron.com.tw>
Acked-by: default avatarMarek Vasut <marex@denx.de>
parent ed02c532
No related branches found
No related tags found
No related merge requests found
...@@ -117,7 +117,8 @@ static int altera_nios2_probe(struct udevice *dev) ...@@ -117,7 +117,8 @@ static int altera_nios2_probe(struct udevice *dev)
"altr,has-initda", 0); "altr,has-initda", 0);
gd->arch.has_mmu = fdtdec_get_int(blob, node, gd->arch.has_mmu = fdtdec_get_int(blob, node,
"altr,has-mmu", 0); "altr,has-mmu", 0);
gd->arch.io_region_base = gd->arch.has_mmu ? 0xe0000000 : 0x8000000; gd->arch.io_region_base = gd->arch.has_mmu ? 0xe0000000 : 0x80000000;
gd->arch.mem_region_base = gd->arch.has_mmu ? 0xc0000000 : 0x00000000;
return 0; return 0;
} }
......
...@@ -18,6 +18,7 @@ struct arch_global_data { ...@@ -18,6 +18,7 @@ struct arch_global_data {
int has_initda; int has_initda;
int has_mmu; int has_mmu;
u32 io_region_base; u32 io_region_base;
u32 mem_region_base;
}; };
#include <asm-generic/global_data.h> #include <asm-generic/global_data.h>
......
...@@ -18,7 +18,7 @@ static inline void sync(void) ...@@ -18,7 +18,7 @@ static inline void sync(void)
* that can be used to access the memory range with the caching * that can be used to access the memory range with the caching
* properties specified by "flags". * properties specified by "flags".
*/ */
#define MAP_NOCACHE (0) #define MAP_NOCACHE (1)
#define MAP_WRCOMBINE (0) #define MAP_WRCOMBINE (0)
#define MAP_WRBACK (0) #define MAP_WRBACK (0)
#define MAP_WRTHROUGH (0) #define MAP_WRTHROUGH (0)
...@@ -26,7 +26,11 @@ static inline void sync(void) ...@@ -26,7 +26,11 @@ static inline void sync(void)
static inline void * static inline void *
map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
{ {
return (void *)paddr; DECLARE_GLOBAL_DATA_PTR;
if (flags)
return (void *)(paddr | gd->arch.io_region_base);
else
return (void *)(paddr | gd->arch.mem_region_base);
} }
/* /*
......
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