1
2
3
4
5
6
7
8#include <common.h>
9#include <ioports.h>
10#include <mpc8260.h>
11#include <pci.h>
12
13
14
15
16
17
18
19
20const iop_conf_t iop_conf_tab[4][32] = {
21
22
23 {
24 { 1, 1, 1, 0, 0, 0 },
25 { 1, 1, 1, 0, 0, 0 },
26 { 1, 1, 1, 1, 0, 0 },
27 { 1, 1, 1, 1, 0, 0 },
28 { 1, 1, 1, 0, 0, 0 },
29 { 1, 1, 1, 0, 0, 0 },
30 { 1, 0, 0, 1, 0, 0 },
31 { 1, 0, 0, 1, 0, 0 },
32 { 1, 0, 0, 1, 0, 0 },
33 { 1, 0, 0, 1, 0, 0 },
34 { 1, 1, 0, 1, 0, 0 },
35 { 1, 1, 0, 1, 0, 0 },
36 { 1, 1, 0, 1, 0, 0 },
37 { 1, 1, 0, 1, 0, 0 },
38 { 1, 1, 0, 0, 0, 0 },
39 { 1, 1, 0, 0, 0, 0 },
40 { 1, 1, 0, 0, 0, 0 },
41 { 1, 1, 0, 0, 0, 0 },
42 { 1, 0, 0, 1, 0, 0 },
43 { 1, 0, 0, 1, 0, 1 },
44 { 1, 0, 0, 1, 0, 0 },
45 { 1, 0, 0, 1, 0, 1 },
46#if 1
47 { 0, 1, 0, 1, 0, 0 },
48 { 0, 1, 0, 0, 0, 0 },
49#else
50 { 1, 1, 0, 1, 0, 0 },
51 { 1, 1, 0, 0, 0, 0 },
52#endif
53 { 0, 0, 0, 0, 0, 0 },
54 { 1, 0, 0, 1, 0, 1 },
55 { 1, 0, 0, 1, 0, 1 },
56 { 1, 0, 0, 1, 0, 0 },
57 { 1, 0, 0, 1, 0, 0 },
58 { 0, 0, 0, 0, 0, 0 },
59 { 1, 0, 0, 0, 0, 0 },
60 { 1, 0, 0, 1, 0, 0 }
61 },
62
63
64 {
65 { 1, 1, 0, 1, 0, 0 },
66 { 1, 1, 0, 0, 0, 0 },
67 { 1, 1, 1, 1, 0, 0 },
68 { 1, 1, 0, 0, 0, 0 },
69 { 1, 1, 0, 0, 0, 0 },
70 { 1, 1, 0, 0, 0, 0 },
71 { 1, 1, 0, 1, 0, 0 },
72 { 1, 1, 0, 1, 0, 0 },
73 { 1, 1, 0, 1, 0, 0 },
74 { 1, 1, 0, 1, 0, 0 },
75 { 1, 1, 0, 0, 0, 0 },
76 { 1, 1, 0, 0, 0, 0 },
77 { 1, 1, 0, 0, 0, 0 },
78 { 1, 1, 0, 0, 0, 0 },
79 { 1, 1, 0, 0, 0, 0 },
80 { 1, 1, 0, 0, 0, 0 },
81 { 1, 1, 0, 1, 0, 0 },
82 { 1, 1, 0, 1, 0, 0 },
83 { 1, 1, 0, 0, 0, 0 },
84 { 1, 1, 0, 0, 0, 0 },
85 { 1, 1, 0, 0, 0, 0 },
86 { 1, 1, 0, 0, 0, 0 },
87 { 1, 1, 0, 0, 0, 0 },
88 { 1, 1, 0, 0, 0, 0 },
89 { 1, 1, 0, 1, 0, 0 },
90 { 1, 1, 0, 1, 0, 0 },
91 { 1, 1, 0, 1, 0, 0 },
92 { 1, 1, 0, 1, 0, 0 },
93 { 0, 0, 0, 0, 0, 0 },
94 { 0, 0, 0, 0, 0, 0 },
95 { 0, 0, 0, 0, 0, 0 },
96 { 0, 0, 0, 0, 0, 0 }
97 },
98
99
100 {
101 { 0, 0, 0, 0, 0, 0 },
102 { 0, 0, 0, 0, 0, 0 },
103 { 1, 0, 0, 0, 0, 0 },
104 { 1, 0, 0, 0, 0, 0 },
105 { 0, 0, 0, 0, 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 { 0, 0, 0, 0, 0, 0 },
111 { 1, 1, 0, 0, 0, 0 },
112 { 1, 1, 0, 0, 0, 0 },
113 { 1, 1, 0, 0, 0, 0 },
114 { 1, 1, 0, 0, 0, 0 },
115 { 1, 1, 0, 0, 0, 0 },
116 { 1, 1, 0, 0, 0, 0 },
117#if 0
118 { 0, 0, 0, 0, 0, 0 },
119#else
120 { 1, 1, 0, 1, 0, 0 },
121#endif
122 { 0, 0, 0, 0, 0, 0 },
123 { 0, 0, 0, 0, 0, 0 },
124 { 0, 0, 0, 0, 0, 0 },
125 { 0, 0, 0, 0, 0, 0 },
126 { 0, 0, 0, 0, 0, 0 },
127 { 0, 0, 0, 0, 0, 0 },
128 { 0, 0, 0, 0, 0, 0 },
129 { 0, 0, 0, 0, 0, 0 },
130 { 0, 0, 0, 0, 0, 0 },
131 { 0, 0, 0, 0, 0, 0 },
132 { 0, 0, 0, 0, 0, 0 },
133 { 0, 0, 0, 0, 0, 0 },
134 { 0, 0, 0, 0, 0, 0 },
135 { 0, 0, 0, 0, 0, 0 },
136 { 0, 0, 0, 0, 0, 0 },
137 },
138
139
140 {
141 { 1, 1, 0, 0, 0, 0 },
142 { 1, 1, 1, 1, 0, 0 },
143 { 1, 0, 0, 1, 0, 0 },
144 { 1, 1, 0, 0, 0, 0 },
145 { 1, 1, 0, 1, 0, 0 },
146 { 1, 0, 0, 1, 0, 0 },
147 { 0, 0, 0, 0, 0, 0 },
148 { 0, 0, 0, 0, 0, 0 },
149 { 0, 0, 0, 0, 0, 0 },
150 { 0, 0, 0, 0, 0, 0 },
151 { 0, 0, 0, 0, 0, 0 },
152 { 0, 0, 0, 0, 0, 0 },
153 { 0, 0, 0, 0, 0, 0 },
154 { 0, 0, 0, 0, 0, 0 },
155 { 0, 0, 0, 0, 0, 0 },
156 { 0, 0, 0, 0, 0, 0 },
157#if defined(CONFIG_SYS_I2C_SOFT)
158 { 1, 0, 0, 1, 1, 1 },
159 { 1, 0, 0, 1, 1, 1 },
160#else
161#if defined(CONFIG_HARD_I2C)
162 { 1, 1, 1, 0, 1, 0 },
163 { 1, 1, 1, 0, 1, 0 },
164#else
165 { 1, 1, 1, 0, 1, 0 },
166 { 1, 1, 1, 0, 1, 0 },
167#endif
168#endif
169 { 0, 0, 0, 0, 0, 0 },
170 { 0, 0, 0, 0, 0, 0 },
171 { 0, 0, 0, 0, 0, 0 },
172 { 0, 0, 0, 0, 0, 0 },
173 { 1, 1, 0, 1, 0, 0 },
174 { 1, 1, 0, 0, 0, 0 },
175 { 0, 0, 0, 0, 0, 0 },
176 { 0, 0, 0, 0, 0, 0 },
177 { 0, 0, 0, 0, 0, 0 },
178#if 0
179 { 0, 0, 0, 0, 0, 0 },
180#else
181 { 1, 1, 1, 0, 0, 0 },
182#endif
183 { 0, 0, 0, 0, 0, 0 },
184 { 0, 0, 0, 0, 0, 0 },
185 { 0, 0, 0, 0, 0, 0 },
186 { 0, 0, 0, 0, 0, 0 }
187 }
188};
189
190
191
192
193#define _NOT_USED_ 0xFFFFFFFF
194
195static const uint rtc_table[] =
196{
197
198
199
200 0xfffec00, 0xfffac00, 0xfff2d00, 0xfef2800,
201 0xfaf2080, 0xfaf2080, 0xfff2400, 0x1fff6c05,
202
203
204
205 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
206 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
207 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
208 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
209
210
211
212 0xfffec00, 0xfffac00, 0xfff2d00, 0xfef2800,
213 0xfaf2080, 0xfaf2080, 0xfaf2400, 0x1fbf6c05,
214
215
216
217 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
218 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
219 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
220 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
221
222
223
224 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
225 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
226 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
227
228
229
230 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
231};
232
233
234
235
236
237int checkboard (void)
238{
239 printf ("Board: ATC\n");
240 return 0;
241}
242
243
244
245
246
247
248
249
250
251
252static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
253 ulong orx, volatile uchar * base)
254{
255 volatile uchar c = 0xff;
256 volatile uint *sdmr_ptr;
257 volatile uint *orx_ptr;
258 ulong maxsize, size;
259 int i;
260
261
262
263
264
265
266 maxsize = (1 + (~orx | 0x7fff)) / 2;
267
268
269
270
271 sdmr_ptr = &memctl->memc_psdmr;
272 orx_ptr = &memctl->memc_or2;
273
274 *orx_ptr = orx;
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296 *sdmr_ptr = sdmr | PSDMR_OP_PREA;
297 *base = c;
298
299 *sdmr_ptr = sdmr | PSDMR_OP_CBRR;
300 for (i = 0; i < 8; i++)
301 *base = c;
302
303 *sdmr_ptr = sdmr | PSDMR_OP_MRW;
304 *(base + CONFIG_SYS_MRS_OFFS) = c;
305
306 *sdmr_ptr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN;
307 *base = c;
308
309 size = get_ram_size((long *)base, maxsize);
310
311 *orx_ptr = orx | ~(size - 1);
312
313 return (size);
314}
315
316int misc_init_r(void)
317{
318 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
319 volatile memctl8260_t *memctl = &immap->im_memctl;
320
321 upmconfig(UPMA, (uint *)rtc_table, sizeof(rtc_table) / sizeof(uint));
322 memctl->memc_mamr = MxMR_RLFx_6X | MxMR_WLFx_6X | MxMR_OP_NORM;
323
324 return (0);
325}
326
327phys_size_t initdram (int board_type)
328{
329 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
330 volatile memctl8260_t *memctl = &immap->im_memctl;
331
332#ifndef CONFIG_SYS_RAMBOOT
333 ulong size8, size9;
334#endif
335 long psize;
336
337 psize = 8 * 1024 * 1024;
338
339 memctl->memc_mptpr = CONFIG_SYS_MPTPR;
340 memctl->memc_psrt = CONFIG_SYS_PSRT;
341
342#ifndef CONFIG_SYS_RAMBOOT
343
344
345 size8 = try_init (memctl, CONFIG_SYS_PSDMR_8COL, CONFIG_SYS_OR2_8COL,
346 (uchar *) CONFIG_SYS_SDRAM_BASE);
347 size9 = try_init (memctl, CONFIG_SYS_PSDMR_9COL, CONFIG_SYS_OR2_9COL,
348 (uchar *) CONFIG_SYS_SDRAM_BASE);
349
350 if (size8 < size9) {
351 psize = size9;
352 printf ("(60x:9COL) ");
353 } else {
354 psize = try_init (memctl, CONFIG_SYS_PSDMR_8COL, CONFIG_SYS_OR2_8COL,
355 (uchar *) CONFIG_SYS_SDRAM_BASE);
356 printf ("(60x:8COL) ");
357 }
358
359#endif
360
361 icache_enable ();
362
363 return (psize);
364}
365
366#if defined(CONFIG_CMD_DOC)
367void doc_init (void)
368{
369 doc_probe (CONFIG_SYS_DOC_BASE);
370}
371#endif
372
373#ifdef CONFIG_PCI
374struct pci_controller hose;
375
376extern void pci_mpc8250_init(struct pci_controller *);
377
378void pci_init_board(void)
379{
380 pci_mpc8250_init(&hose);
381}
382#endif
383