sleep.S 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
  3. * Author: Tony Xie <tony.xie@rock-chips.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. */
  15. #include <linux/linkage.h>
  16. #include <asm/assembler.h>
  17. #include <asm/memory.h>
  18. .data
  19. /*
  20. * this code will be copied from
  21. * ddr to sram for system resumeing.
  22. * so it is ".data section".
  23. */
  24. .align 2
  25. ENTRY(rockchip_slp_cpu_resume)
  26. setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r1 @ set svc, irqs off
  27. mrc p15, 0, r1, c0, c0, 5
  28. and r1, r1, #0xf
  29. cmp r1, #0
  30. /* olny cpu0 can continue to run, the others is halt here */
  31. beq cpu0run
  32. secondary_loop:
  33. wfe
  34. b secondary_loop
  35. cpu0run:
  36. ldr r3, rkpm_bootdata_l2ctlr_f
  37. cmp r3, #0
  38. beq sp_set
  39. ldr r3, rkpm_bootdata_l2ctlr
  40. mcr p15, 1, r3, c9, c0, 2
  41. sp_set:
  42. ldr sp, rkpm_bootdata_cpusp
  43. ldr r1, rkpm_bootdata_cpu_code
  44. bx r1
  45. ENDPROC(rockchip_slp_cpu_resume)
  46. /* Parameters filled in by the kernel */
  47. /* Flag for whether to restore L2CTLR on resume */
  48. .global rkpm_bootdata_l2ctlr_f
  49. rkpm_bootdata_l2ctlr_f:
  50. .long 0
  51. /* Saved L2CTLR to restore on resume */
  52. .global rkpm_bootdata_l2ctlr
  53. rkpm_bootdata_l2ctlr:
  54. .long 0
  55. /* CPU resume SP addr */
  56. .globl rkpm_bootdata_cpusp
  57. rkpm_bootdata_cpusp:
  58. .long 0
  59. /* CPU resume function (physical address) */
  60. .globl rkpm_bootdata_cpu_code
  61. rkpm_bootdata_cpu_code:
  62. .long 0
  63. ENTRY(rk3288_bootram_sz)
  64. .word . - rockchip_slp_cpu_resume