xref: /openbmc/u-boot/board/samsung/smdkc100/lowlevel_init.S (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini/* SPDX-License-Identifier: GPL-2.0+ */
28bc4ee9eSMinkyu Kang/*
38bc4ee9eSMinkyu Kang * Copyright (C) 2009 Samsung Electronics
48bc4ee9eSMinkyu Kang * Kyungmin Park <kyungmin.park@samsung.com>
58bc4ee9eSMinkyu Kang * Minkyu Kang <mk7.kang@samsung.com>
68bc4ee9eSMinkyu Kang */
78bc4ee9eSMinkyu Kang
88bc4ee9eSMinkyu Kang#include <config.h>
98bc4ee9eSMinkyu Kang#include <asm/arch/cpu.h>
108bc4ee9eSMinkyu Kang#include <asm/arch/power.h>
118bc4ee9eSMinkyu Kang
128bc4ee9eSMinkyu Kang/*
138bc4ee9eSMinkyu Kang * Register usages:
148bc4ee9eSMinkyu Kang *
158bc4ee9eSMinkyu Kang * r5 has zero always
168bc4ee9eSMinkyu Kang */
178bc4ee9eSMinkyu Kang
188bc4ee9eSMinkyu Kang	.globl lowlevel_init
198bc4ee9eSMinkyu Kanglowlevel_init:
208bc4ee9eSMinkyu Kang	mov	r9, lr
218bc4ee9eSMinkyu Kang
228bc4ee9eSMinkyu Kang	/* r5 has always zero */
238bc4ee9eSMinkyu Kang	mov	r5, #0
248bc4ee9eSMinkyu Kang
258bc4ee9eSMinkyu Kang	ldr	r8, =S5PC100_GPIO_BASE
268bc4ee9eSMinkyu Kang
278bc4ee9eSMinkyu Kang	/* Disable Watchdog */
288bc4ee9eSMinkyu Kang	ldr	r0, =S5PC100_WATCHDOG_BASE		@0xEA200000
298bc4ee9eSMinkyu Kang	orr	r0, r0, #0x0
308bc4ee9eSMinkyu Kang	str	r5, [r0]
318bc4ee9eSMinkyu Kang
328bc4ee9eSMinkyu Kang	/* setting SRAM */
338bc4ee9eSMinkyu Kang	ldr	r0, =S5PC100_SROMC_BASE
348bc4ee9eSMinkyu Kang	ldr	r1, =0x9
358bc4ee9eSMinkyu Kang	str	r1, [r0]
368bc4ee9eSMinkyu Kang
378bc4ee9eSMinkyu Kang	/* S5PC100 has 3 groups of interrupt sources */
388bc4ee9eSMinkyu Kang	ldr	r0, =S5PC100_VIC0_BASE			@0xE4000000
398bc4ee9eSMinkyu Kang	ldr	r1, =S5PC100_VIC1_BASE			@0xE4000000
408bc4ee9eSMinkyu Kang	ldr	r2, =S5PC100_VIC2_BASE			@0xE4000000
418bc4ee9eSMinkyu Kang
428bc4ee9eSMinkyu Kang	/* Disable all interrupts (VIC0, VIC1 and VIC2) */
438bc4ee9eSMinkyu Kang	mvn	r3, #0x0
448bc4ee9eSMinkyu Kang	str	r3, [r0, #0x14]				@INTENCLEAR
458bc4ee9eSMinkyu Kang	str	r3, [r1, #0x14]				@INTENCLEAR
468bc4ee9eSMinkyu Kang	str	r3, [r2, #0x14]				@INTENCLEAR
478bc4ee9eSMinkyu Kang
488bc4ee9eSMinkyu Kang	/* Set all interrupts as IRQ */
498bc4ee9eSMinkyu Kang	str	r5, [r0, #0xc]				@INTSELECT
508bc4ee9eSMinkyu Kang	str	r5, [r1, #0xc]				@INTSELECT
518bc4ee9eSMinkyu Kang	str	r5, [r2, #0xc]				@INTSELECT
528bc4ee9eSMinkyu Kang
538bc4ee9eSMinkyu Kang	/* Pending Interrupt Clear */
548bc4ee9eSMinkyu Kang	str	r5, [r0, #0xf00]			@INTADDRESS
558bc4ee9eSMinkyu Kang	str	r5, [r1, #0xf00]			@INTADDRESS
568bc4ee9eSMinkyu Kang	str	r5, [r2, #0xf00]			@INTADDRESS
578bc4ee9eSMinkyu Kang
588bc4ee9eSMinkyu Kang	/* for UART */
598bc4ee9eSMinkyu Kang	bl uart_asm_init
608bc4ee9eSMinkyu Kang
618bc4ee9eSMinkyu Kang	/* for TZPC */
628bc4ee9eSMinkyu Kang	bl tzpc_asm_init
638bc4ee9eSMinkyu Kang
648bc4ee9eSMinkyu Kang1:
658bc4ee9eSMinkyu Kang	mov	lr, r9
668bc4ee9eSMinkyu Kang	mov	pc, lr
678bc4ee9eSMinkyu Kang
688bc4ee9eSMinkyu Kang/*
698bc4ee9eSMinkyu Kang * system_clock_init: Initialize core clock and bus clock.
708bc4ee9eSMinkyu Kang * void system_clock_init(void)
718bc4ee9eSMinkyu Kang */
728bc4ee9eSMinkyu Kangsystem_clock_init:
73d93d0f0cSMinkyu Kang	ldr	r8, =S5PC100_CLOCK_BASE		@ 0xE0100000
748bc4ee9eSMinkyu Kang
758bc4ee9eSMinkyu Kang	/* Set Clock divider */
768bc4ee9eSMinkyu Kang	ldr	r1, =0x00011110
778bc4ee9eSMinkyu Kang	str	r1, [r8, #0x304]
788bc4ee9eSMinkyu Kang	ldr	r1, =0x1
798bc4ee9eSMinkyu Kang	str	r1, [r8, #0x308]
808bc4ee9eSMinkyu Kang	ldr	r1, =0x00011301
818bc4ee9eSMinkyu Kang	str	r1, [r8, #0x300]
828bc4ee9eSMinkyu Kang
838bc4ee9eSMinkyu Kang	/* Set Lock Time */
848bc4ee9eSMinkyu Kang	ldr	r1, =0xe10			@ Locktime : 0xe10 = 3600
858bc4ee9eSMinkyu Kang	str	r1, [r8, #0x000]		@ APLL_LOCK
868bc4ee9eSMinkyu Kang	str	r1, [r8, #0x004]		@ MPLL_LOCK
878bc4ee9eSMinkyu Kang	str	r1, [r8, #0x008]		@ EPLL_LOCK
888bc4ee9eSMinkyu Kang	str	r1, [r8, #0x00C]		@ HPLL_LOCK
898bc4ee9eSMinkyu Kang
908bc4ee9eSMinkyu Kang	/* APLL_CON */
918bc4ee9eSMinkyu Kang	ldr	r1, =0x81bc0400		@ SDIV 0, PDIV 4, MDIV 444 (1332MHz)
928bc4ee9eSMinkyu Kang	str	r1, [r8, #0x100]
938bc4ee9eSMinkyu Kang	/* MPLL_CON */
948bc4ee9eSMinkyu Kang	ldr	r1, =0x80590201		@ SDIV 1, PDIV 2, MDIV 89 (267MHz)
958bc4ee9eSMinkyu Kang	str	r1, [r8, #0x104]
968bc4ee9eSMinkyu Kang	/* EPLL_CON */
978bc4ee9eSMinkyu Kang	ldr	r1, =0x80870303		@ SDIV 3, PDIV 3, MDIV 135 (67.5MHz)
988bc4ee9eSMinkyu Kang	str	r1, [r8, #0x108]
998bc4ee9eSMinkyu Kang	/* HPLL_CON */
1008bc4ee9eSMinkyu Kang	ldr	r1, =0x80600603
1018bc4ee9eSMinkyu Kang	str	r1, [r8, #0x10C]
1028bc4ee9eSMinkyu Kang
1038bc4ee9eSMinkyu Kang	/* Set Source Clock */
1048bc4ee9eSMinkyu Kang	ldr	r1, =0x1111			@ A, M, E, HPLL Muxing
1058bc4ee9eSMinkyu Kang	str	r1, [r8, #0x200]		@ CLK_SRC0
1068bc4ee9eSMinkyu Kang
1078bc4ee9eSMinkyu Kang	ldr	r1, =0x1000001			@ Uart Clock & CLK48M Muxing
1088bc4ee9eSMinkyu Kang	str	r1, [r8, #0x204]		@ CLK_SRC1
1098bc4ee9eSMinkyu Kang
1108bc4ee9eSMinkyu Kang	ldr	r1, =0x9000			@ ARMCLK/4
1118bc4ee9eSMinkyu Kang	str	r1, [r8, #0x400]		@ CLK_OUT
1128bc4ee9eSMinkyu Kang
1138bc4ee9eSMinkyu Kang	/* wait at least 200us to stablize all clock */
1148bc4ee9eSMinkyu Kang	mov	r2, #0x10000
1158bc4ee9eSMinkyu Kang1:	subs	r2, r2, #1
1168bc4ee9eSMinkyu Kang	bne	1b
1178bc4ee9eSMinkyu Kang
1188bc4ee9eSMinkyu Kang	mov	pc, lr
1198bc4ee9eSMinkyu Kang
1208bc4ee9eSMinkyu Kang/*
1218bc4ee9eSMinkyu Kang * uart_asm_init: Initialize UART's pins
1228bc4ee9eSMinkyu Kang */
1238bc4ee9eSMinkyu Kanguart_asm_init:
1248bc4ee9eSMinkyu Kang	mov	r0, r8
1258bc4ee9eSMinkyu Kang	ldr	r1, =0x22222222
1268bc4ee9eSMinkyu Kang	str	r1, [r0, #0x0]			@ GPA0_CON
1278bc4ee9eSMinkyu Kang	ldr	r1, =0x00022222
1288bc4ee9eSMinkyu Kang	str	r1, [r0, #0x20]			@ GPA1_CON
1298bc4ee9eSMinkyu Kang
1308bc4ee9eSMinkyu Kang	mov	pc, lr
1318bc4ee9eSMinkyu Kang
1328bc4ee9eSMinkyu Kang/*
1338bc4ee9eSMinkyu Kang * tzpc_asm_init: Initialize TZPC
1348bc4ee9eSMinkyu Kang */
1358bc4ee9eSMinkyu Kangtzpc_asm_init:
1368bc4ee9eSMinkyu Kang	ldr	r0, =0xE3800000
1378bc4ee9eSMinkyu Kang	mov	r1, #0x0
1388bc4ee9eSMinkyu Kang	str	r1, [r0]
1398bc4ee9eSMinkyu Kang	mov	r1, #0xff
1408bc4ee9eSMinkyu Kang	str	r1, [r0, #0x804]
1418bc4ee9eSMinkyu Kang	str	r1, [r0, #0x810]
1428bc4ee9eSMinkyu Kang
1438bc4ee9eSMinkyu Kang	ldr	r0, =0xE2800000
1448bc4ee9eSMinkyu Kang	str	r1, [r0, #0x804]
1458bc4ee9eSMinkyu Kang	str	r1, [r0, #0x810]
1468bc4ee9eSMinkyu Kang	str	r1, [r0, #0x81C]
1478bc4ee9eSMinkyu Kang
1488bc4ee9eSMinkyu Kang	ldr	r0, =0xE2900000
1498bc4ee9eSMinkyu Kang	str	r1, [r0, #0x804]
1508bc4ee9eSMinkyu Kang	str	r1, [r0, #0x810]
1518bc4ee9eSMinkyu Kang
1528bc4ee9eSMinkyu Kang	mov	pc, lr
153