1 /* $NetBSD: s3c2800_vector.S,v 1.1.4.3 2004/09/21 13:14:53 skrll Exp $ */
4 * Copyright (c) 2002, 2003 Fujitsu Component Limited
5 * Copyright (c) 2002, 2003 Genetec Corporation
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of The Fujitsu Component Limited nor the name of
17 * Genetec corporation may not be used to endorse or promote products
18 * derived from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY FUJITSU COMPONENT LIMITED AND GENETEC
21 * CORPORATION ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL FUJITSU COMPONENT LIMITED OR GENETEC
25 * CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * Vector and initialize for S3C2800 based systems.
39 #include <machine/asm.h>
40 #include <arm/armreg.h>
41 #include <arm/s3c2xx0/s3c2800reg.h>
43 #ifndef PLLCON_MDIV_VAL
44 /* constans to get 200MHz FCLK */
45 #if XTAL_CLK == 10000000 || XTAL_CLK == 10
46 #define PLLCON_MDIV_VAL 0x5c
47 #define PLLCON_PDIV_VAL 3
48 #define PLLCON_SDIV_VAL 0
49 #elif XTAL_CLK == 8000000 || XTAL_CLK == 8
50 #define PLLCON_MDIV_VAL 0x5c
51 #define PLLCON_PDIV_VAL 2
52 #define PLLCON_SDIV_VAL 0
53 #elif XTAL_CLK == 6000000 || XTAL_CLK == 6
54 #define PLLCON_MDIV_VAL 0x5c
55 #define PLLCON_PDIV_VAL 1
56 #define PLLCON_SDIV_VAL 0
58 #error define XTAL_CLK to 10, 8 or 6MHz
60 #endif /* PLLCON_MDIV_VAL */
63 #define SDRAM_START S3C2800_DBANK0_START
66 #define SDRAM_SIZE 0x01000000 /* 16MB */
69 #define TEMP_STACK_SIZE (4*1024)
93 * Normally this code lives on ROM and runs immediately after reset, but
94 * it may run on RAM and/or be called after system has been initialized.
98 /* SVC mode, Disable interrupts */
100 orr r0, r0, #(I32_bit|F32_bit|PSR_SVC32_MODE)
103 /* Disable MMU, Disable cache */
104 mrc p15, 0, r10, c1, c0, 0
105 ldr r0, =(CPU_CONTROL_MMU_ENABLE|CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE)
107 mcr p15, 0, r10, c1, c0, 0
112 /* invalidate I-cache */
113 mcr p15, 0, r2, c7, c5, 0
119 orr r10, r10, #CPU_CONTROL_IC_ENABLE
120 mcr p15, 0, r10, c1, c0, 0
126 ldr r0, Lwdt_wtcon_addr
127 mov r1, #WTCON_WDTSTOP
130 /* Disable all interrupts */
131 ldr r0, Lintctl_intmsk_addr
136 ldr r9, =S3C2800_GPIO_BASE
137 /* LEDs on SMDK2800 */
139 strh r1, [r9, #GPIO_PCONC]
141 mov r0, #0xdfff /* set PB7 to AHBCLK out */
142 strh r0, [r9,GPIO_PCONB]
152 ldr r8, =S3C2800_CLKMAN_BASE
153 ldr r1, [r8,#CLKMAN_CLKCON]
154 orr r1, r1, #CLKCON_HCLK /* AHB clock = FCLK/2 */
155 str r1, [r8,#CLKMAN_CLKCON]
157 ldr r1, Lclkman_locktime_data
158 str r1, [r8,#CLKMAN_LOCKTIME]
161 ldr r1, Lclkman_pllcon_data
162 str r1, [r8,#CLKMAN_PLLCON]
165 /* Change Bus mode to Sync */
166 mrc p15, 0, r0, c1, c0, 0
167 bic r0, r0, #(1<<31) /* unset iA bit */
168 orr r0, r0, #(1<<30) /* set nF bit */
169 mcr p15, 0, r0, c1, c0, 0
174 /* set temporary stack */
176 /* do we have a room below? */
177 ldr r1, =(SDRAM_START+TEMP_STACK_SIZE)
179 /* otherwise use top area of RAM */
180 ldrlo sp, =(SDRAM_START+SDRAM_SIZE)
185 #ifdef SELFCOPY_TO_FLASH
186 /* Are we running on RAM? */
189 blo 99f /* no, skip */
191 ldr r1, =__rom_size__
198 .word (S3C2800_WDT_BASE + WDT_WTCON)
201 .word (S3C2800_INTCTL_BASE + INTCTL_INTMSK)
205 Lclkman_locktime_data:
209 .word (PLLCON_MDIV_VAL<<PLLCON_MDIV_SHIFT) | \
210 (PLLCON_PDIV_VAL<<PLLCON_PDIV_SHIFT) | \
211 (PLLCON_SDIV_VAL<<PLLCON_SDIV_SHIFT)