1fe24ce853c33e41ec994f77ea449cac5620af5d
[bootloader-ap.git] / arch / arm-head.S
1 /*
2   Initialise the Applications Processor
3   Copyright (c) 2010 TJ <linux@tjworld.net>
4
5     This program is free software: you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation, either version 3 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program (See the COPYRIGHT file the base directory).
17     If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <boot/linkage.h>
21 #include <boot/version.h>
22 #include <boot/arm.h>
23
24     .section ".text", #alloc, #execinstr
25 ENTRY(_start)
26     .type _start,#function
27     b       __cpu_early_init
28
29 version:
30     .align 2
31     .asciz VERSION
32     .align 4
33 description:
34     .align 2
35     .asciz DESCRIPTION
36     .align 4
37 release:
38     .align 2
39     .asciz RELEASE
40     .align 4
41 arch:
42     .align 2
43     .asciz IMG_NAME_ARCHITECTURE
44     .align 4
45 build:
46     .align 2
47     .asciz BUILD_STRING
48     .align 4
49
50 ENTRY(__init)
51     mrc     p15,0,r0,c1,c0          @ read control register configuration data
52     bic     r0,r0,#0x0000B000       @ clear bit 10: Should Be Zero
53     bic     r0,r0,#0x00000005       @ bit 2: data cache disabled. bit 0: MMU disable
54     orr     r0,r0,#0x00000002       @ bit 1: strict alignment checks enabled
55     mcr     p15,0,r0,c1,c0          @ write control register configuration
56     bl      SET_SA                  @ sense amp settings
57     bl      __cpu_early_init
58
59     msr     cpsr_c, #(USR_MODE | PSR_F_BIT | PSR_I_BIT | SVC26_MODE)
60     ldr     r0,=0x0050078
61     mcr     p15,0,r0,c1,c0,0      //; WCP15_SCTLR  r2
62     ISB                             @ macro for "isb sy" because compiler may not support opcode
63 // EOF