soc.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (C) STMicroelectronics SA 2017
  3. * Author(s): Patrice CHOTARD, <patrice.chotard@st.com> for STMicroelectronics.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <asm/io.h>
  9. #include <asm/armv7m_mpu.h>
  10. u32 get_cpu_rev(void)
  11. {
  12. return 0;
  13. }
  14. int arch_cpu_init(void)
  15. {
  16. int i;
  17. struct mpu_region_config stm32_region_config[] = {
  18. /*
  19. * Make all 4GB cacheable & executable. We are overriding it
  20. * with next region for any requirement. e.g. below region1,
  21. * 2 etc.
  22. * In other words, the area not coming in following
  23. * regions configuration is the one configured here in region_0
  24. * (cacheable & executable).
  25. */
  26. { 0x00000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
  27. O_I_WB_RD_WR_ALLOC, REGION_4GB },
  28. /* Code area, executable & strongly ordered */
  29. { 0xD0000000, REGION_1, XN_EN, PRIV_RW_USR_RW,
  30. STRONG_ORDER, REGION_8MB },
  31. /* Device area in all H7 : Not executable */
  32. { 0x40000000, REGION_2, XN_EN, PRIV_RW_USR_RW,
  33. DEVICE_NON_SHARED, REGION_512MB },
  34. /*
  35. * Armv7m fixed configuration: strongly ordered & not
  36. * executable, not cacheable
  37. */
  38. { 0xE0000000, REGION_4, XN_EN, PRIV_RW_USR_RW,
  39. STRONG_ORDER, REGION_512MB },
  40. };
  41. disable_mpu();
  42. for (i = 0; i < ARRAY_SIZE(stm32_region_config); i++)
  43. mpu_config(&stm32_region_config[i]);
  44. enable_mpu();
  45. return 0;
  46. }
  47. void s_init(void)
  48. {
  49. }