blob: 340c7fba334f8296322fe9fa22d362f43c8ba1ef [file] [log] [blame]
Yann Gautieree8f5422019-02-14 11:13:25 +01001/*
2 * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Yann Gautiere3bf9132019-05-07 18:52:17 +02007#include <assert.h>
8
Yann Gautieree8f5422019-02-14 11:13:25 +01009#include <platform_def.h>
10
11#include <lib/xlat_tables/xlat_tables_v2.h>
12
Yann Gautiera2e2a302019-02-14 11:13:39 +010013#define MAP_SRAM MAP_REGION_FLAT(STM32MP_SYSRAM_BASE, \
14 STM32MP_SYSRAM_SIZE, \
Yann Gautieree8f5422019-02-14 11:13:25 +010015 MT_MEMORY | \
16 MT_RW | \
17 MT_SECURE | \
18 MT_EXECUTE_NEVER)
19
20#define MAP_DEVICE1 MAP_REGION_FLAT(STM32MP1_DEVICE1_BASE, \
21 STM32MP1_DEVICE1_SIZE, \
22 MT_DEVICE | \
23 MT_RW | \
24 MT_SECURE | \
25 MT_EXECUTE_NEVER)
26
27#define MAP_DEVICE2 MAP_REGION_FLAT(STM32MP1_DEVICE2_BASE, \
28 STM32MP1_DEVICE2_SIZE, \
29 MT_DEVICE | \
30 MT_RW | \
31 MT_SECURE | \
32 MT_EXECUTE_NEVER)
33
34#if defined(IMAGE_BL2)
35static const mmap_region_t stm32mp1_mmap[] = {
36 MAP_SRAM,
37 MAP_DEVICE1,
38 MAP_DEVICE2,
39 {0}
40};
41#endif
42#if defined(IMAGE_BL32)
43static const mmap_region_t stm32mp1_mmap[] = {
44 MAP_SRAM,
45 MAP_DEVICE1,
46 MAP_DEVICE2,
47 {0}
48};
49#endif
50
51void configure_mmu(void)
52{
53 mmap_add(stm32mp1_mmap);
54 init_xlat_tables();
55
56 enable_mmu_svc_mon(0);
57}
Yann Gautiere3bf9132019-05-07 18:52:17 +020058
59unsigned long stm32_get_gpio_bank_clock(unsigned int bank)
60{
61 if (bank == GPIO_BANK_Z) {
62 return GPIOZ;
63 }
64
65 assert(GPIO_BANK_A == 0 && bank <= GPIO_BANK_K);
66
67 return GPIOA + (bank - GPIO_BANK_A);
68}