2 * Memory Setup stuff - taken from blob memsetup.S
4 * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and
5 * Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
6 * 2004 (c) MontaVista Software, Inc.
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,
32 /*-----------------------------------------------------------------------
59 #define MDREFR_TRASR(n_) (n_ & (0x0000000f))
60 #define MDREFR_DRI(n_) ((n_ & (0x00000fff)) << 4)
61 #define MDREFR_K0DB2 (1 << 18)
62 #define MDREFR_K1DB2 (1 << 22)
63 #define MDREFR_K2DB2 (1 << 26)
65 #define MDREFR_K0RUN (1 << 17)
66 #define MDREFR_K1RUN (1 << 21)
67 #define MDREFR_K2RUN (1 << 25)
69 #define MDREFR_SLFRSH (1 << 31)
70 #define MDREFR_E1PIN (1 << 20)
73 #define PSSR_DH 0x00000008
77 /*-----------------------------------------------------------------------
78 * Setup parameters for the board:
80 MEM_BASE: .long 0xa0000000
81 MEM_START: .long 0xc0000000
82 PWR_BASE: .word 0x90020000
83 RST_BASE: .long 0x90030000
84 PPC_BASE: .long 0x90060000
85 GPIO_BASE: .long 0x90040000
86 IC_BASE: .word 0x90050000
89 /* calculated from old blob bootloader */
90 mdcnfg: .long 0x00037267 /* mdcnfg 0x00037267 */
91 mdcas00: .long 0x5555557f /* mdcas00 0x5555557f */
92 mdcas01: .long 0x55555555 /* mdcas01 0x55555555 */
93 mdcas02: .long 0x55555555 /* mdcas02 0x55555555 */
94 msc0: .long 0xfff04f78 /* msc0 0xfff04f78 */
95 msc1: .long 0xfff8fff0 /* msc1 0xfff8fff0 */
96 mecr: .long 0x98c698c6 /* mecr 0x98c698c6 */
97 mdrefr: .long 0x067600c7 /* mdrefr 0x04340327 */
98 mdcas20: .long 0xd1284142 /* mdcas20 0xd1284142 */
99 mdcas21: .long 0x72249529 /* mdcas21 0x72249529 */
100 mdcas22: .long 0x78414351 /* mdcas22 0x78414351 */
101 msc2: .long 0x201d2959 /* msc2 0x201d2959 */
102 smcnfg: .long 0x00000000 /* smcnfg 0x00000000 */
104 pin_set_out: .long 0x37ff70
105 pin_set_dir: .long 0x11480
107 gpdr_set: .long 0x0B3A0900
108 gpsr_set: .long 0x02100800
109 gpcr_set: .long 0x092A0100
110 gafr_set: .long 0x08600000
115 /* set output and direction of pins */
122 /* Setting up the memory and stuff */
123 /***********************************/
128 str r1, [r0, #MDCNFG]
130 str r1, [r0, #MDCAS00]
132 str r1, [r0, #MDCAS01]
134 str r1, [r0, #MDCAS02]
136 str r1, [r0, #MDCAS20]
138 str r1, [r0, #MDCAS21]
140 str r1, [r0, #MDCAS22]
143 ldr r2, [r0, #MDREFR]
144 bic r2, r2, #MDREFR_K0DB2
145 bic r2, r2, #MDREFR_K1DB2
146 bic r2, r2, #MDREFR_K2DB2
147 str r2, [r0, #MDREFR]
149 ldr r2, [r0, #MDREFR]
150 orr r2, r2, #MDREFR_TRASR(7)
153 spin: subs r4, r4, #1
160 ldr r2, [r0, #MDREFR]
161 bic r2, r2, #MDREFR_K0DB2
162 bic r2, r2, #MDREFR_K1DB2
163 bic r2, r2, #MDREFR_K2DB2
164 str r2, [r0, #MDREFR]
166 ldr r2, [r0, #MDREFR]
167 orr r2, r2, #MDREFR_TRASR(7)
168 orr r2, r2, #MDREFR_DRI(12)
169 orr r2, r2, #MDREFR_K0DB2
170 orr r2, r2, #MDREFR_K1DB2
171 orr r2, r2, #MDREFR_K2DB2
172 str r2, [r0, #MDREFR]
174 ldr r2, [r0, #MDREFR]
175 orr r2, r2, #MDREFR_K0RUN
176 orr r2, r2, #MDREFR_K1RUN
177 orr r2, r2, #MDREFR_K2RUN
178 str r2, [r0, #MDREFR]
180 ldr r2, [r0, #MDREFR]
181 bic r2, r2, #MDREFR_SLFRSH
182 str r2, [r0, #MDREFR]
184 ldr r2, [r0, #MDREFR]
185 orr r2, r2, #MDREFR_E1PIN
186 str r2, [r0, #MDREFR]
200 str r1, [r0, #SMCNFG]
202 str r1, [r0, #MDCNFG]
207 orr r1, r1, #0x00000001
208 str r1, [r0, #MDCNFG]