sleep.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
  4. * Author: Tony Xie <[email protected]>
  5. */
  6. #include <linux/linkage.h>
  7. #include <asm/assembler.h>
  8. #include <asm/memory.h>
  9. .data
  10. /*
  11. * this code will be copied from
  12. * ddr to sram for system resumeing.
  13. * so it is ".data section".
  14. */
  15. .align 2
  16. ENTRY(rockchip_slp_cpu_resume)
  17. setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r1 @ set svc, irqs off
  18. mrc p15, 0, r1, c0, c0, 5
  19. and r1, r1, #0xf
  20. cmp r1, #0
  21. /* olny cpu0 can continue to run, the others is halt here */
  22. beq cpu0run
  23. secondary_loop:
  24. wfe
  25. b secondary_loop
  26. cpu0run:
  27. ldr r3, rkpm_bootdata_l2ctlr_f
  28. cmp r3, #0
  29. beq sp_set
  30. ldr r3, rkpm_bootdata_l2ctlr
  31. mcr p15, 1, r3, c9, c0, 2
  32. sp_set:
  33. ldr sp, rkpm_bootdata_cpusp
  34. ldr r1, rkpm_bootdata_cpu_code
  35. bx r1
  36. ENDPROC(rockchip_slp_cpu_resume)
  37. /* Parameters filled in by the kernel */
  38. /* Flag for whether to restore L2CTLR on resume */
  39. .global rkpm_bootdata_l2ctlr_f
  40. rkpm_bootdata_l2ctlr_f:
  41. .long 0
  42. /* Saved L2CTLR to restore on resume */
  43. .global rkpm_bootdata_l2ctlr
  44. rkpm_bootdata_l2ctlr:
  45. .long 0
  46. /* CPU resume SP addr */
  47. .globl rkpm_bootdata_cpusp
  48. rkpm_bootdata_cpusp:
  49. .long 0
  50. /* CPU resume function (physical address) */
  51. .globl rkpm_bootdata_cpu_code
  52. rkpm_bootdata_cpu_code:
  53. .long 0
  54. ENTRY(rk3288_bootram_sz)
  55. .word . - rockchip_slp_cpu_resume