# BRCM_VERSION=3
[bcm963xx.git] / kernel / linux / arch / arm26 / machine / head.S
1 /*
2  *  linux/arch/arm/kernel/head-armo.S
3  *
4  *  Copyright (C) 1994-2000 Russell King
5  *  Copyright (C) 2003 Ian Molton
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  *
11  *  26-bit kernel startup code
12  */
13 #include <linux/config.h>
14 #include <linux/linkage.h>
15 #include <asm/mach-types.h>
16
17                 .globl  swapper_pg_dir
18                 .equ    swapper_pg_dir, 0x0207d000
19
20 /*
21  * Entry point.
22  */
23                 .section ".init.text",#alloc,#execinstr
24 ENTRY(stext)
25 __entry:        cmp     pc, #0x02000000
26                 ldrlt   pc, LC0                 @ if 0x01800000, call at 0x02080000
27                 teq     r0, #0                  @ Check for old calling method
28                 blne    oldparams               @ Move page if old
29                 adr     r0, LC0
30                 ldmib   r0, {r2-r5, sp}         @ Setup stack (and fetch other values)
31
32                 mov     r0, #0                  @ Clear BSS
33 1:              cmp     r2, r3
34                 strcc   r0, [r2], #4
35                 bcc     1b
36
37                 bl      detect_proc_type
38                 str     r0, [r4]
39                 bl      detect_arch_type
40                 str     r0, [r5]
41
42 #ifdef CONFIG_XIP_KERNEL
43                ldr     r3, ETEXT                       @ data section copy
44                ldr     r4, SDATA
45                ldr     r5, EDATA
46 1:
47                ldr     r6, [r3], #4
48                str     r6, [r4], #4
49                cmp     r4, r5
50                blt     1b
51 #endif
52
53                 mov     fp, #0
54                 b       start_kernel
55
56 LC0:            .word   _stext
57                 .word   __bss_start             @ r2
58                 .word   _end                    @ r3
59                 .word   processor_id            @ r4
60                 .word   __machine_arch_type     @ r5
61                 .word   init_thread_union+8192  @ sp
62 #ifdef CONFIG_XIP_KERNEL
63 ETEXT:          .word   _endtext
64 SDATA:          .word   _sdata
65 EDATA:          .word   __bss_start
66 #endif
67
68 arm2_id:        .long   0x41560200  @ ARM2 and 250 dont have a CPUID
69 arm250_id:      .long   0x41560250  @ So we create some after probing for them
70                 .align
71
72 oldparams:      mov     r4, #0x02000000
73                 add     r3, r4, #0x00080000
74                 add     r4, r4, #0x0007c000
75 1:              ldmia   r0!, {r5 - r12}
76                 stmia   r4!, {r5 - r12}
77                 cmp     r4, r3
78                 blt     1b
79                 mov     pc, lr
80
81 /*
82  * We need some way to automatically detect the difference between
83  * these two machines.  Unfortunately, it is not possible to detect
84  * the presence of the SuperIO chip, because that will hang the old
85  * Archimedes machines solid.
86  */
87 /* DAG: Outdated, these have been combined !!!!!!! */
88 detect_arch_type:
89 #if defined(CONFIG_ARCH_ARC)
90                 mov     r0, #MACH_TYPE_ARCHIMEDES
91 #elif defined(CONFIG_ARCH_A5K)
92                 mov     r0, #MACH_TYPE_A5K
93 #endif
94                 mov     pc, lr
95
96 detect_proc_type:
97                 mov     ip, lr
98                 mov     r2, #0xea000000         @ Point undef instr to continuation
99                 adr     r0, continue - 12
100                 orr     r0, r2, r0, lsr #2
101                 mov     r1, #0
102                 str     r0, [r1, #4]
103                 ldr     r0, arm2_id
104                 swp     r2, r2, [r1]            @ check for swp (ARM2 cant)
105                 ldr     r0, arm250_id
106                 mrc     15, 0, r3, c0, c0       @ check for CP#15 (ARM250 cant)
107                 mov     r0, r3
108 continue:       mov     r2, #0xeb000000         @ Make undef vector loop
109                 sub     r2, r2, #2
110                 str     r2, [r1, #4]
111                 mov     pc, ip