2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2017-09-13 16:00:12 +00:00
|
|
|
/*
|
2017-10-23 07:53:58 +00:00
|
|
|
* Copyright (C) 2017, STMicroelectronics - All Rights Reserved
|
|
|
|
* Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics.
|
2017-09-13 16:00:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/io.h>
|
2018-04-26 12:51:30 +00:00
|
|
|
#include <asm/armv7_mpu.h>
|
2017-09-13 16:00:12 +00:00
|
|
|
|
|
|
|
int arch_cpu_init(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
struct mpu_region_config stm32_region_config[] = {
|
|
|
|
/*
|
2018-02-28 16:15:00 +00:00
|
|
|
* Make SDRAM area cacheable & executable.
|
2017-09-13 16:00:12 +00:00
|
|
|
*/
|
2018-02-28 16:15:00 +00:00
|
|
|
#if defined(CONFIG_STM32F4)
|
2017-09-13 16:00:12 +00:00
|
|
|
{ 0x00000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
|
2019-06-25 11:24:03 +00:00
|
|
|
O_I_WB_RD_WR_ALLOC, REGION_512MB },
|
2018-02-28 16:15:00 +00:00
|
|
|
#endif
|
2017-09-13 16:00:12 +00:00
|
|
|
|
2019-04-26 08:52:51 +00:00
|
|
|
{ 0x90000000, REGION_1, XN_DIS, PRIV_RW_USR_RW,
|
|
|
|
SHARED_WRITE_BUFFERED, REGION_256MB },
|
|
|
|
|
2018-10-02 07:03:10 +00:00
|
|
|
#if defined(CONFIG_STM32F7) || defined(CONFIG_STM32H7)
|
2018-02-28 16:15:00 +00:00
|
|
|
{ 0xC0000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
|
2018-10-02 07:03:10 +00:00
|
|
|
O_I_WB_RD_WR_ALLOC, REGION_512MB },
|
2017-11-16 07:59:21 +00:00
|
|
|
#endif
|
2017-09-13 16:00:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
disable_mpu();
|
|
|
|
for (i = 0; i < ARRAY_SIZE(stm32_region_config); i++)
|
|
|
|
mpu_config(&stm32_region_config[i]);
|
|
|
|
enable_mpu();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|