blob: a7400b3ddbbb3d68a9c9404fe48c2a960faa3ca2 [file] [log] [blame]
wdenk2d24a3a2004-06-09 21:50:45 +00001/*
wdenk400558b2005-04-02 23:52:25 +00002 * board/mx1ads/lowlevel_init.S
wdenk49822e22004-06-19 21:19:10 +00003 *
wdenk2d24a3a2004-06-09 21:50:45 +00004 * (c) Copyright 2004
5 * Techware Information Technology, Inc.
6 * http://www.techware.com.tw/
7 *
8 * Ming-Len Wu <minglen_wu@techware.com.tw>
9 *
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.
14 *
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.
19 *
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,
23 * MA 02111-1307 USA
24 */
25
26#include <config.h>
27#include <version.h>
28
29#define SDCTL0 0x221000
30#define SDCTL1 0x221004
31
32
33_TEXT_BASE:
Wolfgang Denk14d0a022010-10-07 21:51:12 +020034 .word CONFIG_SYS_TEXT_BASE
wdenk2d24a3a2004-06-09 21:50:45 +000035
wdenk400558b2005-04-02 23:52:25 +000036.globl lowlevel_init
37lowlevel_init:
Wolfgang Denk53677ef2008-05-20 16:00:29 +020038/* memory controller init */
wdenk2d24a3a2004-06-09 21:50:45 +000039
40 ldr r1, =SDCTL0
41
42/* Set Precharge Command */
43
44 ldr r3, =0x92120200
45/* ldr r3, =0x92120251
46*/
47 str r3, [r1]
48
49/* Issue Precharge All Commad */
50 ldr r3, =0x8200000
51 ldr r2, [r3]
wdenk49822e22004-06-19 21:19:10 +000052
Wolfgang Denk53677ef2008-05-20 16:00:29 +020053/* Set AutoRefresh Command */
wdenk2d24a3a2004-06-09 21:50:45 +000054 ldr r3, =0xA2120200
55 str r3, [r1]
56
57/* Issue AutoRefresh Command */
58 ldr r3, =0x8000000
59 ldr r2, [r3]
60 ldr r2, [r3]
61 ldr r2, [r3]
62 ldr r2, [r3]
63 ldr r2, [r3]
64 ldr r2, [r3]
65 ldr r2, [r3]
66 ldr r2, [r3]
wdenk49822e22004-06-19 21:19:10 +000067
Wolfgang Denk53677ef2008-05-20 16:00:29 +020068/* Set Mode Register */
wdenk2d24a3a2004-06-09 21:50:45 +000069 ldr r3, =0xB2120200
70 str r3, [r1]
wdenk49822e22004-06-19 21:19:10 +000071
wdenk2d24a3a2004-06-09 21:50:45 +000072/* Issue Mode Register Command */
Wolfgang Denk53677ef2008-05-20 16:00:29 +020073 ldr r3, =0x08111800 /* Mode Register Value */
wdenk2d24a3a2004-06-09 21:50:45 +000074 ldr r2, [r3]
75
76/* Set Normal Mode */
77 ldr r3, =0x82124200
78 str r3, [r1]
79
Wolfgang Denk53677ef2008-05-20 16:00:29 +020080/* everything is fine now */
wdenk2d24a3a2004-06-09 21:50:45 +000081 mov pc, lr