2 * linux/arch/armnommu/mach-s3c24a0/head.S
4 * Taken from mach-s5c7375/head.S
6 * modified by heechul.yun@samsung.com
9 #include <linux/linkage.h>
10 #include <linux/init.h>
12 #include <asm/assembler.h>
13 #include <asm/mach-types.h>
14 #include <asm/procinfo.h>
15 #include <asm/ptrace.h>
16 #include <asm/mach/arch.h>
18 #define MACHINFO_TYPE 0
19 #define MACHINFO_PHYSRAM 4
20 #define MACHINFO_PHYSIO 8
21 #define MACHINFO_PGOFFIO 12
22 #define MACHINFO_NAME 16
25 * Kernel startup entry point.
28 .type stext, #function
31 mov r0, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ make sure svc mode
32 msr cpsr_c, r0 @ and all irqs disabled
35 * ARM920T need MMU enable for D-cache.
36 * we just make the identical table before the MMU enabling.
38 #ifdef CONFIG_CPU_MXU_ENABLE
39 /* Write domain id (cp15_r3) */
40 mvn r0, #0 /* Domains 0, 1 = client */
41 mcr p15, 0, r0, c3, c0, 0 /* load domain access register */
42 /* Set control register v4 */
45 mcr p15, 0, r0, c13, c0, 0 /* zero PID */
46 mcr p15, 0, r0, c7, c7, 0 /* invalidate I,D caches */
47 mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */
48 mcr p15, 0, r0, c8, c7, 0 /* invalidate I,D TLBs */
49 mrc p15, 0, r0, c1, c0, 0 /* get control register */
50 bic r0, r0, #0x0001 /* disable MMU */
51 mcr p15, 0, r0, c1, c0, 0 /* write control register */
56 * We must reserve DRAM_BASE ~ DRAM_BASE+0x8000.
57 * And Kernel TEXTADDR must be after DRAM_BASE + 0x8000
59 #if !defined(CONFIG_DRAM_BASE) || !defined(CONFIG_DRAM_SIZE)
60 #define CONFIG_DRAM_BASE 0x10000000
61 #define CONFIG_DRAM_SIZE 0x04000000
63 ldr r0,=(CONFIG_DRAM_BASE + 0x4000) /* set TTB (Must be on 16KB boundary) */
64 mcr p15, 0, r0, c2, c0, 0 /* write to TTB(CP15,c2) */
68 * Create translation table for flat mapping
69 * Top 12 bits of VA is pointer into table
70 * Create 4096 entries from 000xxxxx to fffxxxxx
72 * Set Section descriptor. 4K entry totla and
73 * each entry describe 1MB.
75 mov r1, #0x1000 @ 4K counter
77 mov r2,#0b110000000000 @ set access permissions (AP) for full access SVC/USR (11:10)
78 orr r2,r2,#0b000111100000 @ set for domain 15 (8:5)
79 orr r2,r2,#0b000000010000 @ must be 1 (4)
80 orr r2,r2,#0b000000000000 @ set non cachable non bufferable (CB) (3:2)
81 orr r2,r2,#0b000000000010 @ set for 1Mb section (1:0)
82 init_ttb_1: /* create 4K entry */
83 orr r3,r2,r1,lsl#20 @ use loop counter to create individual table entries
84 str r3,[r0,r1,lsl#2] @ str r3 at TTB base + loopcount*4
85 subs r1,r1,#1 @ decrement loop counter
88 /* resetting the SDRAM area to cacheable*/
89 /* DRAM_BASE ~ DRAM_BASE+DRAM_SIZE */
90 /* 64MB -> 64 entry -> 0x40 */
91 mov r1, #(CONFIG_DRAM_SIZE >> 20 ) @ 64 entry =ase addr
94 mov r2,#0b110000000000 @ set access permissions (AP) for full access SVC/USR (11:10)
95 orr r2,r2,#0b000111100000 @ set for domain 15 (8:5)
96 orr r2,r2,#0b000000010000 @ must be 1 (4)
97 orr r2,r2,#0b000000001100 @ set cachable but unbufferable (CB) (3:2)
98 orr r2,r2,#0b000000000010 @ set for 1Mb section (1:0)
100 init_ttb_2: /* create 64 entry (for 64MB SDRAM) */
101 add r4, r1, #(CONFIG_DRAM_BASE >> 20 ) @ drambase >> 20 bit .
102 orr r3,r2,r4,lsl#20 @ use loop counter to create individual table entries
103 str r3,[r0,r4,lsl#2] @ str r3 at TTB base + loopcount*4
104 subs r1,r1,#1 @ decrement loop counter
106 @init_domains : we define all domains are manager. so no access permission check is occured.
107 mvn r0, #0 @ trick. 0 -1 == 0xFFFFFFFF
108 mcr p15, 0, r0, c3, c0, 0 @ write to CP15 register 5
110 * set global core configurations
112 mrc p15, 0, r0, c1, c0, 0 @ read CP15 register 1 into r0
114 #ifndef CONFIG_CPU_ICACHE_DISABLE
115 orr r0, r0, #(0x1 <<12) @ enable I Cache
117 #ifndef CONFIG_CPU_DCACHE_DISABLE
118 orr r0, r0, #(0x1 <<2) @ enable D Cache
120 #ifdef CONFIG_ALIGNMENT_TRAP
121 orr r0, r0, #2 @ ...........A.
123 orr r0, r0, #(0b11 <<30) @ enable asynchronous clocking mode
124 orr r0, r0, #0x1 @ enable MMU
126 mcr p15, 0, r0, c1, c0, 0 @ write cp15 register 1
131 * stuffs for cache are done.
132 * Now we setup the stack and machine id, and start the kernel!
136 ldmia r5, {r5, r6, r7, r8, r9, sp} @ Setup stack
138 /* Copy data sections to their new home. */
147 /* Pretend we know what our processor code is (for arm_id) */
149 ldr r2, S3C24A0_PROCESSOR_TYPE
152 ldr r2, S3C24A0_MACH_TYPE
155 str r0, [r7] /* save c1 to cr_alignment */
160 LC0: .long __bss_start @ r5
161 .long processor_id @ r6
162 .long cr_alignment @ r7
164 .long __machine_arch_type @ r9
165 .long init_thread_union+8192 @ sp
167 S3C24A0_PROCESSOR_TYPE:
170 .long MACH_TYPE_S3C24A0
172 #include "../kernel/head-common.S"