1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#include <common.h>
28#include <ioports.h>
29#include <mpc8260.h>
30#include "ep8260.h"
31
32
33
34
35
36
37
38const iop_conf_t iop_conf_tab[4][32] = {
39
40
41 {
42 { 0, 0, 0, 1, 0, 0 },
43 { 0, 0, 0, 1, 0, 0 },
44 { 0, 0, 0, 1, 0, 0 },
45 { 0, 0, 0, 1, 0, 0 },
46 { 0, 0, 0, 1, 0, 0 },
47 { 0, 0, 0, 1, 0, 0 },
48 { 0, 0, 0, 1, 0, 0 },
49 { 0, 0, 0, 1, 0, 0 },
50 { 0, 0, 0, 1, 0, 0 },
51 { 0, 0, 0, 1, 0, 0 },
52 { 0, 0, 0, 1, 0, 0 },
53 { 0, 0, 0, 1, 0, 0 },
54 { 0, 0, 0, 1, 0, 0 },
55 { 0, 0, 0, 1, 0, 0 },
56 { 0, 0, 0, 1, 0, 0 },
57 { 0, 0, 0, 1, 0, 0 },
58 { 0, 0, 0, 1, 0, 0 },
59 { 0, 0, 0, 1, 0, 0 },
60 { 0, 0, 0, 1, 0, 0 },
61 { 0, 0, 0, 1, 0, 0 },
62 { 0, 0, 0, 1, 0, 0 },
63 { 0, 0, 0, 1, 0, 0 },
64 { 0, 1, 0, 1, 0, 0 },
65 { 0, 1, 0, 0, 0, 0 },
66 { 0, 0, 0, 1, 0, 0 },
67 { 0, 0, 0, 1, 0, 0 },
68 { 0, 0, 0, 1, 0, 0 },
69 { 0, 0, 0, 1, 0, 0 },
70 { 0, 0, 0, 1, 0, 0 },
71 { 0, 0, 0, 1, 0, 0 },
72 { 0, 0, 0, 1, 0, 0 },
73 { 0, 0, 0, 1, 0, 0 }
74 },
75
76
77 {
78 { 0, 1, 0, 1, 0, 0 },
79 { 0, 1, 0, 0, 0, 0 },
80 { 0, 1, 1, 1, 0, 0 },
81 { 0, 1, 0, 0, 0, 0 },
82 { 0, 1, 0, 0, 0, 0 },
83 { 0, 1, 0, 0, 0, 0 },
84 { 0, 1, 0, 1, 0, 0 },
85 { 0, 1, 0, 1, 0, 0 },
86 { 0, 1, 0, 1, 0, 0 },
87 { 0, 1, 0, 1, 0, 0 },
88 { 0, 1, 0, 0, 0, 0 },
89 { 0, 1, 0, 0, 0, 0 },
90 { 0, 1, 0, 0, 0, 0 },
91 { 0, 1, 0, 0, 0, 0 },
92 { 1, 1, 0, 0, 0, 0 },
93 { 1, 1, 0, 0, 0, 0 },
94 { 1, 1, 0, 1, 0, 0 },
95 { 1, 1, 0, 1, 0, 0 },
96 { 1, 1, 0, 0, 0, 0 },
97 { 1, 1, 0, 0, 0, 0 },
98 { 1, 1, 0, 0, 0, 0 },
99 { 1, 1, 0, 0, 0, 0 },
100 { 1, 1, 0, 0, 0, 0 },
101 { 1, 1, 0, 0, 0, 0 },
102 { 0, 0, 0, 0, 0, 0 },
103 { 1, 1, 0, 1, 0, 0 },
104 { 1, 1, 0, 1, 0, 0 },
105 { 1, 1, 0, 1, 0, 0 },
106 { 0, 0, 0, 0, 0, 0 },
107 { 0, 0, 0, 0, 0, 0 },
108 { 0, 0, 0, 0, 0, 0 },
109 { 0, 0, 0, 0, 0, 0 }
110 },
111
112
113 {
114 { 0, 0, 0, 1, 0, 0 },
115 { 0, 0, 0, 1, 0, 0 },
116 { 0, 1, 1, 0, 0, 0 },
117 { 0, 0, 0, 1, 0, 0 },
118 { 1, 1, 0, 1, 0, 0 },
119 { 0, 0, 0, 1, 0, 0 },
120 { 0, 0, 0, 1, 0, 0 },
121 { 0, 0, 0, 1, 0, 0 },
122 { 0, 1, 0, 1, 0, 0 },
123 { 0, 1, 0, 0, 0, 0 },
124 { 0, 1, 0, 0, 0, 0 },
125 { 0, 1, 0, 0, 0, 0 },
126 { 0, 1, 0, 0, 0, 0 },
127 { 0, 1, 0, 0, 0, 0 },
128 { 1, 1, 0, 0, 0, 0 },
129 { 1, 1, 0, 0, 0, 0 },
130 { 0, 0, 0, 1, 0, 0 },
131 { 0, 1, 0, 0, 0, 0 },
132 { 0, 0, 0, 1, 0, 0 },
133 { 0, 0, 0, 1, 0, 0 },
134 { 0, 0, 0, 1, 0, 0 },
135 { 0, 0, 0, 1, 0, 0 },
136 { 0, 0, 0, 1, 0, 0 },
137 { 0, 0, 0, 1, 0, 0 },
138 { 0, 0, 0, 1, 0, 0 },
139 { 0, 0, 0, 1, 0, 0 },
140 { 0, 0, 0, 1, 0, 0 },
141 { 0, 0, 0, 1, 0, 0 },
142 { 0, 0, 0, 1, 0, 0 },
143 { 0, 0, 0, 1, 0, 1 },
144 { 0, 0, 0, 1, 0, 0 },
145 { 0, 0, 0, 1, 0, 0 },
146 },
147
148
149 {
150 { 0, 1, 0, 0, 0, 0 },
151 { 0, 1, 1, 1, 0, 0 },
152 { 0, 1, 0, 1, 0, 0 },
153 { 0, 0, 0, 1, 0, 0 },
154 { 0, 0, 0, 1, 0, 0 },
155 { 0, 0, 0, 1, 0, 0 },
156 { 0, 0, 0, 1, 0, 0 },
157 { 0, 0, 0, 1, 0, 0 },
158 { 0, 0, 0, 1, 0, 0 },
159 { 0, 0, 0, 1, 0, 0 },
160 { 0, 0, 0, 1, 0, 0 },
161 { 0, 0, 0, 1, 0, 0 },
162 { 0, 0, 0, 1, 0, 0 },
163 { 0, 0, 0, 1, 0, 0 },
164 { 0, 1, 0, 0, 0, 0 },
165 { 0, 1, 0, 1, 0, 0 },
166 { 1, 1, 1, 0, 1, 0 },
167 { 1, 1, 1, 0, 1, 0 },
168 { 0, 0, 0, 0, 0, 0 },
169 { 0, 0, 0, 0, 0, 0 },
170 { 0, 0, 0, 0, 0, 0 },
171 { 0, 0, 0, 0, 0, 0 },
172 { 1, 1, 0, 1, 0, 0 },
173 { 1, 1, 0, 0, 0, 0 },
174 { 0, 0, 0, 1, 0, 1 },
175 { 0, 0, 0, 1, 0, 1 },
176 { 0, 0, 0, 1, 0, 1 },
177 { 0, 0, 0, 1, 0, 1 },
178 { 0, 0, 0, 0, 0, 0 },
179 { 0, 0, 0, 0, 0, 0 },
180 { 0, 0, 0, 0, 0, 0 },
181 { 0, 0, 0, 0, 0, 0 }
182 }
183};
184
185
186
187
188
189
190
191int board_early_init_f (void)
192{
193 volatile t_ep_regs *regs = (t_ep_regs *) CONFIG_SYS_REGS_BASE;
194 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
195 volatile memctl8260_t *memctl = &immap->im_memctl;
196
197 memctl->memc_br4 = CONFIG_SYS_BR4_PRELIM;
198 memctl->memc_or4 = CONFIG_SYS_OR4_PRELIM;
199 regs->bcsr1 = 0x62;
200 regs->bcsr2 = 0x30;
201 return 0;
202}
203
204void reset_phy (void)
205{
206 volatile t_ep_regs *regs = (t_ep_regs *) CONFIG_SYS_REGS_BASE;
207
208 regs->bcsr4 = 0xC0;
209}
210
211
212
213
214
215
216
217int checkboard (void)
218{
219 volatile t_ep_regs *regs = (t_ep_regs *) CONFIG_SYS_REGS_BASE;
220 uint major = 0, minor = 0;
221
222 switch (regs->bcsr0) {
223 case 0x02:
224 major = 1;
225 break;
226 case 0x03:
227 major = 1;
228 minor = 1;
229 break;
230 case 0x06:
231 major = 1;
232 minor = 3;
233 break;
234 default:
235 break;
236 }
237 printf ("Board: Embedded Planet EP8260, Revision %d.%d\n",
238 major, minor);
239 return 0;
240}
241
242
243
244
245
246phys_size_t initdram (int board_type)
247{
248 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
249 volatile memctl8260_t *memctl = &immap->im_memctl;
250 volatile uchar c = 0;
251 volatile uchar *ramaddr = (uchar *) (CONFIG_SYS_SDRAM_BASE) + 0x110;
252
253
254
255
256
257
258
259 long size = CONFIG_SYS_SDRAM0_SIZE;
260 int i;
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283 memctl->memc_psrt = CONFIG_SYS_PSRT;
284 memctl->memc_mptpr = CONFIG_SYS_MPTPR;
285
286 memctl->memc_psdmr = (ulong) CONFIG_SYS_PSDMR | PSDMR_OP_PREA;
287 *ramaddr = c;
288
289 memctl->memc_psdmr = (ulong) CONFIG_SYS_PSDMR | PSDMR_OP_CBRR;
290 for (i = 0; i < 8; i++)
291 *ramaddr = c;
292
293 memctl->memc_psdmr = (ulong) CONFIG_SYS_PSDMR | PSDMR_OP_MRW;
294 *ramaddr = c;
295
296 memctl->memc_psdmr = (ulong) CONFIG_SYS_PSDMR | PSDMR_OP_NORM | PSDMR_RFEN;
297 *ramaddr = c;
298
299#ifndef CONFIG_SYS_RAMBOOT
300#ifdef CONFIG_SYS_LSDRAM
301 size += CONFIG_SYS_SDRAM1_SIZE;
302 ramaddr = (uchar *) (CONFIG_SYS_SDRAM1_BASE) + 0x8c;
303 memctl->memc_lsrt = CONFIG_SYS_LSRT;
304
305 memctl->memc_lsdmr = (ulong) CONFIG_SYS_LSDMR | PSDMR_OP_PREA;
306 *ramaddr = c;
307
308 memctl->memc_lsdmr = (ulong) CONFIG_SYS_LSDMR | PSDMR_OP_CBRR;
309 for (i = 0; i < 8; i++)
310 *ramaddr = c;
311
312 memctl->memc_lsdmr = (ulong) CONFIG_SYS_LSDMR | PSDMR_OP_MRW;
313 *ramaddr = c;
314
315 memctl->memc_lsdmr = (ulong) CONFIG_SYS_LSDMR | PSDMR_OP_NORM | PSDMR_RFEN;
316 *ramaddr = c;
317#endif
318#endif
319 return (size * 1024 * 1024);
320}
321