idle-v7.S 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Idle processing for ARMv7-based Qualcomm SoCs.
  3. *
  4. * Copyright (C) 2007 Google, Inc.
  5. * Copyright (c) 2007-2009, 2011-2014, 2018, The Linux Foundation.
  6. * All rights reserved.
  7. *
  8. * This software is licensed under the terms of the GNU General Public
  9. * License version 2, as published by the Free Software Foundation, and
  10. * may be copied, distributed, and modified under those terms.
  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. */
  18. #include <linux/linkage.h>
  19. #include <linux/threads.h>
  20. #include <asm/assembler.h>
  21. .arm
  22. ENTRY(msm_pm_boot_entry)
  23. THUMB( adr r9, BSYM(2f) ) /* Kernel is always entered in ARM. */
  24. THUMB( bx r9 ) /* If this is a Thumb-2 kernel, */
  25. THUMB( .thumb ) /* switch to Thumb now. */
  26. THUMB(2: )
  27. mrc p15, 0, r0, c0, c0, 5 /* MPIDR */
  28. bic r0, #0xff000000 /* what CPU am I */
  29. bic r0, #0x00ff0000 /* clear bits 31-16 */
  30. adr r3, 3f
  31. ldr r1, [r3]
  32. sub r3, r1, r3 /* r3 holds the virt to phy offset */
  33. ldr r1, =msm_pc_debug_counters_phys /* phys addr for IMEM reg */
  34. sub r1, r1, r3 /* translate virt to phys */
  35. ldr r1,[r1]
  36. cmp r1, #0
  37. beq skip_pc_debug3
  38. mov r2, r0, lsr #8 /* get cluster num */
  39. add r1, r1, r2, lsl #6 /* get offset of cluster */
  40. and r2, r0, #0xff
  41. add r1, r1, r2, lsl #4 /* get offset for the cpu */
  42. add r1, #4 /* warmboot entry counter */
  43. ldr r2, [r1]
  44. add r2, #1
  45. str r2, [r1]
  46. skip_pc_debug3:
  47. ldr r1, =msm_pm_boot_vector
  48. sub r1, r1, r3 /* translate virt to phys */
  49. mov r2, r0, lsr #8 /* get cluster num */
  50. add r1, r1, r2, lsl #4 /* Get offset for the cluster */
  51. and r0, r0, #0xff /* cpu id */
  52. add r1, r1, r0, lsl #2 /* Get offset for the cpu */
  53. ldr pc, [r1] /* jump */
  54. ENDPROC(msm_pm_boot_entry)
  55. 3: .long .
  56. .data
  57. .globl msm_pm_boot_vector
  58. msm_pm_boot_vector:
  59. .space 4 * 4 * 4
  60. .globl msm_pc_debug_counters_phys
  61. msm_pc_debug_counters_phys:
  62. .long 0x0