1
2
3
4
5
6
7
8#include <common.h>
9#include <ioports.h>
10#include <mpc8260.h>
11#include <pci.h>
12#include <netdev.h>
13
14
15
16
17
18
19
20
21const iop_conf_t iop_conf_tab[4][32] = {
22
23
24 {
25 { 1, 1, 1, 0, 0, 0 },
26 { 1, 1, 1, 0, 0, 0 },
27 { 1, 1, 1, 1, 0, 0 },
28 { 1, 1, 1, 1, 0, 0 },
29 { 1, 1, 1, 0, 0, 0 },
30 { 1, 1, 1, 0, 0, 0 },
31 { 0, 0, 0, 1, 0, 0 },
32 { 0, 0, 0, 1, 0, 0 },
33 { 0, 0, 0, 1, 0, 0 },
34 { 0, 0, 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, 1, 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, 1, 0, 0, 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, 1, 0, 1, 0, 0 },
48 { 0, 1, 0, 0, 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 },
58
59
60 {
61 { 1, 1, 0, 1, 0, 0 },
62 { 1, 1, 0, 0, 0, 0 },
63 { 1, 1, 1, 1, 0, 0 },
64#if defined(CONFIG_ETHER_ON_SCC) && (CONFIG_ETHER_INDEX == 1)
65#ifdef CONFIG_ETHER_ON_FCC2
66#error "SCC1 conflicts with FCC2"
67#endif
68 { 1, 1, 1, 1, 0, 0 },
69#else
70 { 1, 1, 0, 0, 0, 0 },
71#endif
72 { 1, 1, 0, 0, 0, 0 },
73 { 1, 1, 0, 0, 0, 0 },
74 { 1, 1, 0, 1, 0, 0 },
75 { 1, 1, 0, 1, 0, 0 },
76 { 1, 1, 0, 1, 0, 0 },
77 { 1, 1, 0, 1, 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, 0, 0, 0 },
82 { 0, 0, 0, 0, 0, 0 },
83 { 0, 0, 0, 0, 0, 0 },
84 { 1, 1, 0, 0, 0, 0 },
85 { 1, 1, 0, 0, 0, 0 },
86 { 0, 0, 0, 0, 0, 0 },
87 { 0, 0, 0, 0, 0, 0 },
88 { 0, 0, 0, 0, 0, 0 },
89 { 0, 0, 0, 0, 0, 0 },
90 { 0, 0, 0, 0, 0, 0 },
91 { 1, 1, 1, 1, 0, 0 },
92 { 0, 0, 0, 0, 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 { 0, 0, 0, 0, 0, 0 },
98 { 0, 0, 0, 0, 0, 0 },
99 { 0, 0, 0, 0, 0, 0 }
100 },
101
102
103 {
104 { 0, 0, 0, 1, 0, 0 },
105 { 0, 0, 0, 1, 0, 0 },
106 { 0, 1, 1, 0, 0, 0 },
107 { 0, 0, 0, 1, 0, 0 },
108 { 0, 0, 0, 1, 0, 0 },
109 { 0, 0, 0, 1, 0, 0 },
110 { 0, 0, 0, 1, 0, 0 },
111 { 0, 0, 0, 1, 0, 0 },
112 { 0, 1, 0, 1, 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 { 1, 1, 0, 0, 0, 0 },
118 { 0, 0, 0, 1, 0, 0 },
119 { 0, 0, 0, 1, 0, 0 },
120 { 1, 1, 0, 1, 0, 0 },
121 { 0, 1, 0, 0, 0, 0 },
122 { 0, 0, 0, 1, 0, 0 },
123 { 0, 0, 0, 1, 0, 0 },
124 { 0, 0, 0, 1, 0, 0 },
125 { 0, 0, 0, 1, 0, 0 },
126 { 0, 0, 0, 1, 0, 0 },
127 { 0, 0, 0, 1, 0, 0 },
128 { 0, 0, 0, 1, 0, 0 },
129 { 0, 0, 0, 1, 0, 0 },
130 { 0, 0, 0, 1, 0, 0 },
131 { 0, 0, 0, 1, 0, 0 },
132 { 0, 0, 0, 1, 0, 0 },
133 { 0, 0, 0, 1, 0, 1 },
134 { 0, 0, 0, 1, 0, 0 },
135 { 0, 0, 0, 1, 0, 0 },
136 },
137
138
139 {
140 { 1, 1, 0, 0, 0, 0 },
141 { 0, 1, 1, 1, 0, 0 },
142 { 0, 1, 0, 1, 0, 0 },
143 { 0, 0, 0, 1, 0, 0 },
144 { 0, 1, 0, 1, 0, 0 },
145 { 0, 0, 0, 1, 0, 0 },
146 { 0, 0, 0, 1, 0, 0 },
147 { 0, 0, 0, 1, 0, 0 },
148 { 0, 0, 0, 1, 0, 0 },
149 { 1, 1, 0, 0, 0, 0 },
150 { 1, 1, 0, 1, 0, 0 },
151 { 0, 0, 1, 1, 0, 0 },
152 { 0, 0, 0, 1, 0, 0 },
153 { 0, 0, 0, 1, 0, 0 },
154 { 0, 1, 0, 0, 0, 0 },
155 { 0, 1, 0, 1, 0, 0 },
156#if defined(CONFIG_SYS_I2C_SOFT)
157 { 1, 0, 0, 1, 1, 1 },
158 { 1, 0, 0, 1, 1, 1 },
159#else
160#if defined(CONFIG_HARD_I2C)
161 { 1, 1, 1, 0, 1, 0 },
162 { 1, 1, 1, 0, 1, 0 },
163#else
164 { 0, 1, 1, 0, 1, 0 },
165 { 0, 1, 1, 0, 1, 0 },
166#endif
167#endif
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 { 0, 1, 0, 1, 0, 0 },
173 { 0, 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 { 1, 1, 1, 0, 0, 0 },
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
189int checkboard (void)
190{
191 puts ("Board: PM828\n");
192 return 0;
193}
194
195
196
197
198
199
200
201
202
203
204
205static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
206 ulong orx, volatile uchar * base)
207{
208 volatile uchar c = 0xff;
209 volatile ulong cnt, val;
210 volatile ulong *addr;
211 volatile uint *sdmr_ptr;
212 volatile uint *orx_ptr;
213 int i;
214 ulong save[32];
215 ulong maxsize;
216
217
218
219
220
221
222 maxsize = (1 + (~orx | 0x7fff)) / 2;
223
224 sdmr_ptr = &memctl->memc_psdmr;
225 orx_ptr = &memctl->memc_or2;
226
227 *orx_ptr = orx;
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249 *sdmr_ptr = sdmr | PSDMR_OP_PREA;
250 *base = c;
251
252 *sdmr_ptr = sdmr | PSDMR_OP_CBRR;
253 for (i = 0; i < 8; i++)
254 *base = c;
255
256 *sdmr_ptr = sdmr | PSDMR_OP_MRW;
257 *(base + CONFIG_SYS_MRS_OFFS) = c;
258
259 *sdmr_ptr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN;
260 *base = c;
261
262
263
264
265
266
267
268
269 i = 0;
270 for (cnt = maxsize / sizeof (long); cnt > 0; cnt >>= 1) {
271 addr = (volatile ulong *) base + cnt;
272 save[i++] = *addr;
273 *addr = ~cnt;
274 }
275
276 addr = (volatile ulong *) base;
277 save[i] = *addr;
278 *addr = 0;
279
280 if ((val = *addr) != 0) {
281 *addr = save[i];
282 return (0);
283 }
284
285 for (cnt = 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
286 addr = (volatile ulong *) base + cnt;
287 val = *addr;
288 *addr = save[--i];
289 if (val != ~cnt) {
290
291
292 *orx_ptr = orx | ~(cnt * sizeof (long) - 1);
293 return (cnt * sizeof (long));
294 }
295 }
296 return (maxsize);
297}
298
299
300phys_size_t initdram (int board_type)
301{
302 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
303 volatile memctl8260_t *memctl = &immap->im_memctl;
304
305#ifndef CONFIG_SYS_RAMBOOT
306 ulong size8, size9;
307#endif
308 ulong psize = 32 * 1024 * 1024;
309
310 memctl->memc_psrt = CONFIG_SYS_PSRT;
311 memctl->memc_mptpr = CONFIG_SYS_MPTPR;
312
313#ifndef CONFIG_SYS_RAMBOOT
314 size8 = try_init (memctl, CONFIG_SYS_PSDMR_8COL, CONFIG_SYS_OR2_8COL,
315 (uchar *) CONFIG_SYS_SDRAM_BASE);
316 size9 = try_init (memctl, CONFIG_SYS_PSDMR_9COL, CONFIG_SYS_OR2_9COL,
317 (uchar *) CONFIG_SYS_SDRAM_BASE);
318
319 if (size8 < size9) {
320 psize = size9;
321 printf ("(60x:9COL) ");
322 } else {
323 psize = try_init (memctl, CONFIG_SYS_PSDMR_8COL, CONFIG_SYS_OR2_8COL,
324 (uchar *) CONFIG_SYS_SDRAM_BASE);
325 printf ("(60x:8COL) ");
326 }
327#endif
328 return (psize);
329}
330
331#if defined(CONFIG_CMD_DOC)
332void doc_init (void)
333{
334 doc_probe (CONFIG_SYS_DOC_BASE);
335}
336#endif
337
338#ifdef CONFIG_PCI
339struct pci_controller hose;
340
341extern void pci_mpc8250_init(struct pci_controller *);
342
343void pci_init_board(void)
344{
345 pci_mpc8250_init(&hose);
346}
347#endif
348
349int board_eth_init(bd_t *bis)
350{
351 return pci_eth_init(bis);
352}
353