Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 1 | /* |
| 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 Manocha | a645cba | 2017-05-03 16:38:56 -0700 | [diff] [blame] | 10 | #include <asm/armv7m_mpu.h> |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 11 | #include <asm/arch/stm32.h> |
| 12 | |
| 13 | u32 get_cpu_rev(void) |
| 14 | { |
| 15 | return 0; |
| 16 | } |
| 17 | |
| 18 | int arch_cpu_init(void) |
| 19 | { |
Simon Glass | 5b93efa | 2017-07-01 11:06:09 -0600 | [diff] [blame] | 20 | int i; |
| 21 | |
Vikas Manocha | a645cba | 2017-05-03 16:38:56 -0700 | [diff] [blame] | 22 | struct mpu_region_config stm32_region_config[] = { |
| 23 | { 0x00000000, REGION_0, XN_DIS, PRIV_RW_USR_RW, |
Vikas Manocha | 97b7890 | 2017-05-03 16:38:57 -0700 | [diff] [blame] | 24 | O_I_WB_RD_WR_ALLOC, REGION_4GB }, |
| 25 | |
| 26 | { 0x00000000, REGION_1, XN_DIS, PRIV_RW_USR_RW, |
| 27 | STRONG_ORDER, REGION_512MB }, |
| 28 | |
| 29 | { 0x40000000, REGION_2, XN_EN, PRIV_RW_USR_RW, |
| 30 | DEVICE_NON_SHARED, REGION_512MB }, |
| 31 | |
| 32 | { 0xA0000000, REGION_3, XN_EN, PRIV_RW_USR_RW, |
| 33 | DEVICE_NON_SHARED, REGION_512MB }, |
Toshifumi NISHINAGA | 18bd763 | 2016-07-08 01:02:25 +0900 | [diff] [blame] | 34 | |
Vikas Manocha | 97b7890 | 2017-05-03 16:38:57 -0700 | [diff] [blame] | 35 | { 0xE0000000, REGION_4, XN_EN, PRIV_RW_USR_RW, |
| 36 | STRONG_ORDER, REGION_512MB }, |
Vikas Manocha | a645cba | 2017-05-03 16:38:56 -0700 | [diff] [blame] | 37 | }; |
Toshifumi NISHINAGA | 18bd763 | 2016-07-08 01:02:25 +0900 | [diff] [blame] | 38 | |
Vikas Manocha | a645cba | 2017-05-03 16:38:56 -0700 | [diff] [blame] | 39 | disable_mpu(); |
Simon Glass | 5b93efa | 2017-07-01 11:06:09 -0600 | [diff] [blame] | 40 | for (i = 0; i < ARRAY_SIZE(stm32_region_config); i++) |
Vikas Manocha | a645cba | 2017-05-03 16:38:56 -0700 | [diff] [blame] | 41 | mpu_config(&stm32_region_config[i]); |
| 42 | enable_mpu(); |
Toshifumi NISHINAGA | 18bd763 | 2016-07-08 01:02:25 +0900 | [diff] [blame] | 43 | |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 44 | return 0; |
| 45 | } |
| 46 | |
| 47 | void s_init(void) |
| 48 | { |
| 49 | } |