]> git.sur5r.net Git - u-boot/commitdiff
nios2: fix map_physmem to do real cache mapping
authorThomas Chou <thomas@wytron.com.tw>
Tue, 27 Oct 2015 00:30:22 +0000 (08:30 +0800)
committerThomas Chou <thomas@wytron.com.tw>
Fri, 6 Nov 2015 01:14:11 +0000 (09:14 +0800)
Fix the map_physmem() to do real cache mapping.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Marek Vasut <marex@denx.de>
arch/nios2/cpu/cpu.c
arch/nios2/include/asm/global_data.h
arch/nios2/include/asm/io.h

index ff0fa20798fbc74fdb1ccd59fdade5f80b8b7631..88c4e184eef31daae84fde0cee32a2d67181de32 100644 (file)
@@ -117,7 +117,8 @@ static int altera_nios2_probe(struct udevice *dev)
                "altr,has-initda", 0);
        gd->arch.has_mmu = fdtdec_get_int(blob, node,
                "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;
 }
index d6a2cfab4f9e58444dd4fcfc21248e5b8df16435..9f3bd001973eee1bff98dd1043dce278f9dce7c7 100644 (file)
@@ -18,6 +18,7 @@ struct arch_global_data {
        int has_initda;
        int has_mmu;
        u32 io_region_base;
+       u32 mem_region_base;
 };
 
 #include <asm-generic/global_data.h>
index e7da35b0c9efa9920487d36e28fce733b18d84a4..007df8d9ba22e72ee3141720f672c8b8c43542bb 100644 (file)
@@ -18,7 +18,7 @@ static inline void sync(void)
  * that can be used to access the memory range with the caching
  * properties specified by "flags".
  */
-#define MAP_NOCACHE    (0)
+#define MAP_NOCACHE    (1)
 #define MAP_WRCOMBINE  (0)
 #define MAP_WRBACK     (0)
 #define MAP_WRTHROUGH  (0)
@@ -26,7 +26,11 @@ static inline void sync(void)
 static inline void *
 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);
 }
 
 /*