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
28
29#include <common.h>
30#include <mpc8xx.h>
31
32#define CONFIG_SYS_PA7 0x0100
33
34
35
36static long int dram_size (long int, long int *, long int);
37
38
39
40#define _NOT_USED_ 0xFFFFFFFF
41
42const uint sdram_table[] = {
43
44
45
46 0x1F0DFC04, 0xEEAFBC04, 0x11AF7C04, 0xEFBEEC00,
47 0x1FFDDC47,
48
49
50
51
52
53
54
55
56 0x1FFDDC34, 0xEFEEAC34, 0x1FBD5C35,
57
58
59
60 0x1F0DFC04, 0xEEAFBC04, 0x10AF7C04, 0xF0AFFC00,
61 0xF0AFFC00, 0xF1AFFC00, 0xEFBEEC00, 0x1FFDDC47,
62 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
63 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
64
65
66
67 0x1F2DFC04, 0xEEAFAC00, 0x01BE4C04, 0x1FFDDC47,
68 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
69
70
71
72 0x1F0DFC04, 0xEEAFAC00, 0x10AF5C00, 0xF0AFFC00,
73 0xF0AFFC00, 0xE1BEEC04, 0x1FFDDC47,
74 _NOT_USED_,
75 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
76 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
77
78
79
80 0x1FFD7C84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04,
81 0xFFFFFC84, 0xFFFFFC07,
82 _NOT_USED_, _NOT_USED_,
83 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
84
85
86
87 0x7FFFFC07,
88 _NOT_USED_, _NOT_USED_, _NOT_USED_,
89};
90
91
92
93
94
95
96
97
98int checkboard (void)
99{
100 puts ("Board: GenieTV\n");
101 return 0;
102}
103
104#if 0
105static void PrintState (void)
106{
107 volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
108 volatile memctl8xx_t *memctl = &im->im_memctl;
109
110 printf ("\n0 - FLASH: B=%08x O=%08x", memctl->memc_br0,
111 memctl->memc_or0);
112 printf ("\n1 - SDRAM: B=%08x O=%08x", memctl->memc_br1,
113 memctl->memc_or1);
114 printf ("\n2 - SDRAM: B=%08x O=%08x", memctl->memc_br2,
115 memctl->memc_or2);
116}
117#endif
118
119
120
121phys_size_t initdram (int board_type)
122{
123 volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
124 volatile memctl8xx_t *memctl = &im->im_memctl;
125 long int size_b0, size_b1, size8;
126
127
128
129
130 im->im_ioport.iop_papar &= ~CONFIG_SYS_PA7;
131 im->im_ioport.iop_padir |= CONFIG_SYS_PA7;
132
133
134 im->im_ioport.iop_padat |= CONFIG_SYS_PA7;
135
136
137
138
139
140
141
142 memctl->memc_mptpr = CONFIG_SYS_MPTPR_2BK_4K;
143
144 memctl->memc_mbmr = CONFIG_SYS_MBMR_8COL;
145
146 upmconfig (UPMB, (uint *) sdram_table,
147 sizeof (sdram_table) / sizeof (uint));
148
149
150
151
152
153
154
155 memctl->memc_or1 = 0xF0000000 | CONFIG_SYS_OR_TIMING_SDRAM;
156 memctl->memc_br1 =
157 ((SDRAM_BASE1_PRELIM & BR_BA_MSK) | BR_MS_UPMB | BR_V);
158
159 memctl->memc_or2 = 0xF0000000 | CONFIG_SYS_OR_TIMING_SDRAM;
160 memctl->memc_br2 =
161 ((SDRAM_BASE2_PRELIM & BR_BA_MSK) | BR_MS_UPMB | BR_V);
162
163
164 memctl->memc_mar = 0x00000088;
165
166 memctl->memc_mcr = 0x80802105;
167
168 memctl->memc_mcr = 0x80804105;
169
170
171 memctl->memc_mbmr = (CONFIG_SYS_MBMR_8COL & ~MBMR_TLFB_MSK) | MBMR_TLFB_8X;
172
173 memctl->memc_mcr = 0x80802130;
174
175 memctl->memc_mcr = 0x80804130;
176
177
178 memctl->memc_mbmr = CONFIG_SYS_MBMR_8COL;
179
180
181
182
183
184
185
186#if 0
187 PrintState ();
188#endif
189
190 size8 = dram_size (CONFIG_SYS_MBMR_8COL, (long *) SDRAM_BASE1_PRELIM,
191 SDRAM_MAX_SIZE);
192
193 size_b0 = size8;
194
195
196 size_b1 =
197 dram_size (memctl->memc_mbmr, (long *) SDRAM_BASE2_PRELIM,
198 SDRAM_MAX_SIZE);
199
200
201
202
203
204 memctl->memc_or1 = ((-size_b0) & 0xFFFF0000) | CONFIG_SYS_OR_TIMING_SDRAM;
205 memctl->memc_br1 = (CONFIG_SYS_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMB | BR_V;
206
207 if (size_b1 > 0) {
208
209
210
211 memctl->memc_or2 =
212 ((-size_b1) & 0xFFFF0000) | CONFIG_SYS_OR_TIMING_SDRAM;
213 memctl->memc_br2 =
214 ((CONFIG_SYS_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMB | BR_V) +
215 (size_b0 & BR_BA_MSK);
216 } else {
217
218
219
220
221
222 memctl->memc_br2 = 0;
223
224 memctl->memc_mptpr = CONFIG_SYS_MPTPR_1BK_4K;
225 }
226
227
228 if ((size_b0 + size_b1) == 0) {
229 printf ("disabling SDRAM!\n");
230
231 im->im_ioport.iop_padat &= ~CONFIG_SYS_PA7;
232 }
233
234
235
236#if 0
237 PrintState ();
238#endif
239 return (size_b0 + size_b1);
240}
241
242
243
244
245
246
247
248
249
250
251
252static long int dram_size (long int mbmr_value, long int *base,
253 long int maxsize)
254{
255 long size;
256
257
258
259 size = get_ram_size (base, maxsize);
260
261 if (size) {
262
263 } else {
264 printf ("(0)");
265 }
266
267 return (size);
268}
269
270#if defined(CONFIG_CMD_PCMCIA)
271
272#ifdef CONFIG_SYS_PCMCIA_MEM_ADDR
273volatile unsigned char *pcmcia_mem = (unsigned char *) CONFIG_SYS_PCMCIA_MEM_ADDR;
274#endif
275
276int pcmcia_init (void)
277{
278 volatile pcmconf8xx_t *pcmp;
279 uint v, slota, slotb;
280
281
282
283
284 pcmp = (pcmconf8xx_t *) (&(((immap_t *) CONFIG_SYS_IMMR)->im_pcmcia));
285
286#if 0
287 pcmp->pcmc_pbr0 = CONFIG_SYS_PCMCIA_MEM_ADDR;
288 pcmp->pcmc_por0 = 0xc00ff05d;
289#endif
290
291
292 pcmp->pcmc_pgcra = 0;
293 pcmp->pcmc_pgcrb = 0;
294#ifdef PCMCIA_SLOT_A
295 pcmp->pcmc_pgcra = 0x40;
296#endif
297#ifdef PCMCIA_SLOT_B
298 pcmp->pcmc_pgcrb = 0x40;
299#endif
300
301
302 slota = (pcmp->pcmc_pipr & 0x18000000) == 0;
303 slotb = (pcmp->pcmc_pipr & 0x00001800) == 0;
304
305 if (!(slota || slotb)) {
306 printf ("No card present\n");
307#ifdef PCMCIA_SLOT_A
308 pcmp->pcmc_pgcra = 0;
309#endif
310#ifdef PCMCIA_SLOT_B
311 pcmp->pcmc_pgcrb = 0;
312#endif
313 return -1;
314 } else
315 printf ("Unknown card (");
316
317 v = 0;
318
319 switch ((pcmp->pcmc_pipr >> 14) & 3) {
320 case 0x00:
321 printf ("5V");
322 v = 5;
323 break;
324 case 0x01:
325 printf ("5V and 3V");
326 v = 3;
327 break;
328 case 0x03:
329 printf ("5V, 3V and x.xV");
330 v = 3;
331 break;
332 }
333
334 switch (v) {
335 case 3:
336 printf ("; using 3V");
337
338
339 break;
340
341 default:
342 printf ("; unknown voltage");
343 return -1;
344 }
345 printf (")\n");
346
347
348 udelay (20);
349
350 pcmp->pcmc_pgcrb = 0;
351
352
353
354#ifdef CONFIG_DISK_SPINUP_TIME
355 udelay (CONFIG_DISK_SPINUP_TIME);
356#endif
357
358 return 0;
359}
360#endif
361