sleep.S 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (c) 2013 Samsung Electronics Co., Ltd.
  3. * http://www.samsung.com
  4. *
  5. * Exynos low-level resume code
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. */
  17. #include <linux/linkage.h>
  18. #include "smc.h"
  19. #define CPU_MASK 0xff0ffff0
  20. #define CPU_CORTEX_A9 0x410fc090
  21. /*
  22. * The following code is located into the .data section. This is to
  23. * allow l2x0_regs_phys to be accessed with a relative load while we
  24. * can't rely on any MMU translation. We could have put l2x0_regs_phys
  25. * in the .text section as well, but some setups might insist on it to
  26. * be truly read-only. (Reference from: arch/arm/kernel/sleep.S)
  27. */
  28. .data
  29. .align
  30. /*
  31. * sleep magic, to allow the bootloader to check for an valid
  32. * image to resume to. Must be the first word before the
  33. * exynos_cpu_resume entry.
  34. */
  35. .word 0x2bedf00d
  36. /*
  37. * exynos_cpu_resume
  38. *
  39. * resume code entry for bootloader to call
  40. */
  41. ENTRY(exynos_cpu_resume)
  42. #ifdef CONFIG_CACHE_L2X0
  43. mrc p15, 0, r0, c0, c0, 0
  44. ldr r1, =CPU_MASK
  45. and r0, r0, r1
  46. ldr r1, =CPU_CORTEX_A9
  47. cmp r0, r1
  48. bleq l2c310_early_resume
  49. #endif
  50. b cpu_resume
  51. ENDPROC(exynos_cpu_resume)
  52. .align
  53. ENTRY(exynos_cpu_resume_ns)
  54. mrc p15, 0, r0, c0, c0, 0
  55. ldr r1, =CPU_MASK
  56. and r0, r0, r1
  57. ldr r1, =CPU_CORTEX_A9
  58. cmp r0, r1
  59. bne skip_cp15
  60. adr r0, cp15_save_power
  61. ldr r1, [r0]
  62. adr r0, cp15_save_diag
  63. ldr r2, [r0]
  64. mov r0, #SMC_CMD_C15RESUME
  65. dsb
  66. smc #0
  67. skip_cp15:
  68. b cpu_resume
  69. ENDPROC(exynos_cpu_resume_ns)
  70. .globl cp15_save_diag
  71. cp15_save_diag:
  72. .long 0 @ cp15 diagnostic
  73. .globl cp15_save_power
  74. cp15_save_power:
  75. .long 0 @ cp15 power control