omap-headsmp.S 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 "omap44xx.h"
  20. /* Physical address needed since MMU not enabled yet on secondary core */
  21. #define AUX_CORE_BOOT0_PA 0x48281800
  22. #define API_HYP_ENTRY 0x102
  23. /*
  24. * OMAP5 specific entry point for secondary CPU to jump from ROM
  25. * code. This routine also provides a holding flag into which
  26. * secondary core is held until we're ready for it to initialise.
  27. * The primary core will update this flag using a hardware
  28. * register AuxCoreBoot0.
  29. */
  30. ENTRY(omap5_secondary_startup)
  31. wait: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0
  32. ldr r0, [r2]
  33. mov r0, r0, lsr #5
  34. mrc p15, 0, r4, c0, c0, 5
  35. and r4, r4, #0x0f
  36. cmp r0, r4
  37. bne wait
  38. b secondary_startup
  39. ENDPROC(omap5_secondary_startup)
  40. /*
  41. * Same as omap5_secondary_startup except we call into the ROM to
  42. * enable HYP mode first. This is called instead of
  43. * omap5_secondary_startup if the primary CPU was put into HYP mode by
  44. * the boot loader.
  45. */
  46. ENTRY(omap5_secondary_hyp_startup)
  47. wait_2: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0
  48. ldr r0, [r2]
  49. mov r0, r0, lsr #5
  50. mrc p15, 0, r4, c0, c0, 5
  51. and r4, r4, #0x0f
  52. cmp r0, r4
  53. bne wait_2
  54. ldr r12, =API_HYP_ENTRY
  55. adr r0, hyp_boot
  56. smc #0
  57. hyp_boot:
  58. b secondary_startup
  59. ENDPROC(omap5_secondary_hyp_startup)
  60. /*
  61. * OMAP4 specific entry point for secondary CPU to jump from ROM
  62. * code. This routine also provides a holding flag into which
  63. * secondary core is held until we're ready for it to initialise.
  64. * The primary core will update this flag using a hardware
  65. * register AuxCoreBoot0.
  66. */
  67. ENTRY(omap4_secondary_startup)
  68. hold: ldr r12,=0x103
  69. dsb
  70. smc #0 @ read from AuxCoreBoot0
  71. mov r0, r0, lsr #9
  72. mrc p15, 0, r4, c0, c0, 5
  73. and r4, r4, #0x0f
  74. cmp r0, r4
  75. bne hold
  76. /*
  77. * we've been released from the wait loop,secondary_stack
  78. * should now contain the SVC stack for this core
  79. */
  80. b secondary_startup
  81. ENDPROC(omap4_secondary_startup)
  82. ENTRY(omap4460_secondary_startup)
  83. hold_2: ldr r12,=0x103
  84. dsb
  85. smc #0 @ read from AuxCoreBoot0
  86. mov r0, r0, lsr #9
  87. mrc p15, 0, r4, c0, c0, 5
  88. and r4, r4, #0x0f
  89. cmp r0, r4
  90. bne hold_2
  91. /*
  92. * GIC distributor control register has changed between
  93. * CortexA9 r1pX and r2pX. The Control Register secure
  94. * banked version is now composed of 2 bits:
  95. * bit 0 == Secure Enable
  96. * bit 1 == Non-Secure Enable
  97. * The Non-Secure banked register has not changed
  98. * Because the ROM Code is based on the r1pX GIC, the CPU1
  99. * GIC restoration will cause a problem to CPU0 Non-Secure SW.
  100. * The workaround must be:
  101. * 1) Before doing the CPU1 wakeup, CPU0 must disable
  102. * the GIC distributor
  103. * 2) CPU1 must re-enable the GIC distributor on
  104. * it's wakeup path.
  105. */
  106. ldr r1, =OMAP44XX_GIC_DIST_BASE
  107. ldr r0, [r1]
  108. orr r0, #1
  109. str r0, [r1]
  110. /*
  111. * we've been released from the wait loop,secondary_stack
  112. * should now contain the SVC stack for this core
  113. */
  114. b secondary_startup
  115. ENDPROC(omap4460_secondary_startup)