1*95e1ffb1Schristos/* $NetBSD: smdk2410_ram_init.S,v 1.2 2005/12/11 12:17:09 christos Exp $ */ 279290227Smycroft 379290227Smycroft/* 479290227Smycroft * Copyright (c) 2003 By Noon Software, Inc. All rights reserved. 579290227Smycroft * 679290227Smycroft * Redistribution and use in source and binary forms, with or without 779290227Smycroft * modification, are permitted provided that the following conditions 879290227Smycroft * are met: 979290227Smycroft * 1. Redistributions of source code must retain the above copyright 1079290227Smycroft * notice, this list of conditions and the following disclaimer. 1179290227Smycroft * 2. Redistributions in binary form must reproduce the above copyright 1279290227Smycroft * notice, this list of conditions and the following disclaimer in the 1379290227Smycroft * documentation and/or other materials provided with the distribution. 1479290227Smycroft * 3. The names of the authors may not be used to endorse or promote products 1579290227Smycroft * derived from this software without specific prior written permission. 1679290227Smycroft * 1779290227Smycroft * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 1879290227Smycroft * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1979290227Smycroft * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2079290227Smycroft * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, 2179290227Smycroft * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2279290227Smycroft * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2379290227Smycroft * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2479290227Smycroft * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2579290227Smycroft * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2679290227Smycroft * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2779290227Smycroft */ 2879290227Smycroft 2979290227Smycroft#include <machine/asm.h> 3079290227Smycroft#include <arm/armreg.h> 3179290227Smycroft#include <arm/s3c2xx0/s3c2410reg.h> 3279290227Smycroft 3379290227SmycroftENTRY(smdk2410_ram_init) 3479290227Smycroft /* Initialize memory controller */ 3579290227Smycroft adr r0, Lmemctl_initial_data 3679290227Smycroft ldr r1, [r0], #4 3779290227Smycroft adr r2, Lmemctl_initial_data_end 3879290227Smycroft1: 3979290227Smycroft ldr r3, [r0], #4 4079290227Smycroft str r3, [r1], #4 4179290227Smycroft cmp r0, r2 4279290227Smycroft blo 1b 4379290227Smycroft 4479290227Smycroft mov pc,lr 4579290227Smycroft 4679290227Smycroft#define BANKCON_VAL_ROM(tacs,tcoc,toch,tacc,tcah,tacp) \ 4779290227Smycroft (BANKCON_MT_ROM | \ 4879290227Smycroft ((tacs)<<BANKCON_TACS_SHIFT) | ((tcoc)<<BANKCON_TCOS_SHIFT) | \ 4979290227Smycroft ((toch)<<BANKCON_TOCH_SHIFT) | ((tacc)<<BANKCON_TACC_SHIFT) | \ 5079290227Smycroft ((tcah)<<BANKCON_TCAH_SHIFT) | ((tacp)<<BANKCON_TACP_SHIFT)) 5179290227Smycroft 5279290227Smycroft#define BANKCON_VAL_DRAM(trcd,scan) \ 5379290227Smycroft (BANKCON_MT_DRAM | ((trcd)<<BANKCON_TRCD_SHIFT) | scan) 5479290227Smycroft 5579290227SmycroftLmemctl_initial_data: 5679290227Smycroft .word S3C2410_MEMCTL_BASE + MEMCTL_BWSCON /* address */ 5779290227Smycroft .word (BWSCON_DW_32<<28)|(BWSCON_DW_32<<24)|(BWSCON_DW_16<<20)| \ 5879290227Smycroft (BWSCON_DW_16<<16)|((BWSCON_DW_16|BWSCON_WS|BWSCON_ST)<<12)| \ 5979290227Smycroft ((BWSCON_DW_16|BWSCON_WS|BWSCON_ST)<< 8)|(BWSCON_DW_32<< 4) 6079290227Smycroft .word BANKCON_VAL_ROM(0,0,0,7,0,0) /* BANKCON0 */ 6179290227Smycroft .word BANKCON_VAL_ROM(0,0,0,7,0,0) /* BANKCON1 */ 6279290227Smycroft .word BANKCON_VAL_ROM(0,0,0,7,0,0) /* BANKCON2 */ 6379290227Smycroft .word BANKCON_VAL_ROM(0,0,0,7,0,0) /* BANKCON3 */ 6479290227Smycroft .word BANKCON_VAL_ROM(0,0,0,7,0,0) /* BANKCON4 */ 6579290227Smycroft .word BANKCON_VAL_ROM(0,0,0,7,0,0) /* BANKCON5 */ 6679290227Smycroft .word BANKCON_VAL_DRAM(1,1) /* BANKCON6 */ 6779290227Smycroft .word BANKCON_VAL_DRAM(1,1) /* BANKCON7 */ 6879290227Smycroft .word (1<<23)|(0<<22)|(0<<20)|(3<<18)|(2<<16)|(1113) 6979290227Smycroft .word 0x32 /* SCLK power saving mode, BANKSIZE 128M/128M */ 7079290227Smycroft .word 0x30 /* MRSR6 CL=3clk */ 7179290227Smycroft .word 0x30 /* MRSR7 CL=3clk */ 7279290227SmycroftLmemctl_initial_data_end: 73