5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 /* ------------------------------------------------------------------------- */
31 #define _NOT_USED_ 0xFFFFFFFF
33 #if defined(CONFIG_DRAM_50MHZ)
35 const uint dram_60ns[] =
36 { 0x8fffec24, 0x0fffec04, 0x0cffec04, 0x00ffec04,
37 0x00ffec00, 0x37ffec47, 0xffffffff, 0xffffffff,
38 0x8fffec24, 0x0fffec04, 0x08ffec04, 0x00ffec0c,
39 0x03ffec00, 0x00ffec44, 0x00ffcc08, 0x0cffcc44,
40 0x00ffec0c, 0x03ffec00, 0x00ffec44, 0x00ffcc00,
41 0x3fffc847, 0xffffffff, 0xffffffff, 0xffffffff,
42 0x8fafcc24, 0x0fafcc04, 0x0cafcc00, 0x11bfcc47,
43 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
44 0x8fafcc24, 0x0fafcc04, 0x0cafcc00, 0x03afcc4c,
45 0x0cafcc00, 0x03afcc4c, 0x0cafcc00, 0x03afcc4c,
46 0x0cafcc00, 0x33bfcc4f, 0xffffffff, 0xffffffff,
47 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
48 0xc0ffcc84, 0x00ffcc04, 0x07ffcc04, 0x3fffcc06,
49 0xffffcc85, 0xffffcc05, 0xffffffff, 0xffffffff,
50 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
51 0x33ffcc07, 0xffffffff, 0xffffffff, 0xffffffff };
53 const uint dram_70ns[] =
54 { 0x8fffcc24, 0x0fffcc04, 0x0cffcc04, 0x00ffcc04,
55 0x00ffcc00, 0x37ffcc47, 0xffffffff, 0xffffffff,
56 0x8fffcc24, 0x0fffcc04, 0x0cffcc04, 0x00ffcc04,
57 0x00ffcc08, 0x0cffcc44, 0x00ffec0c, 0x03ffec00,
58 0x00ffec44, 0x00ffcc08, 0x0cffcc44, 0x00ffec04,
59 0x00ffec00, 0x3fffec47, 0xffffffff, 0xffffffff,
60 0x8fafcc24, 0x0fafcc04, 0x0cafcc00, 0x11bfcc47,
61 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
62 0x8fafcc24, 0x0fafcc04, 0x0cafcc00, 0x03afcc4c,
63 0x0cafcc00, 0x03afcc4c, 0x0cafcc00, 0x03afcc4c,
64 0x0cafcc00, 0x33bfcc4f, 0xffffffff, 0xffffffff,
65 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
66 0xe0ffcc84, 0x00ffcc04, 0x00ffcc04, 0x0fffcc04,
67 0x7fffcc06, 0xffffcc85, 0xffffcc05, 0xffffffff,
68 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
69 0x33ffcc07, 0xffffffff, 0xffffffff, 0xffffffff };
71 const uint edo_60ns[] =
72 { 0x8ffbec24, 0x0ff3ec04, 0x0cf3ec04, 0x00f3ec04,
73 0x00f3ec00, 0x37f7ec47, 0xffffffff, 0xffffffff,
74 0x8fffec24, 0x0ffbec04, 0x0cf3ec04, 0x00f3ec0c,
75 0x0cf3ec00, 0x00f3ec4c, 0x0cf3ec00, 0x00f3ec4c,
76 0x0cf3ec00, 0x00f3ec44, 0x03f3ec00, 0x3ff7ec47,
77 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
78 0x8fffcc24, 0x0fefcc04, 0x0cafcc00, 0x11bfcc47,
79 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
80 0x8fffcc24, 0x0fefcc04, 0x0cafcc00, 0x03afcc4c,
81 0x0cafcc00, 0x03afcc4c, 0x0cafcc00, 0x03afcc4c,
82 0x0cafcc00, 0x33bfcc4f, 0xffffffff, 0xffffffff,
83 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
84 0xc0ffcc84, 0x00ffcc04, 0x07ffcc04, 0x3fffcc06,
85 0xffffcc85, 0xffffcc05, 0xffffffff, 0xffffffff,
86 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
87 0x33ffcc07, 0xffffffff, 0xffffffff, 0xffffffff };
89 const uint edo_70ns[] =
90 { 0x8ffbcc24, 0x0ff3cc04, 0x0cf3cc04, 0x00f3cc04,
91 0x00f3cc00, 0x37f7cc47, 0xffffffff, 0xffffffff,
92 0x8fffcc24, 0x0ffbcc04, 0x0cf3cc04, 0x00f3cc0c,
93 0x03f3cc00, 0x00f3cc44, 0x00f3ec0c, 0x0cf3ec00,
94 0x00f3ec4c, 0x03f3ec00, 0x00f3ec44, 0x00f3cc00,
95 0x33f7cc47, 0xffffffff, 0xffffffff, 0xffffffff,
96 0x8fffcc24, 0x0fefcc04, 0x0cafcc00, 0x11bfcc47,
97 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
98 0x8fffcc24, 0x0fefcc04, 0x0cafcc00, 0x03afcc4c,
99 0x0cafcc00, 0x03afcc4c, 0x0cafcc00, 0x03afcc4c,
100 0x0cafcc00, 0x33bfcc47, 0xffffffff, 0xffffffff,
101 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
102 0xe0ffcc84, 0x00ffcc04, 0x00ffcc04, 0x0fffcc04,
103 0x7fffcc04, 0xffffcc86, 0xffffcc05, 0xffffffff,
104 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
105 0x33ffcc07, 0xffffffff, 0xffffffff, 0xffffffff };
107 #elif defined(CONFIG_DRAM_25MHZ)
111 const uint dram_60ns[] =
112 { 0x0fffcc04, 0x08ffcc00, 0x33ffcc47, 0xffffffff,
113 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
114 0x0fffcc24, 0x0fffcc04, 0x08ffcc00, 0x03ffcc4c,
115 0x08ffcc00, 0x03ffcc4c, 0x08ffcc00, 0x03ffcc4c,
116 0x08ffcc00, 0x33ffcc47, 0xffffffff, 0xffffffff,
117 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
118 0x0fafcc04, 0x08afcc00, 0x3fbfcc47, 0xffffffff,
119 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
120 0x0fafcc04, 0x0cafcc00, 0x01afcc4c, 0x0cafcc00,
121 0x01afcc4c, 0x0cafcc00, 0x01afcc4c, 0x0cafcc00,
122 0x31bfcc43, 0xffffffff, 0xffffffff, 0xffffffff,
123 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
124 0x80ffcc84, 0x13ffcc04, 0xffffcc87, 0xffffcc05,
125 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
126 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
127 0x33ffcc07, 0xffffffff, 0xffffffff, 0xffffffff };
129 const uint dram_70ns[] =
130 { 0x0fffec04, 0x08ffec04, 0x00ffec00, 0x3fffcc47,
131 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
132 0x0fffcc24, 0x0fffcc04, 0x08ffcc00, 0x03ffcc4c,
133 0x08ffcc00, 0x03ffcc4c, 0x08ffcc00, 0x03ffcc4c,
134 0x08ffcc00, 0x33ffcc47, 0xffffffff, 0xffffffff,
135 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
136 0x0fafcc04, 0x08afcc00, 0x3fbfcc47, 0xffffffff,
137 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
138 0x0fafcc04, 0x0cafcc00, 0x01afcc4c, 0x0cafcc00,
139 0x01afcc4c, 0x0cafcc00, 0x01afcc4c, 0x0cafcc00,
140 0x31bfcc43, 0xffffffff, 0xffffffff, 0xffffffff,
141 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
142 0xc0ffcc84, 0x01ffcc04, 0x7fffcc86, 0xffffcc05,
143 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
144 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
145 0x33ffcc07, 0xffffffff, 0xffffffff, 0xffffffff };
147 const uint edo_60ns[] =
148 { 0x0ffbcc04, 0x0cf3cc04, 0x00f3cc00, 0x33f7cc47,
149 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
150 0x0ffbcc04, 0x09f3cc0c, 0x09f3cc0c, 0x09f3cc0c,
151 0x08f3cc00, 0x3ff7cc47, 0xffffffff, 0xffffffff,
152 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
153 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
154 0x0fefcc04, 0x08afcc04, 0x00afcc00, 0x3fbfcc47,
155 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
156 0x0fefcc04, 0x08afcc00, 0x07afcc48, 0x08afcc48,
157 0x08afcc48, 0x39bfcc47, 0xffffffff, 0xffffffff,
158 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
159 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
160 0x80ffcc84, 0x13ffcc04, 0xffffcc87, 0xffffcc05,
161 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
162 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
163 0x33ffcc07, 0xffffffff, 0xffffffff, 0xffffffff };
165 const uint edo_70ns[] =
166 { 0x0ffbcc04, 0x0cf3cc04, 0x00f3cc00, 0x33f7cc47,
167 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
168 0x0ffbec04, 0x08f3ec04, 0x03f3ec48, 0x08f3cc00,
169 0x0ff3cc4c, 0x08f3cc00, 0x0ff3cc4c, 0x08f3cc00,
170 0x3ff7cc47, 0xffffffff, 0xffffffff, 0xffffffff,
171 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
172 0x0fefcc04, 0x08afcc04, 0x00afcc00, 0x3fbfcc47,
173 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
174 0x0fefcc04, 0x08afcc00, 0x07afcc4c, 0x08afcc00,
175 0x07afcc4c, 0x08afcc00, 0x07afcc4c, 0x08afcc00,
176 0x37bfcc47, 0xffffffff, 0xffffffff, 0xffffffff,
177 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
178 0xc0ffcc84, 0x01ffcc04, 0x7fffcc86, 0xffffcc05,
179 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
180 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
181 0x33ffcc07, 0xffffffff, 0xffffffff, 0xffffffff };
185 #error dram not correct defined - use CONFIG_DRAM_25MHZ or CONFIG_DRAM_50MHZ
188 /* ------------------------------------------------------------------------- */
192 * Check Board Identity:
195 int checkboard (void)
202 k = (*((uint *)BCSR3) >> 24) & 0x3f;
217 printf("unknown board (0x%02x)\n", k);
234 puts ("MPC821, MPC860 / MPC860SAR / MPC860T");
249 k = (((*((uint *)BCSR3) >> 23) & 1) << 3)
250 | (((*((uint *)BCSR3) >> 19) & 1) << 2)
251 | (((*((uint *)BCSR3) >> 16) & 3));
255 puts ("ENG or PILOT\n");
259 printf("unknown (0x%x)\n", k);
264 #endif /* CONFIG_FADS */
269 k = (((*((uint *)BCSR3) >> 23) & 1) << 3)
270 | (((*((uint *)BCSR3) >> 19) & 1) << 2)
271 | (((*((uint *)BCSR3) >> 16) & 3));
274 case 0x00 : puts ("ENG - this board sucks, check the errata, not supported\n");
276 case 0x01 : puts ("PILOT - warning, read errata \n"); break;
277 case 0x02 : puts ("A - warning, read errata \n"); break;
278 case 0x03 : puts ("B \n"); break;
279 default : printf ("unknown revision (0x%x)\n", k); return -1;
283 #endif /* CONFIG_ADS */
287 /* ------------------------------------------------------------------------- */
288 int _draminit(uint base, uint noMbytes, uint edo, uint delay)
290 volatile immap_t *immap = (immap_t *)CFG_IMMR;
291 volatile memctl8xx_t *memctl = &immap->im_memctl;
301 upmconfig(UPMA, (uint *) edo_70ns, sizeof(edo_70ns)/sizeof(uint));
305 upmconfig(UPMA, (uint *) dram_70ns, sizeof(dram_70ns)/sizeof(uint));
315 upmconfig(UPMA, (uint *) edo_60ns, sizeof(edo_60ns)/sizeof(uint));
319 upmconfig(UPMA, (uint *) dram_60ns, sizeof(dram_60ns)/sizeof(uint));
329 memctl->memc_mptpr = 0x0400; /* divide by 16 */
334 case 8: /* 8 Mbyte uses both CS3 and CS2 */
336 memctl->memc_mamr = 0x13a01114;
337 memctl->memc_or3 = 0xffc00800;
338 memctl->memc_br3 = 0x00400081 + base;
339 memctl->memc_or2 = 0xffc00800;
343 case 4: /* 4 Mbyte uses only CS2 */
345 memctl->memc_mamr = 0x13a01114;
346 memctl->memc_or2 = 0xffc00800;
350 case 32: /* 32 Mbyte uses both CS3 and CS2 */
352 memctl->memc_mamr = 0x13b01114;
353 memctl->memc_or3 = 0xff000800;
354 memctl->memc_br3 = 0x01000081 + base;
355 memctl->memc_or2 = 0xff000800;
359 case 16: /* 16 Mbyte uses only CS2 */
362 memctl->memc_mamr = 0x60b21114;
364 memctl->memc_mamr = 0x13b01114;
366 memctl->memc_or2 = 0xff000800;
374 memctl->memc_br2 = 0x81 + base; /* use upma */
378 /* ------------------------------------------------------------------------- */
380 void _dramdisable(void)
382 volatile immap_t *immap = (immap_t *)CFG_IMMR;
383 volatile memctl8xx_t *memctl = &immap->im_memctl;
385 memctl->memc_br2 = 0x00000000;
386 memctl->memc_br3 = 0x00000000;
388 /* maybe we should turn off upma here or something */
391 #if defined(CONFIG_SDRAM_100MHZ)
393 /* ------------------------------------------------------------------------- */
394 /* sdram table by Dan Malek */
396 /* This has the stretched early timing so the 50 MHz
397 * processor can make the 100 MHz timing. This will
398 * work at all processor speeds.
401 #define SDRAM_MPTPRVALUE 0x0400
403 #define SDRAM_MBMRVALUE0 0xc3802114 /* (16-14) 50 MHz */
404 #define SDRAM_MBMRVALUE1 SDRAM_MBMRVALUE0
406 #define SDRAM_OR4VALUE 0xffc00a00
407 #define SDRAM_BR4VALUE 0x000000c1 /* base address will be or:ed on */
409 #define SDRAM_MARVALUE 0x88
411 #define SDRAM_MCRVALUE0 0x80808111 /* run pattern 0x11 */
412 #define SDRAM_MCRVALUE1 SDRAM_MCRVALUE0
415 const uint sdram_table[] =
417 /* single read. (offset 0 in upm RAM) */
418 0xefebfc24, 0x1f07fc24, 0xeeaefc04, 0x11adfc04,
419 0xefbbbc00, 0x1ff77c45, 0xffffffff, 0xffffffff,
421 /* burst read. (offset 8 in upm RAM) */
422 0xefebfc24, 0x1f07fc24, 0xeeaefc04, 0x10adfc04,
423 0xf0affc00, 0xf0affc00, 0xf1affc00, 0xefbbbc00,
424 0x1ff77c45, 0xeffbbc04, 0x1ff77c34, 0xefeabc34,
425 0x1fb57c35, 0xffffffff, 0xffffffff, 0xffffffff,
427 /* single write. (offset 18 in upm RAM) */
428 0xefebfc24, 0x1f07fc24, 0xeeaebc00, 0x01b93c04,
429 0x1ff77c45, 0xffffffff, 0xffffffff, 0xffffffff,
431 /* burst write. (offset 20 in upm RAM) */
432 0xefebfc24, 0x1f07fc24, 0xeeaebc00, 0x10ad7c00,
433 0xf0affc00, 0xf0affc00, 0xe1bbbc04, 0x1ff77c45,
434 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
435 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
437 /* refresh. (offset 30 in upm RAM) */
438 0xeffafc84, 0x1ff5fc04, 0xfffffc04, 0xfffffc04,
439 0xfffffc84, 0xfffffc07, 0xffffffff, 0xffffffff,
440 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
442 /* exception. (offset 3c in upm RAM) */
443 0xeffffc06, 0x1ffffc07, 0xffffffff, 0xffffffff };
445 #elif defined(CONFIG_SDRAM_50MHZ)
447 /* ------------------------------------------------------------------------- */
448 /* sdram table stolen from the fads manual */
449 /* for chip MB811171622A-100 */
451 /* this table is for 32-50MHz operation */
453 #define _not_used_ 0xffffffff
455 #define SDRAM_MPTPRVALUE 0x0400
457 #define SDRAM_MBMRVALUE0 0x80802114 /* refresh at 32MHz */
458 #define SDRAM_MBMRVALUE1 0x80802118
460 #define SDRAM_OR4VALUE 0xffc00a00
461 #define SDRAM_BR4VALUE 0x000000c1 /* base address will be or:ed on */
463 #define SDRAM_MARVALUE 0x88
465 #define SDRAM_MCRVALUE0 0x80808105
466 #define SDRAM_MCRVALUE1 0x80808130
468 const uint sdram_table[] =
470 /* single read. (offset 0 in upm RAM) */
471 0x1f07fc04, 0xeeaefc04, 0x11adfc04, 0xefbbbc00,
474 /* MRS initialization (offset 5) */
476 0x1ff77c34, 0xefeabc34, 0x1fb57c35,
478 /* burst read. (offset 8 in upm RAM) */
479 0x1f07fc04, 0xeeaefc04, 0x10adfc04, 0xf0affc00,
480 0xf0affc00, 0xf1affc00, 0xefbbbc00, 0x1ff77c47,
481 _not_used_, _not_used_, _not_used_, _not_used_,
482 _not_used_, _not_used_, _not_used_, _not_used_,
484 /* single write. (offset 18 in upm RAM) */
485 0x1f27fc04, 0xeeaebc00, 0x01b93c04, 0x1ff77c47,
486 _not_used_, _not_used_, _not_used_, _not_used_,
488 /* burst write. (offset 20 in upm RAM) */
489 0x1f07fc04, 0xeeaebc00, 0x10ad7c00, 0xf0affc00,
490 0xf0affc00, 0xe1bbbc04, 0x1ff77c47, _not_used_,
491 _not_used_, _not_used_, _not_used_, _not_used_,
492 _not_used_, _not_used_, _not_used_, _not_used_,
494 /* refresh. (offset 30 in upm RAM) */
495 0x1ff5fc84, 0xfffffc04, 0xfffffc04, 0xfffffc04,
496 0xfffffc84, 0xfffffc07, _not_used_, _not_used_,
497 _not_used_, _not_used_, _not_used_, _not_used_,
499 /* exception. (offset 3c in upm RAM) */
500 0x7ffffc07, _not_used_, _not_used_, _not_used_ };
502 /* ------------------------------------------------------------------------- */
504 #error SDRAM not correctly configured
507 int _initsdram(uint base, uint noMbytes)
509 volatile immap_t *immap = (immap_t *)CFG_IMMR;
510 volatile memctl8xx_t *memctl = &immap->im_memctl;
517 upmconfig(UPMB, (uint *)sdram_table,sizeof(sdram_table)/sizeof(uint));
519 memctl->memc_mptpr = SDRAM_MPTPRVALUE;
521 /* Configure the refresh (mostly). This needs to be
522 * based upon processor clock speed and optimized to provide
523 * the highest level of performance. For multiple banks,
524 * this time has to be divided by the number of banks.
525 * Although it is not clear anywhere, it appears the
526 * refresh steps through the chip selects for this UPM
527 * on each refresh cycle.
528 * We have to be careful changing
529 * UPM registers after we ask it to run these commands.
532 memctl->memc_mbmr = SDRAM_MBMRVALUE0;
533 memctl->memc_mar = SDRAM_MARVALUE; /* MRS code */
537 /* Now run the precharge/nop/mrs commands.
540 memctl->memc_mcr = 0x80808111; /* run pattern 0x11 */
544 /* Run 8 refresh cycles */
546 memctl->memc_mcr = SDRAM_MCRVALUE0;
550 memctl->memc_mbmr = SDRAM_MBMRVALUE1;
551 memctl->memc_mcr = SDRAM_MCRVALUE1;
555 memctl->memc_mbmr = SDRAM_MBMRVALUE0;
557 memctl->memc_or4 = SDRAM_OR4VALUE;
558 memctl->memc_br4 = SDRAM_BR4VALUE | base;
563 /* ------------------------------------------------------------------------- */
565 void _sdramdisable(void)
567 volatile immap_t *immap = (immap_t *)CFG_IMMR;
568 volatile memctl8xx_t *memctl = &immap->im_memctl;
570 memctl->memc_br4 = 0x00000000;
572 /* maybe we should turn off upmb here or something */
575 /* ------------------------------------------------------------------------- */
577 int initsdram(uint base, uint *noMbytes)
581 *((uint *)BCSR1) |= BCSR1_SDRAM_EN; /* enable sdram */
582 /* _fads_sdraminit needs access to sdram */
585 if(!_initsdram(base, m))
592 *((uint *)BCSR1) &= ~BCSR1_SDRAM_EN; /* disable sdram */
600 long int initdram (int board_type)
603 /* ADS: has no SDRAM, so start DRAM at 0 */
604 uint base = (unsigned long)0x0;
606 /* FADS: has 4MB SDRAM, put DRAM above it */
607 uint base = (unsigned long)0x00400000;
611 k = (*((uint *)BCSR2) >> 23) & 0x0f;
617 /* "MCM36100 / MT8D132X" */
622 /* "MCM36800 / MT16D832X" */
626 /* "MCM36400 / MT8D432X" */
630 /* "MCM36200 / MT16D832X ?" */
648 printf("unknown dramdelay (0x%x) - defaulting to 70 ns", k);
653 /* the FADS is missing this bit, all rams treated as non-edo */
656 s = (*((uint *)BCSR2) >> 27) & 0x01;
659 if(!_draminit(base, m, s, k))
664 *((uint *)BCSR1) &= ~BCSR1_DRAM_EN; /* enable dram */
667 if (!initsdram(0x00000000, &sdramsz)) {
669 printf("(%u MB SDRAM) ", sdramsz);
673 /********************************
674 *DRAM ERROR, HALT PROCESSOR
675 *********************************/
688 /********************************
689 *DRAM ERROR, HALT PROCESSOR
690 *********************************/
697 /* ------------------------------------------------------------------------- */
701 /* TODO: XXX XXX XXX */
702 printf ("test: 16 MB - ok\n");
708 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
710 #ifdef CFG_PCMCIA_MEM_ADDR
711 volatile unsigned char *pcmcia_mem = (unsigned char*)CFG_PCMCIA_MEM_ADDR;
714 int pcmcia_init(void)
716 volatile pcmconf8xx_t *pcmp;
717 uint v, slota, slotb;
720 ** Enable the PCMCIA for a Flash card.
722 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
725 pcmp->pcmc_pbr0 = CFG_PCMCIA_MEM_ADDR;
726 pcmp->pcmc_por0 = 0xc00ff05d;
729 /* Set all slots to zero by default. */
730 pcmp->pcmc_pgcra = 0;
731 pcmp->pcmc_pgcrb = 0;
733 pcmp->pcmc_pgcra = 0x40;
736 pcmp->pcmc_pgcrb = 0x40;
739 /* enable PCMCIA buffers */
740 *((uint *)BCSR1) &= ~BCSR1_PCCEN;
742 /* Check if any PCMCIA card is plugged in. */
744 slota = (pcmp->pcmc_pipr & 0x18000000) == 0 ;
745 slotb = (pcmp->pcmc_pipr & 0x00001800) == 0 ;
747 if (!(slota || slotb))
749 printf("No card present\n");
751 pcmp->pcmc_pgcra = 0;
754 pcmp->pcmc_pgcrb = 0;
759 printf("Card present (");
763 /* both the ADS and the FADS have a 5V keyed pcmcia connector (?)
765 ** Paolo - Yes, but i have to insert some 3.3V card in that slot on
769 #if defined(CONFIG_MPC860)
770 switch( (pcmp->pcmc_pipr >> 30) & 3 )
771 #elif defined(CONFIG_MPC823) || defined(CONFIG_MPC850)
772 switch( (pcmp->pcmc_pipr >> 14) & 3 )
782 v = 3; /* User lower voltage if supported! */
788 printf("5V, 3V and x.xV");
790 v = 3; /* User lower voltage if supported! */
800 printf("; using 3V");
802 ** Enable 3 volt Vcc.
804 *((uint *)BCSR1) &= ~BCSR1_PCCVCC1;
805 *((uint *)BCSR1) |= BCSR1_PCCVCC0;
809 printf("; using 5V");
812 ** Enable 5 volt Vcc.
814 *((uint *)BCSR1) &= ~BCSR1_PCCVCCON;
818 ** Enable 5 volt Vcc.
820 *((uint *)BCSR1) &= ~BCSR1_PCCVCC0;
821 *((uint *)BCSR1) |= BCSR1_PCCVCC1;
826 *((uint *)BCSR1) |= BCSR1_PCCEN; /* disable pcmcia */
828 printf("; unknown voltage");
832 /* disable pcmcia reset after a while */
837 pcmp->pcmc_pgcra = 0;
839 pcmp->pcmc_pgcrb = 0;
842 /* If you using a real hd you should give a short
844 #ifdef CONFIG_DISK_SPINUP_TIME
845 udelay(CONFIG_DISK_SPINUP_TIME);
851 #endif /* CFG_CMD_PCMCIA */
853 /* ------------------------------------------------------------------------- */
855 #ifdef CFG_PC_IDE_RESET
857 void ide_set_reset(int on)
859 volatile immap_t *immr = (immap_t *)CFG_IMMR;
862 * Configure PC for IDE Reset Pin
864 if (on) { /* assert RESET */
865 immr->im_ioport.iop_pcdat &= ~(CFG_PC_IDE_RESET);
866 } else { /* release RESET */
867 immr->im_ioport.iop_pcdat |= CFG_PC_IDE_RESET;
870 /* program port pin as GPIO output */
871 immr->im_ioport.iop_pcpar &= ~(CFG_PC_IDE_RESET);
872 immr->im_ioport.iop_pcso &= ~(CFG_PC_IDE_RESET);
873 immr->im_ioport.iop_pcdir |= CFG_PC_IDE_RESET;
876 #endif /* CFG_PC_IDE_RESET */
877 /* ------------------------------------------------------------------------- */