blob: a65fab6d2ed885ae6dbc508c57240febaafcdc47 [file] [log] [blame]
Patrice Chotard246771b2017-09-13 18:00:12 +02001/*
2 * Copyright (C) STMicroelectronics SA 2017
3 * Author(s): Patrice CHOTARD, <patrice.chotard@st.com> for STMicroelectronics.
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
9#include <asm/io.h>
10#include <asm/armv7m_mpu.h>
11
12u32 get_cpu_rev(void)
13{
14 return 0;
15}
16
17int arch_cpu_init(void)
18{
19 int i;
20
21 struct mpu_region_config stm32_region_config[] = {
22 /*
23 * Make all 4GB cacheable & executable. We are overriding it
24 * with next region for any requirement. e.g. below region1,
25 * 2 etc.
26 * In other words, the area not coming in following
27 * regions configuration is the one configured here in region_0
28 * (cacheable & executable).
29 */
30 { 0x00000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
31 O_I_WB_RD_WR_ALLOC, REGION_4GB },
32
33 /* Code area, executable & strongly ordered */
34 { 0xD0000000, REGION_1, XN_EN, PRIV_RW_USR_RW,
35 STRONG_ORDER, REGION_8MB },
36
37 /* Device area in all H7 : Not executable */
38 { 0x40000000, REGION_2, XN_EN, PRIV_RW_USR_RW,
39 DEVICE_NON_SHARED, REGION_512MB },
40
41 /*
42 * Armv7m fixed configuration: strongly ordered & not
43 * executable, not cacheable
44 */
45 { 0xE0000000, REGION_4, XN_EN, PRIV_RW_USR_RW,
46 STRONG_ORDER, REGION_512MB },
47 };
48
49 disable_mpu();
50 for (i = 0; i < ARRAY_SIZE(stm32_region_config); i++)
51 mpu_config(&stm32_region_config[i]);
52 enable_mpu();
53
54 return 0;
55}
56
57void s_init(void)
58{
59}