smdk2410_ram_init.S revision 1.2 1 1.2 christos /* $NetBSD: smdk2410_ram_init.S,v 1.2 2005/12/11 12:17:09 christos Exp $ */
2 1.1 mycroft
3 1.1 mycroft /*
4 1.1 mycroft * Copyright (c) 2003 By Noon Software, Inc. All rights reserved.
5 1.1 mycroft *
6 1.1 mycroft * Redistribution and use in source and binary forms, with or without
7 1.1 mycroft * modification, are permitted provided that the following conditions
8 1.1 mycroft * are met:
9 1.1 mycroft * 1. Redistributions of source code must retain the above copyright
10 1.1 mycroft * notice, this list of conditions and the following disclaimer.
11 1.1 mycroft * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 mycroft * notice, this list of conditions and the following disclaimer in the
13 1.1 mycroft * documentation and/or other materials provided with the distribution.
14 1.1 mycroft * 3. The names of the authors may not be used to endorse or promote products
15 1.1 mycroft * derived from this software without specific prior written permission.
16 1.1 mycroft *
17 1.1 mycroft * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18 1.1 mycroft * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 1.1 mycroft * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 1.1 mycroft * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 1.1 mycroft * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 1.1 mycroft * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 1.1 mycroft * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 1.1 mycroft * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 1.1 mycroft * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 1.1 mycroft * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 1.1 mycroft */
28 1.1 mycroft
29 1.1 mycroft #include <machine/asm.h>
30 1.1 mycroft #include <arm/armreg.h>
31 1.1 mycroft #include <arm/s3c2xx0/s3c2410reg.h>
32 1.1 mycroft
33 1.1 mycroft ENTRY(smdk2410_ram_init)
34 1.1 mycroft /* Initialize memory controller */
35 1.1 mycroft adr r0, Lmemctl_initial_data
36 1.1 mycroft ldr r1, [r0], #4
37 1.1 mycroft adr r2, Lmemctl_initial_data_end
38 1.1 mycroft 1:
39 1.1 mycroft ldr r3, [r0], #4
40 1.1 mycroft str r3, [r1], #4
41 1.1 mycroft cmp r0, r2
42 1.1 mycroft blo 1b
43 1.1 mycroft
44 1.1 mycroft mov pc,lr
45 1.1 mycroft
46 1.1 mycroft #define BANKCON_VAL_ROM(tacs,tcoc,toch,tacc,tcah,tacp) \
47 1.1 mycroft (BANKCON_MT_ROM | \
48 1.1 mycroft ((tacs)<<BANKCON_TACS_SHIFT) | ((tcoc)<<BANKCON_TCOS_SHIFT) | \
49 1.1 mycroft ((toch)<<BANKCON_TOCH_SHIFT) | ((tacc)<<BANKCON_TACC_SHIFT) | \
50 1.1 mycroft ((tcah)<<BANKCON_TCAH_SHIFT) | ((tacp)<<BANKCON_TACP_SHIFT))
51 1.1 mycroft
52 1.1 mycroft #define BANKCON_VAL_DRAM(trcd,scan) \
53 1.1 mycroft (BANKCON_MT_DRAM | ((trcd)<<BANKCON_TRCD_SHIFT) | scan)
54 1.1 mycroft
55 1.1 mycroft Lmemctl_initial_data:
56 1.1 mycroft .word S3C2410_MEMCTL_BASE + MEMCTL_BWSCON /* address */
57 1.1 mycroft .word (BWSCON_DW_32<<28)|(BWSCON_DW_32<<24)|(BWSCON_DW_16<<20)| \
58 1.1 mycroft (BWSCON_DW_16<<16)|((BWSCON_DW_16|BWSCON_WS|BWSCON_ST)<<12)| \
59 1.1 mycroft ((BWSCON_DW_16|BWSCON_WS|BWSCON_ST)<< 8)|(BWSCON_DW_32<< 4)
60 1.1 mycroft .word BANKCON_VAL_ROM(0,0,0,7,0,0) /* BANKCON0 */
61 1.1 mycroft .word BANKCON_VAL_ROM(0,0,0,7,0,0) /* BANKCON1 */
62 1.1 mycroft .word BANKCON_VAL_ROM(0,0,0,7,0,0) /* BANKCON2 */
63 1.1 mycroft .word BANKCON_VAL_ROM(0,0,0,7,0,0) /* BANKCON3 */
64 1.1 mycroft .word BANKCON_VAL_ROM(0,0,0,7,0,0) /* BANKCON4 */
65 1.1 mycroft .word BANKCON_VAL_ROM(0,0,0,7,0,0) /* BANKCON5 */
66 1.1 mycroft .word BANKCON_VAL_DRAM(1,1) /* BANKCON6 */
67 1.1 mycroft .word BANKCON_VAL_DRAM(1,1) /* BANKCON7 */
68 1.1 mycroft .word (1<<23)|(0<<22)|(0<<20)|(3<<18)|(2<<16)|(1113)
69 1.1 mycroft .word 0x32 /* SCLK power saving mode, BANKSIZE 128M/128M */
70 1.1 mycroft .word 0x30 /* MRSR6 CL=3clk */
71 1.1 mycroft .word 0x30 /* MRSR7 CL=3clk */
72 1.1 mycroft Lmemctl_initial_data_end:
73