2 * Common Blackfin startup code
4 * Copyright 2004-2008 Analog Devices Inc.
6 * Enter bugs at http://blackfin.uclinux.org/
8 * Licensed under the GPL-2 or later.
11 #include <linux/linkage.h>
12 #include <linux/init.h>
13 #include <asm/blackfin.h>
14 #include <asm/thread_info.h>
15 #include <asm/trace.h>
16 #include <asm/asm-offsets.h>
20 ENTRY(__init_clear_bss)
23 if cc jump .L_bss_done;
27 lsetup (1f, 1f) lc0 = p2;
31 ENDPROC(__init_clear_bss)
33 #define INITIAL_STACK (L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12)
36 /* R0: argument of command line string, passed from uboot, save it */
38 /* Enable Cycle Counter and Nesting Of Interrupts */
39 #ifdef CONFIG_BFIN_SCRATCH_REG_CYCLES
42 R0 = SYSCFG_SNEN | SYSCFG_CCEN;
47 /* Clear Out All the data and pointer Registers */
69 /* Clear Out All the DAG Registers */
86 * Clear ITEST_COMMAND and DTEST_COMMAND registers,
87 * Leaving these as non-zero can confuse the emulator
89 p0.L = LO(DTEST_COMMAND);
90 p0.H = HI(DTEST_COMMAND);
92 [p0 + (ITEST_COMMAND - DTEST_COMMAND)] = R0;
95 trace_buffer_init(p0,r0);
99 /* Turn off the icache */
100 p0.l = LO(IMEM_CONTROL);
101 p0.h = HI(IMEM_CONTROL);
108 /* Turn off the dcache */
109 p0.l = LO(DMEM_CONTROL);
110 p0.h = HI(DMEM_CONTROL);
117 /* in case of double faults, save a few things */
123 #ifdef CONFIG_DEBUG_DOUBLEFAULT
124 /* Only save these if we are storing them,
125 * This happens here, since L1 gets clobbered
129 r7 = [p0 + PDA_RETX];
130 p1.l = _init_saved_retx;
131 p1.h = _init_saved_retx;
134 r7 = [p0 + PDA_DCPLB];
135 p1.l = _init_saved_dcplb_fault_addr;
136 p1.h = _init_saved_dcplb_fault_addr;
139 r7 = [p0 + PDA_ICPLB];
140 p1.l = _init_saved_icplb_fault_addr;
141 p1.h = _init_saved_icplb_fault_addr;
144 r7 = [p0 + PDA_SEQSTAT];
145 p1.l = _init_saved_seqstat;
146 p1.h = _init_saved_seqstat;
150 /* Initialize stack pointer */
151 sp.l = lo(INITIAL_STACK);
152 sp.h = hi(INITIAL_STACK);
156 #ifdef CONFIG_EARLY_PRINTK
157 call _init_early_exception_vectors;
161 /* Zero out all of the fun bss regions */
162 #if L1_DATA_A_LENGTH > 0
167 call __init_clear_bss
169 #if L1_DATA_B_LENGTH > 0
174 call __init_clear_bss
181 call __init_clear_bss
187 call __init_clear_bss
189 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */
190 call _bfin_relocate_l1_mem;
191 #ifdef CONFIG_BFIN_KERNEL_CLOCK
195 /* This section keeps the processor in supervisor mode
196 * during kernel boot. Switches to user mode at end of boot.
197 * See page 3-9 of Hardware Reference manual for documentation.
200 /* EVT15 = _real_start */
225 /* A little BF561 glue ... */
227 # define WDOG_CTL WDOGA_CTL
231 /* Enable nested interrupts */
234 /* watchdog off for now */
241 /* Pass the u-boot arguments to the global value command line */
245 /* Load the current thread pointer and stack */
246 sp.l = _init_thread_union;
247 sp.h = _init_thread_union;
248 p1 = THREAD_SIZE (z);
255 jump.l _start_kernel;