2 * BF561 coreB bootstrap file
4 * Copyright 2007-2009 Analog Devices Inc.
5 * Philippe Gerum <rpm@xenomai.org>
7 * Licensed under the GPL-2 or later.
10 #include <linux/linkage.h>
11 #include <linux/init.h>
12 #include <asm/blackfin.h>
13 #include <asm/asm-offsets.h>
14 #include <asm/trace.h>
17 * This code must come first as CoreB is hardcoded (in hardware)
18 * to start at the beginning of its L1 instruction memory.
20 .section .l1.text.head
22 /* Lay the initial stack into the L1 scratch area of Core B */
23 #define INITIAL_STACK (COREB_L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12)
25 ENTRY(_coreb_trampoline_start)
26 /* Enable Cycle Counter and Nesting Of Interrupts */
27 #ifdef CONFIG_BFIN_SCRATCH_REG_CYCLES
30 R0 = SYSCFG_SNEN | SYSCFG_CCEN;
34 /* Optimization register tricks: keep a base value in the
35 * reserved P registers so we use the load/store with an
36 * offset syntax. R0 = [P5 + <constant>];
42 p5.h = hi(COREMMR_BASE);
44 /* Zero out registers required by Blackfin ABI */
46 /* Disable circular buffers */
52 /* Disable hardware loops in case we were started by 'go' */
57 * Clear ITEST_COMMAND and DTEST_COMMAND registers,
58 * Leaving these as non-zero can confuse the emulator
60 [p5 + (DTEST_COMMAND - COREMMR_BASE)] = r6;
61 [p5 + (ITEST_COMMAND - COREMMR_BASE)] = r6;
64 trace_buffer_init(p0,r0);
66 /* Turn off the icache */
67 r1 = [p5 + (IMEM_CONTROL - COREMMR_BASE)];
68 BITCLR (r1, ENICPLB_P);
69 [p5 + (IMEM_CONTROL - COREMMR_BASE)] = r1;
72 /* Turn off the dcache */
73 r1 = [p5 + (DMEM_CONTROL - COREMMR_BASE)];
74 BITCLR (r1, ENDCPLB_P);
75 [p5 + (DMEM_CONTROL - COREMMR_BASE)] = r1;
78 /* in case of double faults, save a few things */
79 p0.l = _init_retx_coreb;
80 p0.h = _init_retx_coreb;
84 #ifdef CONFIG_DEBUG_DOUBLEFAULT
85 /* Only save these if we are storing them,
86 * This happens here, since L1 gets clobbered
90 r5 = [p0 + PDA_DF_RETX];
91 p1.l = _init_saved_retx_coreb;
92 p1.h = _init_saved_retx_coreb;
95 r5 = [p0 + PDA_DF_DCPLB];
96 p1.l = _init_saved_dcplb_fault_addr_coreb;
97 p1.h = _init_saved_dcplb_fault_addr_coreb;
100 r5 = [p0 + PDA_DF_ICPLB];
101 p1.l = _init_saved_icplb_fault_addr_coreb;
102 p1.h = _init_saved_icplb_fault_addr_coreb;
105 r5 = [p0 + PDA_DF_SEQSTAT];
106 p1.l = _init_saved_seqstat_coreb;
107 p1.h = _init_saved_seqstat_coreb;
111 /* Initialize stack pointer */
112 sp.l = lo(INITIAL_STACK);
113 sp.h = hi(INITIAL_STACK);
117 /* This section keeps the processor in supervisor mode
118 * during core B startup. Branches to the idle task.
121 /* EVT15 = _real_start */
125 [p5 + (EVT15 - COREMMR_BASE)] = p1;
135 #if defined(ANOMALY_05000281)
142 ENDPROC(_coreb_trampoline_start)
144 #ifdef CONFIG_HOTPLUG_CPU
147 sp.l = lo(INITIAL_STACK);
148 sp.h = hi(INITIAL_STACK);
157 R0 = IWR_DISABLE_ALL;
158 P0.H = hi(SYSMMR_BASE);
159 P0.L = lo(SYSMMR_BASE);
160 [P0 + (SICB_IWR0 - SYSMMR_BASE)] = R0;
161 [P0 + (SICB_IWR1 - SYSMMR_BASE)] = R0;
164 p0.h = hi(COREB_L1_CODE_START);
165 p0.l = lo(COREB_L1_CODE_START);
174 p0.l = lo(WDOGB_CTL);
175 p0.h = hi(WDOGB_CTL);
177 w[p0] = r0; /* Clear the watchdog. */
181 * switch to IDLE stack.
183 p0.l = _secondary_stack;
184 p0.h = _secondary_stack;
188 #ifdef CONFIG_HOTPLUG_CPU
189 p0.l = _hotplug_coreb;
190 p0.h = _hotplug_coreb;
198 #ifdef CONFIG_HOTPLUG_CPU
201 call _secondary_start_kernel;
204 ENDPROC(_coreb_start)