soc.c 912 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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)
  21. { 0xC0000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
  22. O_I_WB_RD_WR_ALLOC, REGION_16MB },
  23. #endif
  24. #if defined(CONFIG_STM32H7)
  25. { 0xD0000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
  26. O_I_WB_RD_WR_ALLOC, REGION_32MB },
  27. #endif
  28. };
  29. disable_mpu();
  30. for (i = 0; i < ARRAY_SIZE(stm32_region_config); i++)
  31. mpu_config(&stm32_region_config[i]);
  32. enable_mpu();
  33. return 0;
  34. }