mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-13 23:02:59 +00:00
f5bd13ed57
On linux kernel side, on STM32F7 and STM32H7 SoCs, DMA requires uncachable regions. These regions are defined in DT. Since kernel linux v4.15, on ARMv7-M Cortex, kernel is able to configure MPU regions depending on DT settings. As kernel is able to configure MPU, this allows to remove MPU region settings in bootloader. On Cortex M processors, MPU allows to use a default memory map. (see B3.5.4 MPU Control Register, MPU_CTRL in https://developer.arm.com/products/architecture/m-profile/docs/ddi0403/latest/armv7-m-architecture-reference-manual) Use the default memory map as background region for all STM32 SoCs family with an additional MPU region corresponding to the SDRAM area. Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
42 lines
916 B
C
42 lines
916 B
C
/*
|
|
* Copyright (C) 2017, STMicroelectronics - All Rights Reserved
|
|
* Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#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[] = {
|
|
/*
|
|
* Make SDRAM area cacheable & executable.
|
|
*/
|
|
#if defined(CONFIG_STM32F4)
|
|
{ 0x00000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
|
|
O_I_WB_RD_WR_ALLOC, REGION_16MB },
|
|
#endif
|
|
|
|
#if defined(CONFIG_STM32F7)
|
|
{ 0xC0000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
|
|
O_I_WB_RD_WR_ALLOC, REGION_16MB },
|
|
#endif
|
|
|
|
#if defined(CONFIG_STM32H7)
|
|
{ 0xD0000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
|
|
O_I_WB_RD_WR_ALLOC, REGION_32MB },
|
|
#endif
|
|
};
|
|
|
|
disable_mpu();
|
|
for (i = 0; i < ARRAY_SIZE(stm32_region_config); i++)
|
|
mpu_config(&stm32_region_config[i]);
|
|
enable_mpu();
|
|
|
|
return 0;
|
|
}
|