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