omap-headsmp.S 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * Secondary CPU startup routine source file.
  3. *
  4. * Copyright (C) 2009-2014 Texas Instruments, Inc.
  5. *
  6. * Author:
  7. * Santosh Shilimkar <santosh.shilimkar@ti.com>
  8. *
  9. * Interface functions needed for the SMP. This file is based on arm
  10. * realview smp platform.
  11. * Copyright (c) 2003 ARM Limited.
  12. *
  13. * This program is free software,you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * published by the Free Software Foundation.
  16. */
  17. #include <linux/linkage.h>
  18. #include <linux/init.h>
  19. #include <asm/assembler.h>
  20. #include "omap44xx.h"
  21. /* Physical address needed since MMU not enabled yet on secondary core */
  22. #define AUX_CORE_BOOT0_PA 0x48281800
  23. #define API_HYP_ENTRY 0x102
  24. ENTRY(omap_secondary_startup)
  25. #ifdef CONFIG_SMP
  26. b secondary_startup
  27. #else
  28. /* Should never get here */
  29. again: wfi
  30. b again
  31. #endif
  32. #ENDPROC(omap_secondary_startup)
  33. /*
  34. * OMAP5 specific entry point for secondary CPU to jump from ROM
  35. * code. This routine also provides a holding flag into which
  36. * secondary core is held until we're ready for it to initialise.
  37. * The primary core will update this flag using a hardware
  38. * register AuxCoreBoot0.
  39. */
  40. ENTRY(omap5_secondary_startup)
  41. wait: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0
  42. ldr r0, [r2]
  43. mov r0, r0, lsr #5
  44. mrc p15, 0, r4, c0, c0, 5
  45. and r4, r4, #0x0f
  46. cmp r0, r4
  47. bne wait
  48. b omap_secondary_startup
  49. ENDPROC(omap5_secondary_startup)
  50. /*
  51. * Same as omap5_secondary_startup except we call into the ROM to
  52. * enable HYP mode first. This is called instead of
  53. * omap5_secondary_startup if the primary CPU was put into HYP mode by
  54. * the boot loader.
  55. */
  56. ENTRY(omap5_secondary_hyp_startup)
  57. wait_2: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0
  58. ldr r0, [r2]
  59. mov r0, r0, lsr #5
  60. mrc p15, 0, r4, c0, c0, 5
  61. and r4, r4, #0x0f
  62. cmp r0, r4
  63. bne wait_2
  64. ldr r12, =API_HYP_ENTRY
  65. badr r0, hyp_boot
  66. smc #0
  67. hyp_boot:
  68. b omap_secondary_startup
  69. ENDPROC(omap5_secondary_hyp_startup)
  70. /*
  71. * OMAP4 specific entry point for secondary CPU to jump from ROM
  72. * code. This routine also provides a holding flag into which
  73. * secondary core is held until we're ready for it to initialise.
  74. * The primary core will update this flag using a hardware
  75. * register AuxCoreBoot0.
  76. */
  77. ENTRY(omap4_secondary_startup)
  78. hold: ldr r12,=0x103
  79. dsb
  80. smc #0 @ read from AuxCoreBoot0
  81. mov r0, r0, lsr #9
  82. mrc p15, 0, r4, c0, c0, 5
  83. and r4, r4, #0x0f
  84. cmp r0, r4
  85. bne hold
  86. /*
  87. * we've been released from the wait loop,secondary_stack
  88. * should now contain the SVC stack for this core
  89. */
  90. b omap_secondary_startup
  91. ENDPROC(omap4_secondary_startup)
  92. ENTRY(omap4460_secondary_startup)
  93. hold_2: ldr r12,=0x103
  94. dsb
  95. smc #0 @ read from AuxCoreBoot0
  96. mov r0, r0, lsr #9
  97. mrc p15, 0, r4, c0, c0, 5
  98. and r4, r4, #0x0f
  99. cmp r0, r4
  100. bne hold_2
  101. /*
  102. * GIC distributor control register has changed between
  103. * CortexA9 r1pX and r2pX. The Control Register secure
  104. * banked version is now composed of 2 bits:
  105. * bit 0 == Secure Enable
  106. * bit 1 == Non-Secure Enable
  107. * The Non-Secure banked register has not changed
  108. * Because the ROM Code is based on the r1pX GIC, the CPU1
  109. * GIC restoration will cause a problem to CPU0 Non-Secure SW.
  110. * The workaround must be:
  111. * 1) Before doing the CPU1 wakeup, CPU0 must disable
  112. * the GIC distributor
  113. * 2) CPU1 must re-enable the GIC distributor on
  114. * it's wakeup path.
  115. */
  116. ldr r1, =OMAP44XX_GIC_DIST_BASE
  117. ldr r0, [r1]
  118. orr r0, #1
  119. str r0, [r1]
  120. /*
  121. * we've been released from the wait loop,secondary_stack
  122. * should now contain the SVC stack for this core
  123. */
  124. b omap_secondary_startup
  125. ENDPROC(omap4460_secondary_startup)