soc.c 817 B

123456789101112131415161718192021222324252627282930313233343536
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
  4. * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics.
  5. */
  6. #include <common.h>
  7. #include <asm/io.h>
  8. #include <asm/armv7_mpu.h>
  9. int arch_cpu_init(void)
  10. {
  11. int i;
  12. struct mpu_region_config stm32_region_config[] = {
  13. /*
  14. * Make SDRAM area cacheable & executable.
  15. */
  16. #if defined(CONFIG_STM32F4)
  17. { 0x00000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
  18. O_I_WB_RD_WR_ALLOC, REGION_16MB },
  19. #endif
  20. #if defined(CONFIG_STM32F7) || defined(CONFIG_STM32H7)
  21. { 0xC0000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
  22. O_I_WB_RD_WR_ALLOC, REGION_512MB },
  23. #endif
  24. };
  25. disable_mpu();
  26. for (i = 0; i < ARRAY_SIZE(stm32_region_config); i++)
  27. mpu_config(&stm32_region_config[i]);
  28. enable_mpu();
  29. return 0;
  30. }