diff options
author | Tom Rini <trini@konsulko.com> | 2018-11-04 08:12:21 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-11-04 08:12:21 -0500 |
commit | 5ef76e59c12c79d106ebda70b710468aa6bd8b75 (patch) | |
tree | 4e0120867b94d75ebac8b18bdc0c93a13c1c317c /arch/arm/mach-rmobile/memmap-gen3.c | |
parent | 5d6fefa8051a29b26169983cbcf9378bb363f8b2 (diff) | |
parent | a376dde1deb9cc42e3804b9c654f873c936cc8d4 (diff) | |
download | u-boot-5ef76e59c12c79d106ebda70b710468aa6bd8b75.tar.gz u-boot-5ef76e59c12c79d106ebda70b710468aa6bd8b75.tar.xz u-boot-5ef76e59c12c79d106ebda70b710468aa6bd8b75.zip |
Merge branch 'master' of git://git.denx.de/u-boot-sh
Diffstat (limited to 'arch/arm/mach-rmobile/memmap-gen3.c')
-rw-r--r-- | arch/arm/mach-rmobile/memmap-gen3.c | 89 |
1 files changed, 88 insertions, 1 deletions
diff --git a/arch/arm/mach-rmobile/memmap-gen3.c b/arch/arm/mach-rmobile/memmap-gen3.c index 92c8f2e80d..7e29ccc351 100644 --- a/arch/arm/mach-rmobile/memmap-gen3.c +++ b/arch/arm/mach-rmobile/memmap-gen3.c @@ -8,7 +8,9 @@ #include <common.h> #include <asm/armv8/mmu.h> -static struct mm_region gen3_mem_map[] = { +#define GEN3_NR_REGIONS 16 + +static struct mm_region gen3_mem_map[GEN3_NR_REGIONS] = { { .virt = 0x0UL, .phys = 0x0UL, @@ -42,3 +44,88 @@ static struct mm_region gen3_mem_map[] = { }; struct mm_region *mem_map = gen3_mem_map; + +DECLARE_GLOBAL_DATA_PTR; + +void enable_caches(void) +{ + u64 start, size; + int bank, i = 0; + + /* Create map for RPC access */ + gen3_mem_map[i].virt = 0x0ULL; + gen3_mem_map[i].phys = 0x0ULL; + gen3_mem_map[i].size = 0x40000000ULL; + gen3_mem_map[i].attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN; + i++; + + /* Generate entires for DRAM in 32bit address space */ + for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) { + start = gd->bd->bi_dram[bank].start; + size = gd->bd->bi_dram[bank].size; + + /* Skip empty DRAM banks */ + if (!size) + continue; + + /* Skip DRAM above 4 GiB */ + if (start >> 32ULL) + continue; + + /* Mark memory reserved by ATF as cacheable too. */ + if (start == 0x48000000) { + start = 0x40000000ULL; + size += 0x08000000ULL; + } + + gen3_mem_map[i].virt = start; + gen3_mem_map[i].phys = start; + gen3_mem_map[i].size = size; + gen3_mem_map[i].attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_INNER_SHARE; + i++; + } + + /* Create map for register access */ + gen3_mem_map[i].virt = 0xc0000000ULL; + gen3_mem_map[i].phys = 0xc0000000ULL; + gen3_mem_map[i].size = 0x40000000ULL; + gen3_mem_map[i].attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN; + i++; + + /* Generate entires for DRAM in 64bit address space */ + for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) { + start = gd->bd->bi_dram[bank].start; + size = gd->bd->bi_dram[bank].size; + + /* Skip empty DRAM banks */ + if (!size) + continue; + + /* Skip DRAM below 4 GiB */ + if (!(start >> 32ULL)) + continue; + + gen3_mem_map[i].virt = start; + gen3_mem_map[i].phys = start; + gen3_mem_map[i].size = size; + gen3_mem_map[i].attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_INNER_SHARE; + i++; + } + + /* Zero out the remaining regions. */ + for (; i < GEN3_NR_REGIONS; i++) { + gen3_mem_map[i].virt = 0; + gen3_mem_map[i].phys = 0; + gen3_mem_map[i].size = 0; + gen3_mem_map[i].attrs = 0; + } + + icache_enable(); + dcache_enable(); +} |