Angel Pons | 5f249e6 | 2020-04-04 18:51:01 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Patrick Rudolph | 06c7d64 | 2018-03-26 15:54:41 +0200 | [diff] [blame] | 2 | |
| 3 | #include <symbols.h> |
| 4 | #include <soc/addressmap.h> |
| 5 | #include <soc/mmu.h> |
| 6 | #include <soc/sdram.h> |
| 7 | #include <arch/mmu.h> |
| 8 | |
| 9 | void soc_mmu_init(void) |
| 10 | { |
| 11 | const unsigned long devmem = MA_DEV | MA_S | MA_RW; |
| 12 | const unsigned long secure_mem = MA_MEM | MA_S | MA_RW; |
| 13 | |
| 14 | mmu_init(); |
| 15 | |
| 16 | /* |
| 17 | * Need to use secure mem attribute, as firmware is running in ARM TZ |
| 18 | * region. |
| 19 | */ |
Julius Werner | 7e0dea6 | 2019-02-20 18:39:22 -0800 | [diff] [blame] | 20 | mmu_config_range((void *)_ttb, REGION_SIZE(ttb), secure_mem); |
Patrick Rudolph | 06c7d64 | 2018-03-26 15:54:41 +0200 | [diff] [blame] | 21 | mmu_config_range((void *)_dram, sdram_size_mb() * MiB, secure_mem); |
| 22 | /* IO space has the MSB set and is divided into 4 sub-regions: |
| 23 | * * NCB |
| 24 | * * SLI |
| 25 | * * RSL |
| 26 | * * AP |
| 27 | */ |
| 28 | mmu_config_range((void *)IO_SPACE_START, IO_SPACE_SIZE, devmem); |
| 29 | |
| 30 | mmu_enable(); |
| 31 | } |