blob: c6309e321ad7a549e144b8916d1ca4e4ef0a7be1 [file] [log] [blame]
wdenk56523f12004-07-11 17:40:54 +00001/*
2 * (C) Copyright 2003-2004
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * (C) Copyright 2004
6 * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
7 *
wdenk8f0b7cb2005-03-27 23:41:39 +00008 * (C) Copyright 2004-2005
wdenk56523f12004-07-11 17:40:54 +00009 * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de
10 *
11 * See file CREDITS for list of people who contributed to this
12 * project.
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
wdenk81050922004-07-11 20:04:51 +000021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
wdenk56523f12004-07-11 17:40:54 +000022 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * MA 02111-1307 USA
28 */
29
30#include <common.h>
31#include <mpc5xxx.h>
32#include <pci.h>
33
wdenk8f0b7cb2005-03-27 23:41:39 +000034#ifdef CONFIG_VIDEO_SM501
35#include <sm501.h>
36#endif
37
wdenk56523f12004-07-11 17:40:54 +000038#if defined(CONFIG_MPC5200_DDR)
39#include "mt46v16m16-75.h"
40#else
41#include "mt48lc16m16a2-75.h"
42#endif
wdenk8f0b7cb2005-03-27 23:41:39 +000043
wdenk7e6bf352004-12-12 22:06:17 +000044#ifdef CONFIG_PS2MULT
45void ps2mult_early_init(void);
46#endif
wdenk56523f12004-07-11 17:40:54 +000047
48#ifndef CFG_RAMBOOT
49static void sdram_start (int hi_addr)
50{
51 long hi_addr_bit = hi_addr ? 0x01000000 : 0;
52
53 /* unlock mode register */
54 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 |
55 hi_addr_bit;
56 __asm__ volatile ("sync");
57
58 /* precharge all banks */
59 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
60 hi_addr_bit;
61 __asm__ volatile ("sync");
62
63#if SDRAM_DDR
64 /* set mode register: extended mode */
65 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE;
66 __asm__ volatile ("sync");
67
68 /* set mode register: reset DLL */
69 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000;
70 __asm__ volatile ("sync");
71#endif
72
73 /* precharge all banks */
74 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
75 hi_addr_bit;
76 __asm__ volatile ("sync");
77
78 /* auto refresh */
79 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 |
80 hi_addr_bit;
81 __asm__ volatile ("sync");
82
83 /* set mode register */
84 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
85 __asm__ volatile ("sync");
86
87 /* normal operation */
88 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
89 __asm__ volatile ("sync");
90}
91#endif
92
93/*
94 * ATTENTION: Although partially referenced initdram does NOT make real use
wdenk81050922004-07-11 20:04:51 +000095 * use of CFG_SDRAM_BASE. The code does not work if CFG_SDRAM_BASE
96 * is something else than 0x00000000.
wdenk56523f12004-07-11 17:40:54 +000097 */
98
99#if defined(CONFIG_MPC5200)
100long int initdram (int board_type)
101{
102 ulong dramsize = 0;
103 ulong dramsize2 = 0;
104#ifndef CFG_RAMBOOT
105 ulong test1, test2;
106
107 /* setup SDRAM chip selects */
108 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001c; /* 512MB at 0x0 */
109 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x40000000; /* disabled */
110 __asm__ volatile ("sync");
111
112 /* setup config registers */
113 *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
114 *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
115 __asm__ volatile ("sync");
116
117#if SDRAM_DDR
118 /* set tap delay */
119 *(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY;
120 __asm__ volatile ("sync");
121#endif
122
123 /* find RAM size using SDRAM CS0 only */
124 sdram_start(0);
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200125 test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x20000000);
wdenk56523f12004-07-11 17:40:54 +0000126 sdram_start(1);
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200127 test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x20000000);
wdenk56523f12004-07-11 17:40:54 +0000128 if (test1 > test2) {
129 sdram_start(0);
130 dramsize = test1;
131 } else {
132 dramsize = test2;
133 }
134
135 /* memory smaller than 1MB is impossible */
136 if (dramsize < (1 << 20)) {
137 dramsize = 0;
138 }
139
140 /* set SDRAM CS0 size according to the amount of RAM found */
141 if (dramsize > 0) {
142 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 +
143 __builtin_ffs(dramsize >> 20) - 1;
144 } else {
145 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
146 }
147
148 /* let SDRAM CS1 start right after CS0 */
149 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001c; /* 512MB */
150
151 /* find RAM size using SDRAM CS1 only */
152 sdram_start(0);
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200153 test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
wdenk56523f12004-07-11 17:40:54 +0000154 sdram_start(1);
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200155 test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
wdenk56523f12004-07-11 17:40:54 +0000156 if (test1 > test2) {
157 sdram_start(0);
158 dramsize2 = test1;
159 } else {
160 dramsize2 = test2;
161 }
162
163 /* memory smaller than 1MB is impossible */
164 if (dramsize2 < (1 << 20)) {
165 dramsize2 = 0;
166 }
167
168 /* set SDRAM CS1 size according to the amount of RAM found */
169 if (dramsize2 > 0) {
170 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize
171 | (0x13 + __builtin_ffs(dramsize2 >> 20) - 1);
172 } else {
173 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
174 }
175
176#else /* CFG_RAMBOOT */
177
178 /* retrieve size of memory connected to SDRAM CS0 */
179 dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
180 if (dramsize >= 0x13) {
181 dramsize = (1 << (dramsize - 0x13)) << 20;
182 } else {
183 dramsize = 0;
184 }
185
186 /* retrieve size of memory connected to SDRAM CS1 */
187 dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF;
188 if (dramsize2 >= 0x13) {
189 dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
190 } else {
191 dramsize2 = 0;
192 }
193
194#endif /* CFG_RAMBOOT */
195
196/* return dramsize + dramsize2; */
197 return dramsize;
198}
199
200#elif defined(CONFIG_MGT5100)
201
202long int initdram (int board_type)
203{
204 ulong dramsize = 0;
205#ifndef CFG_RAMBOOT
206 ulong test1, test2;
207
208 /* setup and enable SDRAM chip selects */
209 *(vu_long *)MPC5XXX_SDRAM_START = 0x00000000;
210 *(vu_long *)MPC5XXX_SDRAM_STOP = 0x0000ffff;/* 2G */
211 *(vu_long *)MPC5XXX_ADDECR |= (1 << 22); /* Enable SDRAM */
212 __asm__ volatile ("sync");
213
214 /* setup config registers */
215 *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
216 *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
217
218 /* address select register */
219 *(vu_long *)MPC5XXX_SDRAM_XLBSEL = SDRAM_ADDRSEL;
220 __asm__ volatile ("sync");
221
222 /* find RAM size */
223 sdram_start(0);
224 test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
225 sdram_start(1);
226 test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
227 if (test1 > test2) {
228 sdram_start(0);
229 dramsize = test1;
230 } else {
231 dramsize = test2;
232 }
233
234 /* set SDRAM end address according to size */
235 *(vu_long *)MPC5XXX_SDRAM_STOP = ((dramsize - 1) >> 15);
236
237#else /* CFG_RAMBOOT */
238
239 /* Retrieve amount of SDRAM available */
240 dramsize = ((*(vu_long *)MPC5XXX_SDRAM_STOP + 1) << 15);
241
242#endif /* CFG_RAMBOOT */
243
244 return dramsize;
245}
246
247#else
248#error Neither CONFIG_MPC5200 or CONFIG_MGT5100 defined
249#endif
250
251int checkboard (void)
252{
Wolfgang Denk8f79e4c2005-08-10 15:14:32 +0200253#if defined (CONFIG_AEVFIFO)
254 puts ("Board: AEVFIFO\n");
255 return 0;
256#endif
Wolfgang Denkcd65a3d2006-06-16 16:11:34 +0200257#if defined (CONFIG_TQM5200)
wdenk8f0b7cb2005-03-27 23:41:39 +0000258 puts ("Board: TQM5200 (TQ-Components GmbH)\n");
wdenk56523f12004-07-11 17:40:54 +0000259#endif
wdenk7e6bf352004-12-12 22:06:17 +0000260#if defined (CONFIG_STK52XX)
261 puts (" on a STK52XX baseboard\n");
262#endif
Wolfgang Denkb87dfd22006-07-19 13:50:38 +0200263#if defined (CONFIG_TB5200)
264 puts (" on a TB5200 baseboard\n");
265#endif
wdenk7e6bf352004-12-12 22:06:17 +0000266
wdenk56523f12004-07-11 17:40:54 +0000267 return 0;
268}
269
270void flash_preinit(void)
271{
272 /*
273 * Now, when we are in RAM, enable flash write
274 * access for detection process.
275 * Note that CS_BOOT cannot be cleared when
276 * executing in flash.
277 */
278#if defined(CONFIG_MGT5100)
279 *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 25); /* disable CS_BOOT */
280 *(vu_long *)MPC5XXX_ADDECR |= (1 << 16); /* enable CS0 */
281#endif
282 *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
283}
284
285
286#ifdef CONFIG_PCI
287static struct pci_controller hose;
288
289extern void pci_mpc5xxx_init(struct pci_controller *);
290
291void pci_init_board(void)
292{
293 pci_mpc5xxx_init(&hose);
294}
295#endif
296
297#if defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET)
298
299#if defined (CONFIG_MINIFAP)
300#define SM501_POWER_MODE0_GATE 0x00000040UL
301#define SM501_POWER_MODE1_GATE 0x00000048UL
302#define POWER_MODE_GATE_GPIO_PWM_I2C 0x00000040UL
303#define SM501_GPIO_DATA_DIR_HIGH 0x0001000CUL
304#define SM501_GPIO_DATA_HIGH 0x00010004UL
305#define SM501_GPIO_51 0x00080000UL
306#else
307#define GPIO_PSC1_4 0x01000000UL
308#endif
309
310void init_ide_reset (void)
311{
312 debug ("init_ide_reset\n");
313
314#if defined (CONFIG_MINIFAP)
315 /* Configure GPIO_51 of the SM501 grafic controller as ATA reset */
316
317 /* enable GPIO control (in both power modes) */
318 *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE0_GATE) |=
319 POWER_MODE_GATE_GPIO_PWM_I2C;
320 *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE1_GATE) |=
321 POWER_MODE_GATE_GPIO_PWM_I2C;
322 /* configure GPIO51 as output */
323 *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_HIGH) |=
324 SM501_GPIO_51;
325#else
326 /* Configure PSC1_4 as GPIO output for ATA reset */
327 *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
328 *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
329#endif
330}
331
332void ide_set_reset (int idereset)
333{
334 debug ("ide_reset(%d)\n", idereset);
335
336#if defined (CONFIG_MINIFAP)
337 if (idereset) {
338 *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
339 ~SM501_GPIO_51;
340 } else {
341 *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
342 SM501_GPIO_51;
343 }
344#else
345 if (idereset) {
346 *(vu_long *) MPC5XXX_WU_GPIO_DATA &= ~GPIO_PSC1_4;
347 } else {
348 *(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
349 }
350#endif
351}
352#endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */
353
354#ifdef CONFIG_POST
355/*
356 * Reads GPIO pin PSC6_3. A keypress is reported, if PSC6_3 is low. If PSC6_3
357 * is left open, no keypress is detected.
358 */
359int post_hotkeys_pressed(void)
360{
361 struct mpc5xxx_gpio *gpio;
362
363 gpio = (struct mpc5xxx_gpio*) MPC5XXX_GPIO;
364
365 /*
366 * Configure PSC6_1 and PSC6_3 as GPIO. PSC6 then couldn't be used in
367 * CODEC or UART mode. Consumer IrDA should still be possible.
wdenk81050922004-07-11 20:04:51 +0000368 */
wdenk56523f12004-07-11 17:40:54 +0000369 gpio->port_config &= ~(0x07000000);
370 gpio->port_config |= 0x03000000;
371
372 /* Enable GPIO for GPIO_IRDA_1 (IR_USB_CLK pin) = PSC6_3 */
373 gpio->simple_gpioe |= 0x20000000;
374
375 /* Configure GPIO_IRDA_1 as input */
376 gpio->simple_ddr &= ~(0x20000000);
377
378 return ((gpio->simple_ival & 0x20000000) ? 0 : 1);
379}
380#endif
381
382#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
383
384void post_word_store (ulong a)
385{
386 volatile ulong *save_addr =
387 (volatile ulong *)(MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE);
388
389 *save_addr = a;
390}
391
392ulong post_word_load (void)
393{
394 volatile ulong *save_addr =
395 (volatile ulong *)(MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE);
396
397 return *save_addr;
398}
wdenk56523f12004-07-11 17:40:54 +0000399#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
wdenk7e6bf352004-12-12 22:06:17 +0000400
401#ifdef CONFIG_PS2MULT
402#ifdef CONFIG_BOARD_EARLY_INIT_R
403int board_early_init_r (void)
404{
405 ps2mult_early_init();
406 return (0);
407}
408#endif
409#endif /* CONFIG_PS2MULT */
410
411#if defined(CONFIG_CS_AUTOCONF)
412int last_stage_init (void)
413{
414 /*
415 * auto scan for really existing devices and re-set chip select
416 * configuration.
417 */
418 u16 save, tmp;
419 int restore;
420
421 /*
422 * Check for SRAM and SRAM size
423 */
424
Wolfgang Denke8aa8242005-08-18 11:55:22 +0200425 /* save original SRAM content */
wdenk7e6bf352004-12-12 22:06:17 +0000426 save = *(volatile u16 *)CFG_CS2_START;
427 restore = 1;
wdenkefe2a4d2004-12-16 21:44:03 +0000428
wdenk7e6bf352004-12-12 22:06:17 +0000429 /* write test pattern to SRAM */
430 *(volatile u16 *)CFG_CS2_START = 0xA5A5;
431 __asm__ volatile ("sync");
432 /*
433 * Put a different pattern on the data lines: otherwise they may float
434 * long enough to read back what we wrote.
435 */
436 tmp = *(volatile u16 *)CFG_FLASH_BASE;
437 if (tmp == 0xA5A5)
438 puts ("!! possible error in SRAM detection\n");
wdenkefe2a4d2004-12-16 21:44:03 +0000439
wdenk7e6bf352004-12-12 22:06:17 +0000440 if (*(volatile u16 *)CFG_CS2_START != 0xA5A5) {
441 /* no SRAM at all, disable cs */
442 *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 18);
443 *(vu_long *)MPC5XXX_CS2_START = 0x0000FFFF;
444 *(vu_long *)MPC5XXX_CS2_STOP = 0x0000FFFF;
445 restore = 0;
446 __asm__ volatile ("sync");
Wolfgang Denke8aa8242005-08-18 11:55:22 +0200447 } else if (*(volatile u16 *)(CFG_CS2_START + (1<<19)) == 0xA5A5) {
wdenk7e6bf352004-12-12 22:06:17 +0000448 /* make sure that we access a mirrored address */
449 *(volatile u16 *)CFG_CS2_START = 0x1111;
450 __asm__ volatile ("sync");
451 if (*(volatile u16 *)(CFG_CS2_START + (1<<19)) == 0x1111) {
452 /* SRAM size = 512 kByte */
wdenkefe2a4d2004-12-16 21:44:03 +0000453 *(vu_long *)MPC5XXX_CS2_STOP = STOP_REG(CFG_CS2_START,
wdenk7e6bf352004-12-12 22:06:17 +0000454 0x80000);
455 __asm__ volatile ("sync");
456 puts ("SRAM: 512 kB\n");
457 }
458 else
wdenkefe2a4d2004-12-16 21:44:03 +0000459 puts ("!! possible error in SRAM detection\n");
Wolfgang Denke8aa8242005-08-18 11:55:22 +0200460 } else {
wdenkefe2a4d2004-12-16 21:44:03 +0000461 puts ("SRAM: 1 MB\n");
wdenk7e6bf352004-12-12 22:06:17 +0000462 }
463 /* restore origianl SRAM content */
464 if (restore) {
465 *(volatile u16 *)CFG_CS2_START = save;
466 __asm__ volatile ("sync");
467 }
wdenkefe2a4d2004-12-16 21:44:03 +0000468
469 /*
wdenk7e6bf352004-12-12 22:06:17 +0000470 * Check for Grafic Controller
471 */
472
473 /* save origianl FB content */
474 save = *(volatile u16 *)CFG_CS1_START;
475 restore = 1;
wdenkefe2a4d2004-12-16 21:44:03 +0000476
wdenk7e6bf352004-12-12 22:06:17 +0000477 /* write test pattern to FB memory */
478 *(volatile u16 *)CFG_CS1_START = 0xA5A5;
479 __asm__ volatile ("sync");
480 /*
481 * Put a different pattern on the data lines: otherwise they may float
482 * long enough to read back what we wrote.
483 */
484 tmp = *(volatile u16 *)CFG_FLASH_BASE;
485 if (tmp == 0xA5A5)
486 puts ("!! possible error in grafic controller detection\n");
wdenkefe2a4d2004-12-16 21:44:03 +0000487
wdenk7e6bf352004-12-12 22:06:17 +0000488 if (*(volatile u16 *)CFG_CS1_START != 0xA5A5) {
489 /* no grafic controller at all, disable cs */
490 *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 17);
491 *(vu_long *)MPC5XXX_CS1_START = 0x0000FFFF;
492 *(vu_long *)MPC5XXX_CS1_STOP = 0x0000FFFF;
493 restore = 0;
494 __asm__ volatile ("sync");
Wolfgang Denke8aa8242005-08-18 11:55:22 +0200495 } else {
wdenkefe2a4d2004-12-16 21:44:03 +0000496 puts ("VGA: SMI501 (Voyager) with 8 MB\n");
wdenk7e6bf352004-12-12 22:06:17 +0000497 }
498 /* restore origianl FB content */
499 if (restore) {
500 *(volatile u16 *)CFG_CS1_START = save;
501 __asm__ volatile ("sync");
502 }
wdenkefe2a4d2004-12-16 21:44:03 +0000503
wdenk7e6bf352004-12-12 22:06:17 +0000504 return 0;
505}
506#endif /* CONFIG_CS_AUTOCONF */
wdenk8f0b7cb2005-03-27 23:41:39 +0000507
508#ifdef CONFIG_VIDEO_SM501
509
510#define DISPLAY_WIDTH 640
511#define DISPLAY_HEIGHT 480
512
513#ifdef CONFIG_VIDEO_SM501_8BPP
514#error CONFIG_VIDEO_SM501_8BPP not supported.
515#endif /* CONFIG_VIDEO_SM501_8BPP */
516
517#ifdef CONFIG_VIDEO_SM501_16BPP
518#error CONFIG_VIDEO_SM501_16BPP not supported.
519#endif /* CONFIG_VIDEO_SM501_16BPP */
520#ifdef CONFIG_VIDEO_SM501_32BPP
521static const SMI_REGS init_regs [] =
522{
523#if 0 /* CRT only */
524 {0x00004, 0x0},
525 {0x00048, 0x00021807},
526 {0x0004C, 0x10090a01},
527 {0x00054, 0x1},
528 {0x00040, 0x00021807},
529 {0x00044, 0x10090a01},
530 {0x00054, 0x0},
531 {0x80200, 0x00010000},
532 {0x80204, 0x0},
533 {0x80208, 0x0A000A00},
534 {0x8020C, 0x02fa027f},
535 {0x80210, 0x004a028b},
536 {0x80214, 0x020c01df},
537 {0x80218, 0x000201e9},
538 {0x80200, 0x00013306},
539#else /* panel + CRT */
540 {0x00004, 0x0},
541 {0x00048, 0x00021807},
542 {0x0004C, 0x091a0a01},
543 {0x00054, 0x1},
544 {0x00040, 0x00021807},
545 {0x00044, 0x091a0a01},
546 {0x00054, 0x0},
547 {0x80000, 0x0f013106},
548 {0x80004, 0xc428bb17},
549 {0x8000C, 0x00000000},
550 {0x80010, 0x0a000a00},
551 {0x80014, 0x02800000},
552 {0x80018, 0x01e00000},
553 {0x8001C, 0x00000000},
554 {0x80020, 0x01e00280},
555 {0x80024, 0x02fa027f},
556 {0x80028, 0x004a028b},
557 {0x8002C, 0x020c01df},
558 {0x80030, 0x000201e9},
559 {0x80200, 0x00010000},
560#endif
561 {0, 0}
562};
563#endif /* CONFIG_VIDEO_SM501_32BPP */
564
565#ifdef CONFIG_CONSOLE_EXTRA_INFO
566/*
567 * Return text to be printed besides the logo.
568 */
569void video_get_info_str (int line_number, char *info)
570{
571 if (line_number == 1) {
Wolfgang Denkcd65a3d2006-06-16 16:11:34 +0200572 strcpy (info, " Board: TQM5200 (TQ-Components GmbH)");
Wolfgang Denkb87dfd22006-07-19 13:50:38 +0200573#if defined (CONFIG_STK52XX) || defined (CONFIG_TB5200)
wdenk8f0b7cb2005-03-27 23:41:39 +0000574 } else if (line_number == 2) {
Wolfgang Denkb87dfd22006-07-19 13:50:38 +0200575#if defined (CONFIG_STK52XX)
wdenk8f0b7cb2005-03-27 23:41:39 +0000576 strcpy (info, " on a STK52XX baseboard");
577#endif
Wolfgang Denkb87dfd22006-07-19 13:50:38 +0200578#if defined (CONFIG_TB5200)
579 strcpy (info, " on a TB5200 baseboard");
580#endif
581#endif
wdenk8f0b7cb2005-03-27 23:41:39 +0000582 }
583 else {
584 info [0] = '\0';
585 }
586}
587#endif
588
589/*
Wolfgang Denke8aa8242005-08-18 11:55:22 +0200590 * Returns SM501 register base address. First thing called in the
591 * driver. Checks if SM501 is physically present.
wdenk8f0b7cb2005-03-27 23:41:39 +0000592 */
593unsigned int board_video_init (void)
594{
Wolfgang Denke8aa8242005-08-18 11:55:22 +0200595 u16 save, tmp;
596 int restore, ret;
597
598 /*
599 * Check for Grafic Controller
600 */
601
602 /* save origianl FB content */
603 save = *(volatile u16 *)CFG_CS1_START;
604 restore = 1;
605
606 /* write test pattern to FB memory */
607 *(volatile u16 *)CFG_CS1_START = 0xA5A5;
608 __asm__ volatile ("sync");
609 /*
610 * Put a different pattern on the data lines: otherwise they may float
611 * long enough to read back what we wrote.
612 */
613 tmp = *(volatile u16 *)CFG_FLASH_BASE;
614 if (tmp == 0xA5A5)
615 puts ("!! possible error in grafic controller detection\n");
616
617 if (*(volatile u16 *)CFG_CS1_START != 0xA5A5) {
618 /* no grafic controller found */
619 restore = 0;
620 ret = 0;
621 } else {
622 ret = SM501_MMIO_BASE;
623 }
624
625 if (restore) {
626 *(volatile u16 *)CFG_CS1_START = save;
627 __asm__ volatile ("sync");
628 }
629 return ret;
wdenk8f0b7cb2005-03-27 23:41:39 +0000630}
631
632/*
633 * Returns SM501 framebuffer address
634 */
635unsigned int board_video_get_fb (void)
636{
637 return SM501_FB_BASE;
638}
639
640/*
641 * Called after initializing the SM501 and before clearing the screen.
642 */
643void board_validate_screen (unsigned int base)
644{
645}
646
647/*
648 * Return a pointer to the initialization sequence.
649 */
650const SMI_REGS *board_get_regs (void)
651{
652 return init_regs;
653}
654
655int board_get_width (void)
656{
657 return DISPLAY_WIDTH;
658}
659
660int board_get_height (void)
661{
662 return DISPLAY_HEIGHT;
663}
664
665#endif /* CONFIG_VIDEO_SM501 */