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>
|
|
|
|
#include <asm/armv7m_mpu.h>
|
|
|
|
|
|
|
|
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,
|
2018-02-28 16:15:00 +00:00
|
|
|
O_I_WB_RD_WR_ALLOC, REGION_16MB },
|
|
|
|
#endif
|
2017-09-13 16:00:12 +00:00
|
|
|
|
2018-02-28 16:15:00 +00:00
|
|
|
#if defined(CONFIG_STM32F7)
|
|
|
|
{ 0xC0000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
|
|
|
|
O_I_WB_RD_WR_ALLOC, REGION_16MB },
|
|
|
|
#endif
|
2017-11-16 07:59:21 +00:00
|
|
|
|
2018-02-28 16:15:00 +00:00
|
|
|
#if defined(CONFIG_STM32H7)
|
|
|
|
{ 0xD0000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
|
|
|
|
O_I_WB_RD_WR_ALLOC, REGION_32MB },
|
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;
|
|
|
|
}
|