diff options
author | Tom Rini <trini@konsulko.com> | 2015-11-06 14:21:33 (GMT) |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-11-06 14:21:33 (GMT) |
commit | 4ca0c3c993436cca743ed521e7f3d784d7fe31c8 (patch) | |
tree | 4a14903a7134569b12206d439603d9db04647af7 /arch/nios2/include | |
parent | 250ea267d875ce3ff0e046308d31f51ff8d3b5e8 (diff) | |
parent | 75199d6f722a0f711628194240ee5bf724e31101 (diff) | |
download | u-boot-4ca0c3c993436cca743ed521e7f3d784d7fe31c8.tar.xz |
Merge branch 'master' of git://git.denx.de/u-boot-nios
Diffstat (limited to 'arch/nios2/include')
-rw-r--r-- | arch/nios2/include/asm/global_data.h | 2 | ||||
-rw-r--r-- | arch/nios2/include/asm/io.h | 19 |
2 files changed, 12 insertions, 9 deletions
diff --git a/arch/nios2/include/asm/global_data.h b/arch/nios2/include/asm/global_data.h index d6a2cfa..9863fd9 100644 --- a/arch/nios2/include/asm/global_data.h +++ b/arch/nios2/include/asm/global_data.h @@ -18,6 +18,8 @@ struct arch_global_data { int has_initda; int has_mmu; u32 io_region_base; + u32 mem_region_base; + u32 physaddr_mask; }; #include <asm-generic/global_data.h> diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h index e7da35b..03a3418 100644 --- a/arch/nios2/include/asm/io.h +++ b/arch/nios2/include/asm/io.h @@ -18,15 +18,19 @@ 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_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) +#define MAP_NOCACHE 1 +#define MAP_WRCOMBINE 0 +#define MAP_WRBACK 0 +#define MAP_WRTHROUGH 0 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); } /* @@ -40,10 +44,7 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags) static inline phys_addr_t virt_to_phys(void * vaddr) { DECLARE_GLOBAL_DATA_PTR; - if (gd->arch.has_mmu) - return (phys_addr_t)vaddr & 0x1fffffff; - else - return (phys_addr_t)vaddr & 0x7fffffff; + return (phys_addr_t)vaddr & gd->arch.physaddr_mask; } static inline void *ioremap(unsigned long physaddr, unsigned long size) |