soc.c 865 B

123456789101112131415161718192021222324252627282930313233343536
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2019
  4. * Author(s): Giulio Benetti <giulio.benetti@benettiengineering.com>
  5. */
  6. #include <common.h>
  7. #include <init.h>
  8. #include <asm/io.h>
  9. #include <asm/armv7_mpu.h>
  10. int arch_cpu_init(void)
  11. {
  12. int i;
  13. struct mpu_region_config imxrt1050_region_config[] = {
  14. { 0x00000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
  15. STRONG_ORDER, REGION_4GB },
  16. { PHYS_SDRAM, REGION_1, XN_DIS, PRIV_RW_USR_RW,
  17. O_I_WB_RD_WR_ALLOC, (ffs(PHYS_SDRAM_SIZE) - 2) },
  18. { DMAMEM_BASE,
  19. REGION_2, XN_DIS, PRIV_RW_USR_RW,
  20. STRONG_ORDER, (ffs(DMAMEM_SZ_ALL) - 2) },
  21. };
  22. /*
  23. * Configure the memory protection unit (MPU) to allow full access to
  24. * the whole 4GB address space.
  25. */
  26. disable_mpu();
  27. for (i = 0; i < ARRAY_SIZE(imxrt1050_region_config); i++)
  28. mpu_config(&imxrt1050_region_config[i]);
  29. enable_mpu();
  30. return 0;
  31. }