cortex_a7.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch.h>
  7. #include <asm_macros.S>
  8. #include <assert_macros.S>
  9. #include <cortex_a7.h>
  10. #include <cpu_macros.S>
  11. .macro assert_cache_enabled
  12. #if ENABLE_ASSERTIONS
  13. ldcopr r0, SCTLR
  14. tst r0, #SCTLR_C_BIT
  15. ASM_ASSERT(eq)
  16. #endif
  17. .endm
  18. func cortex_a7_disable_smp
  19. ldcopr r0, ACTLR
  20. bic r0, #CORTEX_A7_ACTLR_SMP_BIT
  21. stcopr r0, ACTLR
  22. isb
  23. dsb sy
  24. bx lr
  25. endfunc cortex_a7_disable_smp
  26. func cortex_a7_enable_smp
  27. ldcopr r0, ACTLR
  28. orr r0, #CORTEX_A7_ACTLR_SMP_BIT
  29. stcopr r0, ACTLR
  30. isb
  31. bx lr
  32. endfunc cortex_a7_enable_smp
  33. func cortex_a7_reset_func
  34. b cortex_a7_enable_smp
  35. endfunc cortex_a7_reset_func
  36. func cortex_a7_core_pwr_dwn
  37. push {r12, lr}
  38. assert_cache_enabled
  39. /* Flush L1 cache */
  40. mov r0, #DC_OP_CISW
  41. bl dcsw_op_level1
  42. /* Exit cluster coherency */
  43. pop {r12, lr}
  44. b cortex_a7_disable_smp
  45. endfunc cortex_a7_core_pwr_dwn
  46. func cortex_a7_cluster_pwr_dwn
  47. push {r12, lr}
  48. assert_cache_enabled
  49. /* Flush L1 caches */
  50. mov r0, #DC_OP_CISW
  51. bl dcsw_op_level1
  52. bl plat_disable_acp
  53. /* Flush L2 caches */
  54. mov r0, #DC_OP_CISW
  55. bl dcsw_op_level2
  56. /* Exit cluster coherency */
  57. pop {r12, lr}
  58. b cortex_a7_disable_smp
  59. endfunc cortex_a7_cluster_pwr_dwn
  60. declare_cpu_ops cortex_a7, CORTEX_A7_MIDR, \
  61. cortex_a7_reset_func, \
  62. cortex_a7_core_pwr_dwn, \
  63. cortex_a7_cluster_pwr_dwn