1 /* $NetBSD: s3c2410_vector.S,v 1.1.4.3 2004/09/21 13:14:53 skrll Exp $ */
4 * Copyright (c) 2003 By Noon Software, Inc. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The names of the authors may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * Vector and initialize for S3C2410 based systems.
33 #include <machine/asm.h>
34 #include <arm/armreg.h>
35 #include <arm/s3c2xx0/s3c2410reg.h>
38 #define TEMP_STACK_SIZE (4*1024)
61 * Normally this code lives on ROM and runs immediately after reset, but
62 * it may run on RAM and/or be called after system has been initialized.
66 /* SVC mode, Disable interrupts */
68 orr r0, r0, #(I32_bit|F32_bit|PSR_SVC32_MODE)
71 /* Disable MMU, Disable cache */
72 mrc p15, 0, r10, c1, c0, 0
73 ldr r0, =(CPU_CONTROL_MMU_ENABLE|CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE)
75 mcr p15, 0, r10, c1, c0, 0
80 /* invalidate I-cache */
81 mcr p15, 0, r2, c7, c5, 0
87 orr r10, r10, #CPU_CONTROL_IC_ENABLE
88 mcr p15, 0, r10, c1, c0, 0
94 ldr r0, Lwdt_wtcon_addr
95 mov r1, #WTCON_WDTSTOP
98 /* Disable all interrupts */
99 ldr r0, Lintctl_intmsk_addr
103 ldr r9, =S3C2410_GPIO_BASE
104 /* LEDs on SMDK2410 */
106 str r1, [r9, #GPIO_PFCON]
108 str r1, [r9, #GPIO_PFDAT]
111 cmp r0, #S3C2410_SDRAM_START
114 ldr r8, =S3C2410_CLKMAN_BASE
115 ldr r1, [r8,#CLKMAN_CLKDIVN]
116 orr r1, r1, #CLKDIVN_HDIVN|CLKDIVN_PDIVN
117 str r1, [r8,#CLKMAN_CLKDIVN]
119 ldr r1, Lclkman_locktime_data
120 str r1, [r8,#CLKMAN_LOCKTIME]
123 ldr r1, Lclkman_mpllcon_data
124 str r1, [r8,#CLKMAN_MPLLCON]
125 ldr r1, Lclkman_upllcon_data
126 str r1, [r8,#CLKMAN_UPLLCON]
128 ldr r9, =S3C2410_GPIO_BASE
130 str r1, [r9, #GPIO_PFDAT]
137 /* Change Bus mode to Sync */
138 mrc p15, 0, r0, c1, c0, 0
139 bic r0, r0, #(1<<31) /* unset iA bit */
140 orr r0, r0, #(1<<30) /* set nF bit */
141 mcr p15, 0, r0, c1, c0, 0
146 ldr r9, =S3C2410_GPIO_BASE
148 str r1, [r9, #GPIO_PFDAT]
150 /* set temporary stack */
152 /* do we have a room below? */
153 ldr r1, =(S3C2410_SDRAM_START+TEMP_STACK_SIZE)
155 /* otherwise use top area of RAM */
156 ldrlo sp, =(S3C2410_SDRAM_START+SDRAM_SIZE)
162 ldr r9, =S3C2410_GPIO_BASE
164 str r1, [r9, #GPIO_PFDAT]
169 .word (S3C2410_WDT_BASE + WDT_WTCON)
172 .word (S3C2410_INTCTL_BASE + INTCTL_INTMSK)
176 Lclkman_locktime_data:
179 Lclkman_mpllcon_data:
180 #if XTAL_CLK == 12000000 && FCLK == 180000000
181 .word 0x00052011 /* M=82, P=1, S=1 */
183 #error illegal XTAL_CLK/FCLK combination
185 Lclkman_upllcon_data:
186 .word 0x00078023 /* M=120, P=2, S=3 */