hisi_pwrc_sram.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (c) 2017, 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 <cortex_a53.h>
  9. #include <hi6220.h>
  10. #include <hisi_sram_map.h>
  11. .global pm_asm_code
  12. .global pm_asm_code_end
  13. .global v7_asm
  14. .global v7_asm_end
  15. func pm_asm_code _align=3
  16. mov x0, 0
  17. msr oslar_el1, x0
  18. mrs x0, CORTEX_A53_CPUACTLR_EL1
  19. bic x0, x0, #(CORTEX_A53_CPUACTLR_EL1_RADIS | \
  20. CORTEX_A53_CPUACTLR_EL1_L1RADIS)
  21. orr x0, x0, #0x180000
  22. orr x0, x0, #0xe000
  23. msr CORTEX_A53_CPUACTLR_EL1, x0
  24. mrs x3, actlr_el3
  25. orr x3, x3, #ACTLR_EL3_L2ECTLR_BIT
  26. msr actlr_el3, x3
  27. mrs x3, actlr_el2
  28. orr x3, x3, #ACTLR_EL2_L2ECTLR_BIT
  29. msr actlr_el2, x3
  30. ldr x3, =PWRCTRL_ACPU_ASM_D_ARM_PARA_AD
  31. mrs x0, mpidr_el1
  32. and x1, x0, #MPIDR_CPU_MASK
  33. and x0, x0, #MPIDR_CLUSTER_MASK
  34. add x0, x1, x0, LSR #6
  35. pen: ldr x4, [x3, x0, LSL #3]
  36. cbz x4, pen
  37. mov x0, #0x0
  38. mov x1, #0x0
  39. mov x2, #0x0
  40. mov x3, #0x0
  41. br x4
  42. .ltorg
  43. pm_asm_code_end:
  44. endfunc pm_asm_code
  45. /*
  46. * By default, all cores in Hi6220 reset with aarch32 mode.
  47. * Now hardcode ARMv7 instructions to execute warm reset for
  48. * switching aarch64 mode.
  49. */
  50. .align 3
  51. .section .rodata.v7_asm, "aS"
  52. v7_asm:
  53. .word 0xE1A00000 // nop
  54. .word 0xE3A02003 // mov r2, #3
  55. .word 0xEE0C2F50 // mcr 15, 0, r2, cr12, cr0, {2}
  56. .word 0xE320F003 // wfi
  57. .ltorg
  58. v7_asm_end: