change source file mode to 0644 instead of 0755
[profile/mobile/platform/kernel/u-boot-tm1.git] / nand_fdl / fdl-2 / src / init.S
1 /*
2  *  armboot - Startup Code for ARM926EJS CPU-core
3  *
4  *  Copyright (c) 2003  Texas Instruments
5  *
6  *  ----- Adapted for OMAP1610 OMAP730 from ARM925t code ------
7  *
8  *  Copyright (c) 2001  Marius Gröger <mag@sysgo.de>
9  *  Copyright (c) 2002  Alex Züpke <azu@sysgo.de>
10  *  Copyright (c) 2002  Gary Jennejohn <garyj@denx.de>
11  *  Copyright (c) 2003  Richard Woodruff <r-woodruff2@ti.com>
12  *  Copyright (c) 2003  Kshitij <kshitij@ti.com>
13  *
14  * See file CREDITS for list of people who contributed to this
15  * project.
16  *
17  * This program is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU General Public License as
19  * published by the Free Software Foundation; either version 2 of
20  * the License, or (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30  * MA 02111-1307 USA
31  */
32
33
34 #include <config.h>
35 #include <common.h>
36 #include <version.h>
37
38 #if defined CONFIG_SC8825 || defined CONFIG_SC8830 || defined(CONFIG_SC9630)
39 #define FDL2_STACK      0x81000000
40 #endif
41 #ifdef PLATFORM_SC8800G
42 #define BIGEND_PROT_REG 0x20900290
43 #define AHB_CTRL5_REG   0x20900230
44 #define FDL2_STACK      0x31000000
45 #endif
46 #ifdef CONFIG_SC8810
47 #define BIGEND_PROT_REG 0x20900290
48 #define AHB_CTRL5_REG   0x20900230
49 #define FDL2_STACK      0x1000000
50 #endif
51
52 /*
53  *************************************************************************
54  *
55  * Jump vector table as in table 3.1 in [1]
56  *
57  *************************************************************************
58  */
59
60
61 .globl _start
62 _start:
63         b       reset
64 /*
65  *************************************************************************
66  *
67  * Startup Code (reset vector)
68  *
69  * do important init only if we don't start from memory!
70  * setup Memory and board specific bits prior to relocation.
71  * relocate armboot to ram
72  * setup stack
73  *
74  *************************************************************************
75  */
76
77 /*
78  * These are defined in the board-specific linker script.
79  */
80 .globl _bss_start
81 _bss_start:
82         .word __bss_start
83
84 .globl _bss_end
85 _bss_end:
86         .word _end
87
88 .global _armboot_start
89 _armboot_start:
90         .word _start
91
92 /*
93  * the actual reset code
94  */
95
96 reset:
97         /*
98          * set the cpu to SVC32 mode
99          */
100 #if 0
101         ldr     r0, =0xffffff
102 time:   subs    r0,r0,#0x1
103         bne     time
104 #endif
105
106         mrs     r0,cpsr
107         bic     r0,r0,#0x1f
108         orr     r0,r0,#0xd3
109         msr     cpsr,r0
110
111         MRC p15,0,r0,c1,c0,0
112 #ifdef CHIP_ENDIAN_BIG
113         ORR r0,r0,#0x80
114 #else
115         BIC r0,r0,#0x80
116 #endif
117
118         BIC r0,r0,#1    /*disable MMU*/
119         LDR r1,=0x1004
120         BIC r0,r0,r1    /*disable cache*/
121         /*LDR r1,=0x1000*/  /* use mmu.c and mmu_asm.S, so richard feng remove it */
122         /*ORR r0,r0,r1*/    /* use mmu.c and mmu_asm.S, so richard feng remove it */
123
124         MCR p15,0,r0,c1,c0,0
125
126         /*set endian regs of sc8800g*/
127 #if defined(CHIP_ENDIAN_BIG) && (defined(PLATFORM_SC8800G) || defined(CONFIG_SC8810))
128         LDR     R0, =BIGEND_PROT_REG
129         MOV     R2, #0xD4
130         ORR     R2, R2, #0xC300
131         STR     R2,[R0]
132
133         LDR     R2, =AHB_CTRL5_REG
134         MOV     R1, #0xff
135         ORR     R1, R1, #0x300
136
137         STR     R1, [R2]
138         MOV     R1, #0
139         STR     R1, [R0]
140 #endif
141
142 #if defined(CONFIG_SC8830) || defined(CONFIG_SC9630)
143         /*
144          * Enable coherent requested to the processor.
145         */
146         mrc     p15, 0, r0, c1, c0, 1
147         orr r0, r0,#(0x1<<6)
148         mcr p15, 0, r0, c1, c0, 1 @write aux control register
149 #endif
150         /*set stack limit to 0*/
151         MOV R10, #0
152         ldr sp, =FDL2_STACK     
153 clear_bss:
154         ldr     r0, _bss_start          /* find start of bss segment        */
155         ldr     r1, _bss_end            /* stop here                        */
156         mov     r2, #0x00000000         /* clear                            */
157
158 clbss_l:str     r2, [r0]                /* clear loop...                    */
159         add     r0, r0, #4
160         cmp     r0, r1
161         ble     clbss_l
162
163
164         b main