2 * Memory Setup stuff - taken from blob memsetup.S
4 * Copyright (C) 2009 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com>
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #include <asm/arch/cpu.h>
31 #define UART_CONSOLE_BASE UARTx_OFFSET(0)
32 #elif defined(CONFIG_SERIAL1)
33 #define UART_CONSOLE_BASE UARTx_OFFSET(1)
34 #elif defined(CONFIG_SERIAL2)
35 #define UART_CONSOLE_BASE UARTx_OFFSET(2)
37 #define UART_CONSOLE_BASE UARTx_OFFSET(3)
53 /* Turn on KEY_LED_ON [GPJ4(1)] */
54 ldr r0, =S5PC100_GPIO_BASE(S5PC100_GPIO_J4_OFFSET)
55 ldr r1, [r0, #S5PC1XX_GPIO_CON_OFFSET]
56 bic r1, r1, #(0xf << 4) @ 1 * 4-bit
57 orr r1, r1, #(0x1 << 4)
58 str r1, [r0, #S5PC1XX_GPIO_CON_OFFSET]
60 ldr r1, [r0, #S5PC1XX_GPIO_DAT_OFFSET]
61 #ifdef CONFIG_ONENAND_IPL
62 orr r1, r1, #(1 << 1) @ 1 * 1-bit
66 str r1, [r0, #S5PC1XX_GPIO_DAT_OFFSET]
68 /* IO retension release */
69 ldr r0, =S5P_OTHERS @0xE0108200
71 ldr r2, =(1 << 31) @IO_RET_REL
75 /* Disable Watchdog */
76 ldr r0, =S5P_WATCHDOG_BASE(0x0) @0xEA200000
81 #ifndef CONFIG_ONENAND_IPL
83 ldr r0, =S5P_SROMC_BASE(0x0)
88 /* S5PC100 has 3 groups of interrupt sources */
89 ldr r0, =S5P_VIC0_BASE(0x0) @0xE4000000
90 ldr r1, =S5P_VIC1_BASE(0x0) @0xE4000000
91 ldr r2, =S5P_VIC2_BASE(0x0) @0xE4000000
93 /* Disable all interrupts (VIC0, VIC1 and VIC2) */
95 str r3, [r0, #VIC_INTENCLEAR_OFFSET]
96 str r3, [r1, #VIC_INTENCLEAR_OFFSET]
97 str r3, [r2, #VIC_INTENCLEAR_OFFSET]
99 #ifndef CONFIG_ONENAND_IPL
100 /* Set all interrupts as IRQ */
101 str r5, [r0, #VIC_INTSELECT_OFFSET]
102 str r5, [r1, #VIC_INTSELECT_OFFSET]
103 str r5, [r2, #VIC_INTSELECT_OFFSET]
105 /* Pending Interrupt Clear */
106 str r5, [r0, #VIC_INTADDRESS_OFFSET]
107 str r5, [r1, #VIC_INTADDRESS_OFFSET]
108 str r5, [r2, #VIC_INTADDRESS_OFFSET]
111 #ifndef CONFIG_ONENAND_IPL
119 #ifdef CONFIG_ONENAND_IPL
120 /* init system clock */
125 /* Wakeup support. Don't know if it's going to be used, untested. */
126 ldr r0, =S5P_RST_STAT
128 bic r1, r1, #0xfffffff7
137 #ifdef CONFIG_ONENAND_IPL
140 /* Turn on 7color [GPJ4(2)] at universal */
141 ldr r0, =S5PC100_GPIO_BASE(S5PC100_GPIO_J4_OFFSET)
142 ldr r1, [r0, #S5PC1XX_GPIO_CON_OFFSET]
143 bic r1, r1, #(0xf << 8) @ 2 * 4-bit
144 orr r1, r1, #(0x1 << 8)
145 str r1, [r0, #S5PC1XX_GPIO_CON_OFFSET]
147 ldr r1, [r0, #S5PC1XX_GPIO_DAT_OFFSET]
148 orr r1, r1, #(1 << 2) @ 2 * 1-bit
149 str r1, [r0, #S5PC1XX_GPIO_DAT_OFFSET]
151 /* Clear wakeup status register */
152 ldr r0, =S5P_WAKEUP_STAT
156 /* Load return address and jump to kernel */
159 /* r1 = physical address of s5pc100_cpu_resume function */
162 /* Jump to kernel (sleep-s5pc100.S) */
169 * system_clock_init: Initialize core clock and bus clock.
170 * void system_clock_init(void)
173 ldr r8, =S5P_PA_CLK @ 0xE0100000
176 ldr r1, =0xe10 @ Locktime : 0xe10 = 3600
177 str r1, [r8, #0x000] @ S5P_APLL_LOCK
178 str r1, [r8, #0x004] @ S5P_MPLL_LOCK
179 str r1, [r8, #0x008] @ S5P_EPLL_LOCK
180 str r1, [r8, #0x00C] @ S5P_HPLL_LOCK
183 #ifdef CONFIG_CLK_667_166_83
184 ldr r1, =0x81bc0400 @ SDIV 0, PDIV 4, MDIV 444 (1333MHz)
185 #elif defined(CONFIG_CLK_666_166_66)
186 ldr r1, =0x814d0301 @ SDIV 1, PDIV 3, MDIV 333 (1333MHz)
187 #elif defined(CONFIG_CLK_600_150_75)
188 ldr r1, =0x812C0300 @ SDIV 0, PDIV 3, MDIV 300 (1200MHz)
189 #elif defined(CONFIG_CLK_533_133_66)
190 ldr r1, =0x810b0300 @ SDIV 0, PDIV 3, MDIV 267 (1066MHz)
191 #elif defined(CONFIG_CLK_500_166_66)
192 ldr r1, =0x81f40301 @ SDIV 1, PDIV 3, MDIV 500 (1000MHz)
193 #elif defined(CONFIG_CLK_467_117_59)
194 ldr r1, =0x826E0401 @ SDIV 1, PDIV 4, MDIV 622 (933MHz)
195 #elif defined(CONFIG_CLK_400_100_50)
196 ldr r1, =0x81900301 @ SDIV 1, PDIV 3, MDIV 400 (800MHz)
198 #error you should set the correct clock configuration
202 ldr r1, =0x80590201 @ SDIV 1, PDIV 2, MDIV 89 (267MHz)
205 ldr r1, =0x80870303 @ SDIV 3, PDIV 3, MDIV 135 (67.5MHz)
208 ldr r1, =0x80600603 @ SDIV 3, PDIV 6, MDIV 96
211 /* Set Clock divider */
215 #ifdef CONFIG_CLK_800_166_66
217 #elif defined(CONFIG_CLK_500_166_66)
219 #elif defined(CONFIG_CLK_666_166_66)
233 /* Set Source Clock */
234 ldr r1, =0x1111 @ A, M, E, HPLL Muxing
235 str r1, [r8, #0x200] @ S5P_CLK_SRC0
238 ldr r1, =0x1000001 @ Uart Clock & CLK48M Muxing
239 str r1, [r8, #0x204] @ S5P_CLK_SRC1
241 ldr r1, =0x9000 @ ARMCLK/4
242 str r1, [r8, #0x400] @ S5P_CLK_OUT
245 /* wait at least 200us to stablize all clock */
252 #ifndef CONFIG_ONENAND_IPL
254 * uart_asm_init: Initialize UART's pins
257 /* set GPIO to enable UART0-UART4 */
258 ldr r0, =S5PC100_GPIO_BASE(0)
260 str r1, [r0, #S5PC100_GPIO_A0_OFFSET] @ GPA0_CON
262 str r1, [r0, #S5PC100_GPIO_A1_OFFSET] @ GPA1_CON
264 /* UART_SEL GPK0[5] at S5PC100 */
265 ldr r0, =S5PC100_GPIO_BASE(S5PC100_GPIO_K0_OFFSET)
266 ldr r1, [r0, #S5PC1XX_GPIO_CON_OFFSET]
267 bic r1, r1, #(0xf << 20) @ 20 = 5 * 4-bit
268 orr r1, r1, #(0x1 << 20)
269 str r1, [r0, #S5PC1XX_GPIO_CON_OFFSET]
271 ldr r1, [r0, #S5PC1XX_GPIO_PULL_OFFSET]
272 bic r1, r1, #(0x3 << 10) @ 10 = 5 * 2-bit
273 orr r1, r1, #(0x2 << 10) @ Enables Pull-up
274 str r1, [r0, #S5PC1XX_GPIO_PULL_OFFSET]
276 ldr r1, [r0, #S5PC1XX_GPIO_DAT_OFFSET]
277 orr r1, r1, #(1 << 5) @ 5 = 1 * 1-bit
278 str r1, [r0, #S5PC1XX_GPIO_DAT_OFFSET]
283 * dma_asm_init: Initialize DMA