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>
19 #define INITIAL_STACK (L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12)
22 /* R0: argument of command line string, passed from uboot, save it */
24 /* Enable Cycle Counter and Nesting Of Interrupts */
25 #ifdef CONFIG_BFIN_SCRATCH_REG_CYCLES
28 R0 = SYSCFG_SNEN | SYSCFG_CCEN;
33 /* Clear Out All the data and pointer Registers */
55 /* Clear Out All the DAG Registers */
71 trace_buffer_init(p0,r0);
75 /* Turn off the icache */
76 p0.l = LO(IMEM_CONTROL);
77 p0.h = HI(IMEM_CONTROL);
84 /* Turn off the dcache */
85 p0.l = LO(DMEM_CONTROL);
86 p0.h = HI(DMEM_CONTROL);
93 /* Let each Blackfin family do its own thing */
94 call _mach_early_start;
96 /* Initialize stack pointer */
97 sp.l = lo(INITIAL_STACK);
98 sp.h = hi(INITIAL_STACK);
102 #ifdef CONFIG_EARLY_PRINTK
103 call _init_early_exception_vectors;
106 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */
107 call _bf53x_relocate_l1_mem;
108 #ifdef CONFIG_BFIN_KERNEL_CLOCK
109 call _start_dma_code;
112 /* This section keeps the processor in supervisor mode
113 * during kernel boot. Switches to user mode at end of boot.
114 * See page 3-9 of Hardware Reference manual for documentation.
117 /* EVT15 = _real_start */
146 /* A little BF561 glue ... */
148 # define WDOG_CTL WDOGA_CTL
152 /* Enable nested interrupts */
155 /* watchdog off for now */
162 /* Zero out the bss region
163 * Note: this will fail if bss is 0 bytes ...
174 lsetup (.L_clear_bss, .L_clear_bss) lc0 = p2;
178 /* In case there is a NULL pointer reference,
179 * zero out region before stext
186 lsetup (.L_clear_zero, .L_clear_zero) lc0 = p2;
190 /* Pass the u-boot arguments to the global value command line */
194 /* Load the current thread pointer and stack */
195 sp.l = _init_thread_union;
196 sp.h = _init_thread_union;
197 p1 = THREAD_SIZE (z);
201 jump.l _start_kernel;