2 * Lowlevel setup for MIDAS board based on EXYNOS4
4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * Sanghee Kim <sh0130.kim@samsung.com>
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 #include <asm/arch/cpu.h>
30 #include <asm/arch/clock.h>
31 #include <asm/arch/power.h>
37 * r7 has GPIO part1 base 0x11400000
38 * r6 has GPIO part2 base 0x11000000
45 /* r5 has always zero */
48 ldr r7, =EXYNOS4_GPIO_PART1_BASE
49 ldr r6, =EXYNOS4_GPIO_PART2_BASE
52 ldr r0, =EXYNOS4_MCT_BASE
56 /* Workaround: PMIC manual reset */
57 /* nPOWER: XEINT_23: GPX2[7] */
58 add r0, r6, #0xC40 @ EXYNOS4_GPIO_X2_OFFSET
60 bic r1, r1, #(0xf << 28) @ 28 = 7 * 4-bit
61 orr r1, r1, #(0x1 << 28) @ Output
65 orr r1, r1, #(1 << 7) @ 7 = 7 * 1-bit
68 /* init system clock */
71 /* Disable Watchdog */
72 ldr r0, =EXYNOS4_WDT_BASE @0x10060000
91 * uart_asm_init: Initialize UART's pins
95 * setup UART0-UART4 GPIOs (part1)
96 * GPA1CON[3] = I2C_3_SCL (3)
97 * GPA1CON[2] = I2C_3_SDA (3)
101 str r1, [r0, #0x00] @ EXYNOS4_GPIO_A0_OFFSET
103 str r1, [r0, #0x20] @ EXYNOS4_GPIO_A1_OFFSET
105 /* UART_SEL GPY4[7] (part2) */
106 add r0, r6, #0x1A0 @ EXYNOS4_GPIO_Y4_OFFSET
108 bic r1, r1, #(0xf << 28) @ 28 = 7 * 4-bit
109 orr r1, r1, #(0x1 << 28)
113 bic r1, r1, #(0x3 << 14) @ 14 = 7 * 2-bit
114 orr r1, r1, #(0x3 << 14) @ Pull-up enabled
118 orr r1, r1, #(1 << 7) @ 7 = 7 * 1-bit
122 ldr r0, =EXYNOS4_UART_BASE
123 orr r0, r0, #0x20000 @ UART2
125 str r1, [r0, #0x000] @ ULCON
127 str r1, [r0, #0x004] @ UCON
129 str r1, [r0, #0x028] @ UBRDIV
131 str r1, [r0, #0x02C] @ UFRACVAL
134 strb r2, [r0, #0x020] @ UTXH
136 ldrb r3, [r0, #0x010] @ UTRSTAT
148 ldr r0, =EXYNOS4_CLOCK_BASE
150 /* CMU_CPU MUX / DIV */
152 ldr r2, =0x14200 @ CLK_SRC_CPU
159 /* CMU_DMC MUX / DIV */
161 ldr r2, =0x10200 @ CLK_SRC_DMC
168 ldr r2, =0x10500 @ CLK_DIV_DMC0
171 ldr r2, =0x10504 @ CLK_DIV_DMC1
174 /* CMU_TOP MUX / DIV */
176 ldr r2, =0x0C210 @ CLK_SRC_TOP0
179 ldr r2, =0x0C214 @ CLK_SRC_TOP1
186 ldr r2, =0x0C510 @ CLK_DIV_TOP
189 /* CMU_LEFTBUS MUX / DIV */
191 ldr r2, =0x04200 @ CLK_SRC_LEFTBUS
198 ldr r2, =0x04500 @ CLK_DIV_LEFTBUS
201 /* CMU_RIGHTBUS MUX / DIV */
203 ldr r2, =0x08200 @ CLK_SRC_RIGHTBUS
210 ldr r2, =0x08500 @ CLK_DIV_RIGHTBUS
214 ldr r1, =0x000f000f /* 800(MPLL) / (15 + 1) */
215 ldr r2, =0x0C544 @ CLK_DIV_FSYS1
217 /* wait for CLK_DIV_STAT_FSYS1 */
219 ldr r3, =0x01010101 /* On changing bits */
226 ldr r1, =0x000f000f /* 800(MPLL) / (15 + 1) */
227 ldr r2, =0x0C548 @ CLK_DIV_FSYS2
229 /* wait for CLK_DIV_STAT_FSYS2 */
231 ldr r3, =0x01010101 /* On changing bits */
238 ldr r1, =0x0003 /* 800(MPLL) / (3 + 1) */
239 ldr r2, =0x0C54C @ CLK_DIV_FSYS3
241 /* wait for CLK_DIV_STAT_FSYS3 */
243 ldr r3, =0x00000101 /* On changing bits */
251 ldr r2, =0x0C550 @ CLK_DIV_PERIL0
253 /* wait for CLK_DIV_STAT_PERIL0 */
255 ldr r3, =0x00111111 /* On changing bits */
261 /* Set PLL locktime */
263 ldr r2, =0x14000 @ APLL_LOCK
266 ldr r2, =0x14008 @ MPLL_LOCK
269 ldr r2, =0x0C010 @ EPLL_LOCK
272 ldr r2, =0x0C020 @ VPLL_LOCK
275 /* FIXME: check this */
276 /* SATA: SCLKMPLL(0), MMC[0:4]: SCLKMPLL(6) */
278 ldr r2, =0x0C240 @ CLK_SRC_FSYS
280 /* UART[0:5], PWM: SCLKMPLL(6) */
282 ldr r2, =0x0C250 @ CLK_SRC_PERIL0_OFFSET
290 #ifdef CONFIG_CLK_ARM_800
292 ldr r2, =0x14500 @ CLK_DIV_CPU0
295 ldr r2, =0x14504 @ CLK_DIV_CPU1
299 ldr r2, =0x14104 @ APLL_CON1
301 ldr r1, =0x80640300 @ 100:3:0
302 ldr r2, =0x14100 @ APLL_CON0
305 #ifdef CONFIG_CLK_ARM_1000
307 ldr r2, =0x14500 @ CLK_DIV_CPU0
310 ldr r2, =0x14504 @ CLK_DIV_CPU1
314 ldr r2, =0x14104 @ APLL_CON1
316 ldr r1, =0x807D0300 @ 125:3:0
317 ldr r2, =0x14100 @ APLL_CON0
320 #ifdef CONFIG_CLK_ARM_1200
322 ldr r2, =0x14500 @ CLK_DIV_CPU0
325 ldr r2, =0x14504 @ CLK_DIV_CPU1
329 ldr r2, =0x14104 @ APLL_CON1
331 ldr r1, =0x80960300 @ 150:3:0
332 ldr r2, =0x14100 @ APLL_CON0
336 /* check C2C_CTRL enable bit */
337 ldr r3, =EXYNOS4_POWER_BASE
343 #ifdef CONFIG_CLK_BUS_DMC_165_330
346 ldr r2, =0x1010C @ MPLL_CON1
348 ldr r1, =0x81160501 @ 667MHz (278:5:1)
349 ldr r2, =0x10108 @ MPLL_CON0
352 #ifdef CONFIG_CLK_BUS_DMC_200_400
355 ldr r2, =0x1010C @ MPLL_CON1
357 ldr r1, =0x80640300 @ 800MHz (100:3:0)
358 ldr r2, =0x10108 @ MPLL_CON0
365 ldr r2, =0x0C118 @ EPLL_CON2
368 ldr r2, =0x0C114 @ EPLL_CON1
370 ldr r1, =0x80400203 @ 96MHz (64:2:3)
371 ldr r2, =0x0C110 @ EPLL_CON0
376 ldr r2, =0x0C128 @ VPLL_CON2
379 ldr r2, =0x0C124 @ VPLL_CON1
381 ldr r1, =0x80480203 @ 108MHz (72:2:3)
382 ldr r2, =0x0C120 @ VPLL_CON0
391 ldr r2, =0x14200 @ CLK_SRC_CPU
395 ldr r2, =0x10200 @ CLK_SRC_DMC
399 ldr r2, =0x0C210 @ CLK_SRC_TOP0
402 ldr r2, =0x0C214 @ CLK_SRC_TOP1
412 * SMMUJPEG[11], JPEG[6], CSIS1[5] : 0111 1001
416 ldr r2, =0x0C920 @ CLK_GATE_IP_CAM
421 ldr r2, =0x0C924 @ CLK_GATE_IP_VP
426 ldr r2, =0x0C928 @ CLK_GATE_IP_MFC
431 ldr r2, =0x0C92C @ CLK_GATE_IP_G3D
436 ldr r2, =0x0C930 @ CLK_GATE_IP_IMAGE
439 /* DSIM0[3], MDNIE0[2], MIE0[1] : 0001 */
441 ldr r2, =0x0C934 @ CLK_GATE_IP_LCD0
446 ldr r2, =0x0C938 @ CLK_GATE_IP_LCD1
450 * SMMUPCIE[18], NFCON[16] : 1111 1010
451 * ONENAND[15], PCIE[14], SATA[10], SDMMC43[9:8]: 0011 1000
452 * SDMMC1[6], TSI[4], SATAPHY[3], PCIEPHY[2] : 1010 0011
455 ldr r2, =0x0C940 @ CLK_GATE_IP_FSYS
460 ldr r2, =0x0C94C @ CLK_GATE_IP_GPS
464 * AC97[27], SPDIF[26], SLIMBUS[25] : 1111 0001
465 * I2C2[8] : 1111 1110
468 ldr r2, =0x0C950 @ CLK_GATE_IP_PERIL
472 * KEYIF[16] : 1111 1110
475 ldr r2, =0x0C960 @ CLK_GATE_IP_PERIR
478 /* GPS[7], LCD1[5], G3D[3], MFC[2], TV[1] : 0101 0001 */
480 ldr r2, =0x0C970 @ CLK_GATE_BLOCK
489 ldr r0, =EXYNOS4_POWER_BASE @ 0x10020000
491 ldr r2, =0x330C @ PS_HOLD_CONTROL
493 orr r1, r1, #(0x3 << 8) @ Data High, Output En
506 str r1, [r0, #0x0804]
507 str r1, [r0, #0x0810]
508 str r1, [r0, #0x081C]
509 str r1, [r0, #0x0828]
512 str r1, [r0, #0x0804]
513 str r1, [r0, #0x0810]
514 str r1, [r0, #0x081C]
515 str r1, [r0, #0x0828]
518 str r1, [r0, #0x0804]
519 str r1, [r0, #0x0810]
520 str r1, [r0, #0x081C]
521 str r1, [r0, #0x0828]
524 str r1, [r0, #0x0804]
525 str r1, [r0, #0x0810]
526 str r1, [r0, #0x081C]
527 str r1, [r0, #0x0828]
530 str r1, [r0, #0x0804]
531 str r1, [r0, #0x0810]
532 str r1, [r0, #0x081C]
533 str r1, [r0, #0x0828]