imx_aips.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <lib/mmio.h>
  7. #include <lib/utils_def.h>
  8. #include <imx_aips.h>
  9. #include <imx_regs.h>
  10. static void imx_aips_set_default_access(struct aipstz_regs *aips_regs)
  11. {
  12. int i;
  13. uintptr_t addr;
  14. /*
  15. * See section 4.7.7.1 AIPSTZ_MPR field descriptions
  16. * i.MX 7Solo Applications Processor Reference Manual, Rev. 0.1, 08/2016
  17. * 0111 ->
  18. * 0: Write Access from master not buffered
  19. * 1: Master is trusted for read access
  20. * 1: Master is trsuted for write access
  21. * 1: Access from master is not forced to user mode
  22. */
  23. addr = (uintptr_t)&aips_regs->aipstz_mpr;
  24. mmio_write_32(addr, 0x77777777);
  25. /*
  26. * Helpfully the OPACR registers have the logical inversion of the above
  27. * See section 4.7.7.1 AIPSTZ_MPR field descriptions
  28. * i.MX 7Solo Applications Processor Reference Manual, Rev. 0.1, 08/2016
  29. * 0000 ->
  30. * 0: Write Access to the peripheral is not buffered by AIPSTZ
  31. * 0: The peripheral does not require supervisor priv to access
  32. * 0: Master is trsuted for write access
  33. * 0: Access from master is not forced to user mode
  34. */
  35. for (i = 0; i < AIPSTZ_OAPCR_COUNT; i++) {
  36. addr = (uintptr_t)&aips_regs->aipstz_opacr[i];
  37. mmio_write_32(addr, 0x00000000);
  38. }
  39. }
  40. void imx_aips_init(void)
  41. {
  42. int i;
  43. struct aipstz_regs *aips_regs[] = {
  44. (struct aipstz_regs *)(AIPS1_BASE + AIPSTZ_CONFIG_OFFSET),
  45. (struct aipstz_regs *)(AIPS2_BASE + AIPSTZ_CONFIG_OFFSET),
  46. (struct aipstz_regs *)(AIPS3_BASE + AIPSTZ_CONFIG_OFFSET),
  47. };
  48. for (i = 0; i < ARRAY_SIZE(aips_regs); i++)
  49. imx_aips_set_default_access(aips_regs[i]);
  50. }