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
116 /* this is required for flashing */
123 /* Setting up the memory and stuff */
124 /***********************************/
129 str r1, [r0, #MDCNFG]
131 str r1, [r0, #MDCAS00]
133 str r1, [r0, #MDCAS01]
135 str r1, [r0, #MDCAS02]
137 str r1, [r0, #MDCAS20]
139 str r1, [r0, #MDCAS21]
141 str r1, [r0, #MDCAS22]
144 ldr r2, [r0, #MDREFR]
145 bic r2, r2, #MDREFR_K0DB2
146 bic r2, r2, #MDREFR_K1DB2
147 bic r2, r2, #MDREFR_K2DB2
148 str r2, [r0, #MDREFR]
150 ldr r2, [r0, #MDREFR]
151 orr r2, r2, #MDREFR_TRASR(7)
154 spin: subs r4, r4, #1
161 ldr r2, [r0, #MDREFR]
162 bic r2, r2, #MDREFR_K0DB2
163 bic r2, r2, #MDREFR_K1DB2
164 bic r2, r2, #MDREFR_K2DB2
165 str r2, [r0, #MDREFR]
167 ldr r2, [r0, #MDREFR]
168 orr r2, r2, #MDREFR_TRASR(7)
169 orr r2, r2, #MDREFR_DRI(12)
170 orr r2, r2, #MDREFR_K0DB2
171 orr r2, r2, #MDREFR_K1DB2
172 orr r2, r2, #MDREFR_K2DB2
173 str r2, [r0, #MDREFR]
175 ldr r2, [r0, #MDREFR]
176 orr r2, r2, #MDREFR_K0RUN
177 orr r2, r2, #MDREFR_K1RUN
178 orr r2, r2, #MDREFR_K2RUN
179 str r2, [r0, #MDREFR]
181 ldr r2, [r0, #MDREFR]
182 bic r2, r2, #MDREFR_SLFRSH
183 str r2, [r0, #MDREFR]
185 ldr r2, [r0, #MDREFR]
186 orr r2, r2, #MDREFR_E1PIN
187 str r2, [r0, #MDREFR]
194 ldr r2, [r0, #MDCNFG]
195 orr r2, r2, #0x00000003
196 orr r2, r2, #0x00030000
197 str r2, [r0, #MDCNFG]
206 str r1, [r0, #SMCNFG]