omap-headsmp.S 3.5 KB

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