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 | |
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')
-rw-r--r-- | arch/nios2/cpu/cpu.c | 4 | ||||
-rw-r--r-- | arch/nios2/cpu/start.S | 5 | ||||
-rw-r--r-- | arch/nios2/include/asm/global_data.h | 2 | ||||
-rw-r--r-- | arch/nios2/include/asm/io.h | 19 |
4 files changed, 17 insertions, 13 deletions
diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c index ff0fa20..f6d5cd3 100644 --- a/arch/nios2/cpu/cpu.c +++ b/arch/nios2/cpu/cpu.c @@ -117,7 +117,9 @@ 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; + gd->arch.physaddr_mask = gd->arch.has_mmu ? 0x1fffffff : 0x7fffffff; return 0; } diff --git a/arch/nios2/cpu/start.S b/arch/nios2/cpu/start.S index 8758e7e..54787c5 100644 --- a/arch/nios2/cpu/start.S +++ b/arch/nios2/cpu/start.S @@ -81,6 +81,7 @@ _cur: movhi r5, %hi(_cur - _start) mov r8, r4 movhi r5, %hi(_start) ori r5, r5, %lo(_start) /* r5 <- linked _start */ + mov sp, r5 /* initial stack below u-boot code */ beq r4, r5, 3f movhi r6, %hi(CONFIG_SYS_MONITOR_LEN) @@ -100,8 +101,6 @@ _cur: movhi r5, %hi(_cur - _start) _reloc: /* STACK INIT -- zero top two words for call back chain. */ - movhi sp, %hi(CONFIG_SYS_INIT_SP) - ori sp, sp, %lo(CONFIG_SYS_INIT_SP) addi sp, sp, -8 stw r0, 0(sp) stw r0, 4(sp) @@ -159,7 +158,7 @@ relocate_code: ori r6, r6, %lo(__bss_end) beq r5, r6, 5f -4: stwio r0, 0(r5) +4: stw r0, 0(r5) addi r5, r5, 4 bne r5, r6, 4b 5: 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) |