Mike Frysinger | 09e1f70 | 2008-08-06 17:15:27 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Common Blackfin startup code |
| 3 | * |
| 4 | * Copyright 2004-2008 Analog Devices Inc. |
| 5 | * |
| 6 | * Enter bugs at http://blackfin.uclinux.org/ |
| 7 | * |
| 8 | * Licensed under the GPL-2 or later. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/linkage.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <asm/blackfin.h> |
| 14 | #include <asm/trace.h> |
| 15 | |
| 16 | /* A little BF561 glue ... */ |
| 17 | #ifndef WDOG_CTL |
| 18 | # define WDOG_CTL WDOGA_CTL |
| 19 | #endif |
| 20 | |
| 21 | __INIT |
| 22 | |
| 23 | ENTRY(_real_start) |
| 24 | /* Enable nested interrupts */ |
| 25 | [--sp] = reti; |
| 26 | |
| 27 | /* watchdog off for now */ |
| 28 | p0.l = lo(WDOG_CTL); |
| 29 | p0.h = hi(WDOG_CTL); |
| 30 | r0 = 0xAD6(z); |
| 31 | w[p0] = r0; |
| 32 | ssync; |
| 33 | |
| 34 | /* Zero out the bss region |
| 35 | * Note: this will fail if bss is 0 bytes ... |
| 36 | */ |
| 37 | r0 = 0 (z); |
| 38 | r1.l = ___bss_start; |
| 39 | r1.h = ___bss_start; |
| 40 | r2.l = ___bss_stop; |
| 41 | r2.h = ___bss_stop; |
| 42 | r2 = r2 - r1; |
| 43 | r2 >>= 2; |
| 44 | p1 = r1; |
| 45 | p2 = r2; |
| 46 | lsetup (.L_clear_bss, .L_clear_bss) lc0 = p2; |
| 47 | .L_clear_bss: |
| 48 | [p1++] = r0; |
| 49 | |
| 50 | /* In case there is a NULL pointer reference, |
| 51 | * zero out region before stext |
| 52 | */ |
| 53 | p1 = r0; |
| 54 | r2.l = __stext; |
| 55 | r2.h = __stext; |
| 56 | r2 >>= 2; |
| 57 | p2 = r2; |
| 58 | lsetup (.L_clear_zero, .L_clear_zero) lc0 = p2; |
| 59 | .L_clear_zero: |
| 60 | [p1++] = r0; |
| 61 | |
| 62 | /* Pass the u-boot arguments to the global value command line */ |
| 63 | R0 = R7; |
| 64 | call _cmdline_init; |
| 65 | |
| 66 | /* Load the current thread pointer and stack */ |
| 67 | sp.l = _init_thread_union; |
| 68 | sp.h = _init_thread_union; |
| 69 | p1 = THREAD_SIZE (z); |
| 70 | sp = sp + p1; |
| 71 | usp = sp; |
| 72 | fp = sp; |
| 73 | jump.l _start_kernel; |
| 74 | ENDPROC(_real_start) |
| 75 | |
| 76 | __FINIT |