Angel Pons | f23ae0b | 2020-04-02 23:48:12 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Gabe Black | 3c7e939 | 2013-05-26 07:15:57 -0700 | [diff] [blame] | 2 | |
| 3 | #include <types.h> |
| 4 | |
| 5 | #include <arch/cache.h> |
Alexander Couzens | 8c53b75 | 2014-10-24 23:52:56 +0200 | [diff] [blame] | 6 | #include <bootblock_common.h> |
Sam Lewis | b535396 | 2020-08-03 21:14:26 +1000 | [diff] [blame] | 7 | #include <symbols.h> |
| 8 | |
| 9 | #define SRAM_START ((uintptr_t)_sram / MiB) |
| 10 | #define SRAM_END (DIV_ROUND_UP((uintptr_t)_esram, MiB)) |
| 11 | |
| 12 | #define DRAM_START ((uintptr_t)_dram / MiB) |
| 13 | #define DRAM_SIZE (CONFIG_DRAM_SIZE_MB) |
Gabe Black | 3c7e939 | 2013-05-26 07:15:57 -0700 | [diff] [blame] | 14 | |
Vadim Bendebury | 0b341b3 | 2014-04-23 11:09:44 -0700 | [diff] [blame] | 15 | void bootblock_soc_init(void) |
Gabe Black | 3c7e939 | 2013-05-26 07:15:57 -0700 | [diff] [blame] | 16 | { |
Sam Lewis | b535396 | 2020-08-03 21:14:26 +1000 | [diff] [blame] | 17 | mmu_init(); |
Gabe Black | 3c7e939 | 2013-05-26 07:15:57 -0700 | [diff] [blame] | 18 | |
Sam Lewis | b535396 | 2020-08-03 21:14:26 +1000 | [diff] [blame] | 19 | /* Map everything strongly ordered by default */ |
| 20 | mmu_config_range(0, 4096, DCACHE_OFF); |
| 21 | |
| 22 | mmu_config_range(SRAM_START, SRAM_END - SRAM_START, |
| 23 | DCACHE_WRITEBACK); |
| 24 | |
| 25 | mmu_config_range(DRAM_START, DRAM_SIZE, DCACHE_WRITEBACK); |
| 26 | |
| 27 | dcache_mmu_enable(); |
Gabe Black | 3c7e939 | 2013-05-26 07:15:57 -0700 | [diff] [blame] | 28 | } |