blob: 692dbcc04a89eaade43c75400908264c3f36abd9 [file] [log] [blame]
Patrice Chotard1e1d02d2017-09-13 18:00:12 +02001/*
Patrice Chotard789ee0e2017-10-23 09:53:58 +02002 * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
3 * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics.
Patrice Chotard1e1d02d2017-09-13 18:00:12 +02004 *
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}