blob: 74a9350a31f0d38fa0c8457d36198ae8b10cd6a0 [file] [log] [blame]
Toshifumi NISHINAGA65bfb9c2016-07-08 01:02:24 +09001/*
2 * (C) Copyright 2015
3 * Kamil Lulko, <kamil.lulko@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
9#include <asm/io.h>
Vikas Manochaa645cba2017-05-03 16:38:56 -070010#include <asm/armv7m_mpu.h>
Toshifumi NISHINAGA65bfb9c2016-07-08 01:02:24 +090011#include <asm/arch/stm32.h>
12
13u32 get_cpu_rev(void)
14{
15 return 0;
16}
17
18int arch_cpu_init(void)
19{
Vikas Manochaa645cba2017-05-03 16:38:56 -070020 struct mpu_region_config stm32_region_config[] = {
21 { 0x00000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
Vikas Manocha97b78902017-05-03 16:38:57 -070022 O_I_WB_RD_WR_ALLOC, REGION_4GB },
23
24 { 0x00000000, REGION_1, XN_DIS, PRIV_RW_USR_RW,
25 STRONG_ORDER, REGION_512MB },
26
27 { 0x40000000, REGION_2, XN_EN, PRIV_RW_USR_RW,
28 DEVICE_NON_SHARED, REGION_512MB },
29
30 { 0xA0000000, REGION_3, XN_EN, PRIV_RW_USR_RW,
31 DEVICE_NON_SHARED, REGION_512MB },
Toshifumi NISHINAGA18bd7632016-07-08 01:02:25 +090032
Vikas Manocha97b78902017-05-03 16:38:57 -070033 { 0xE0000000, REGION_4, XN_EN, PRIV_RW_USR_RW,
34 STRONG_ORDER, REGION_512MB },
Vikas Manochaa645cba2017-05-03 16:38:56 -070035 };
Toshifumi NISHINAGA18bd7632016-07-08 01:02:25 +090036
Vikas Manochaa645cba2017-05-03 16:38:56 -070037 disable_mpu();
38 for (int i = 0; i < ARRAY_SIZE(stm32_region_config); i++)
39 mpu_config(&stm32_region_config[i]);
40 enable_mpu();
Toshifumi NISHINAGA18bd7632016-07-08 01:02:25 +090041
Toshifumi NISHINAGA65bfb9c2016-07-08 01:02:24 +090042 return 0;
43}
44
45void s_init(void)
46{
47}