secondary.S 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * File: arch/blackfin/mach-bf561/secondary.S
  3. * Based on: arch/blackfin/mach-bf561/head.S
  4. * Author: Philippe Gerum <rpm@xenomai.org>
  5. *
  6. * Copyright 2007 Analog Devices Inc.
  7. *
  8. * Description: BF561 coreB bootstrap file
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, see the file COPYING, or write
  22. * to the Free Software Foundation, Inc.,
  23. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  24. */
  25. #include <linux/linkage.h>
  26. #include <linux/init.h>
  27. #include <asm/blackfin.h>
  28. #include <asm/asm-offsets.h>
  29. __INIT
  30. /* Lay the initial stack into the L1 scratch area of Core B */
  31. #define INITIAL_STACK (COREB_L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12)
  32. ENTRY(_coreb_trampoline_start)
  33. /* Set the SYSCFG register */
  34. R0 = 0x36;
  35. SYSCFG = R0; /*Enable Cycle Counter and Nesting Of Interrupts(3rd Bit)*/
  36. R0 = 0;
  37. /*Clear Out All the data and pointer Registers*/
  38. R1 = R0;
  39. R2 = R0;
  40. R3 = R0;
  41. R4 = R0;
  42. R5 = R0;
  43. R6 = R0;
  44. R7 = R0;
  45. P0 = R0;
  46. P1 = R0;
  47. P2 = R0;
  48. P3 = R0;
  49. P4 = R0;
  50. P5 = R0;
  51. LC0 = r0;
  52. LC1 = r0;
  53. L0 = r0;
  54. L1 = r0;
  55. L2 = r0;
  56. L3 = r0;
  57. /* Clear Out All the DAG Registers*/
  58. B0 = r0;
  59. B1 = r0;
  60. B2 = r0;
  61. B3 = r0;
  62. I0 = r0;
  63. I1 = r0;
  64. I2 = r0;
  65. I3 = r0;
  66. M0 = r0;
  67. M1 = r0;
  68. M2 = r0;
  69. M3 = r0;
  70. /* Turn off the icache */
  71. p0.l = LO(IMEM_CONTROL);
  72. p0.h = HI(IMEM_CONTROL);
  73. R1 = [p0];
  74. R0 = ~ENICPLB;
  75. R0 = R0 & R1;
  76. /* Disabling of CPLBs should be proceeded by a CSYNC */
  77. CSYNC;
  78. [p0] = R0;
  79. SSYNC;
  80. /* Turn off the dcache */
  81. p0.l = LO(DMEM_CONTROL);
  82. p0.h = HI(DMEM_CONTROL);
  83. R1 = [p0];
  84. R0 = ~ENDCPLB;
  85. R0 = R0 & R1;
  86. /* Disabling of CPLBs should be proceeded by a CSYNC */
  87. CSYNC;
  88. [p0] = R0;
  89. SSYNC;
  90. /* in case of double faults, save a few things */
  91. p0.l = _init_retx_coreb;
  92. p0.h = _init_retx_coreb;
  93. R0 = RETX;
  94. [P0] = R0;
  95. #ifdef CONFIG_DEBUG_DOUBLEFAULT
  96. /* Only save these if we are storing them,
  97. * This happens here, since L1 gets clobbered
  98. * below
  99. */
  100. GET_PDA(p0, r0);
  101. r7 = [p0 + PDA_DF_RETX];
  102. p1.l = _init_saved_retx_coreb;
  103. p1.h = _init_saved_retx_coreb;
  104. [p1] = r7;
  105. r7 = [p0 + PDA_DF_DCPLB];
  106. p1.l = _init_saved_dcplb_fault_addr_coreb;
  107. p1.h = _init_saved_dcplb_fault_addr_coreb;
  108. [p1] = r7;
  109. r7 = [p0 + PDA_DF_ICPLB];
  110. p1.l = _init_saved_icplb_fault_addr_coreb;
  111. p1.h = _init_saved_icplb_fault_addr_coreb;
  112. [p1] = r7;
  113. r7 = [p0 + PDA_DF_SEQSTAT];
  114. p1.l = _init_saved_seqstat_coreb;
  115. p1.h = _init_saved_seqstat_coreb;
  116. [p1] = r7;
  117. #endif
  118. /* Initialize stack pointer */
  119. sp.l = lo(INITIAL_STACK);
  120. sp.h = hi(INITIAL_STACK);
  121. fp = sp;
  122. usp = sp;
  123. /* This section keeps the processor in supervisor mode
  124. * during core B startup. Branches to the idle task.
  125. */
  126. /* EVT15 = _real_start */
  127. p0.l = lo(EVT15);
  128. p0.h = hi(EVT15);
  129. p1.l = _coreb_start;
  130. p1.h = _coreb_start;
  131. [p0] = p1;
  132. csync;
  133. p0.l = lo(IMASK);
  134. p0.h = hi(IMASK);
  135. p1.l = IMASK_IVG15;
  136. p1.h = 0x0;
  137. [p0] = p1;
  138. csync;
  139. raise 15;
  140. p0.l = .LWAIT_HERE;
  141. p0.h = .LWAIT_HERE;
  142. reti = p0;
  143. #if defined(ANOMALY_05000281)
  144. nop; nop; nop;
  145. #endif
  146. rti;
  147. .LWAIT_HERE:
  148. jump .LWAIT_HERE;
  149. ENDPROC(_coreb_trampoline_start)
  150. ENTRY(_coreb_trampoline_end)
  151. ENTRY(_coreb_start)
  152. [--sp] = reti;
  153. p0.l = lo(WDOGB_CTL);
  154. p0.h = hi(WDOGB_CTL);
  155. r0 = 0xAD6(z);
  156. w[p0] = r0; /* Clear the watchdog. */
  157. ssync;
  158. /*
  159. * switch to IDLE stack.
  160. */
  161. p0.l = _secondary_stack;
  162. p0.h = _secondary_stack;
  163. sp = [p0];
  164. usp = sp;
  165. fp = sp;
  166. sp += -12;
  167. call _init_pda
  168. sp += 12;
  169. call _secondary_start_kernel;
  170. .L_exit:
  171. jump.s .L_exit;
  172. ENDPROC(_coreb_start)
  173. __FINIT