90e1b3284c25affa8ed85a0a077799abca6aff1c
[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 #include <boot/arm-missing-opcodes.h>
24
25     .section ".text", #alloc, #execinstr
26 ENTRY(_start)
27     .type _start,#function
28     b       __cpu_early_init
29
30 version:
31     .align 2
32     .asciz VERSION
33     .align 4
34 description:
35     .align 2
36     .asciz DESCRIPTION
37     .align 4
38 release:
39     .align 2
40     .asciz RELEASE
41     .align 4
42 arch:
43     .align 2
44     .asciz IMG_NAME_ARCHITECTURE
45     .align 4
46 build:
47     .align 2
48     .asciz BUILD_STRING
49     .align 4
50
51 ENTRY(__init)
52     mrc     p15,0,r0,c1,c0          @ read control register configuration data
53     bic     r0,r0,#0x0000B000       @ clear bit 10: Should Be Zero
54     bic     r0,r0,#0x00000005       @ bit 2: data cache disabled. bit 0: MMU disable
55     orr     r0,r0,#0x00000002       @ bit 1: strict alignment checks enabled
56     mcr     p15,0,r0,c1,c0          @ write control register configuration
57     bl      SET_SA                  @ sense amp settings
58     bl      __cpu_early_init
59
60     msr     cpsr_c, #(SVC_MODE | PSR_F_BIT | PSR_I_BIT) @ ensure svc mode and IRQs disabled
61     ldr     r0,=0x0050078
62     mcr     p15,0,r0,c1,c0,0      //; WCP15_SCTLR  r2
63     ISB                             @ macro for "isb sy" because compiler may not support opcode
64 // EOF