Commit e8aa824eb29e273b5ffe532e301907997e0da83d

Authored by Wolfgang Denk
1 parent 4f562f145a

Fix initialization problem on TQM5200 without SM501

Patch by Martin Krause, 8 Apr. 2005

Showing 2 changed files with 44 additions and 9 deletions Side-by-side Diff

... ... @@ -2,6 +2,9 @@
2 2 Changes for U-Boot 1.1.4:
3 3 ======================================================================
4 4  
  5 +* Fix initialization problem on TQM5200 without SM501
  6 + Patch by Martin Krause, 8 Apr. 2005
  7 +
5 8 * Add RTC support for STK52XX.200
6 9 Patch by Martin Krause, 7 Apr. 2005
7 10  
board/tqm5200/tqm5200.c
... ... @@ -425,7 +425,7 @@
425 425 * Check for SRAM and SRAM size
426 426 */
427 427  
428   - /* save origianl SRAM content */
  428 + /* save original SRAM content */
429 429 save = *(volatile u16 *)CFG_CS2_START;
430 430 restore = 1;
431 431  
... ... @@ -447,8 +447,7 @@
447 447 *(vu_long *)MPC5XXX_CS2_STOP = 0x0000FFFF;
448 448 restore = 0;
449 449 __asm__ volatile ("sync");
450   - }
451   - else if (*(volatile u16 *)(CFG_CS2_START + (1<<19)) == 0xA5A5) {
  450 + } else if (*(volatile u16 *)(CFG_CS2_START + (1<<19)) == 0xA5A5) {
452 451 /* make sure that we access a mirrored address */
453 452 *(volatile u16 *)CFG_CS2_START = 0x1111;
454 453 __asm__ volatile ("sync");
... ... @@ -461,8 +460,7 @@
461 460 }
462 461 else
463 462 puts ("!! possible error in SRAM detection\n");
464   - }
465   - else {
  463 + } else {
466 464 puts ("SRAM: 1 MB\n");
467 465 }
468 466 /* restore origianl SRAM content */
... ... @@ -497,8 +495,7 @@
497 495 *(vu_long *)MPC5XXX_CS1_STOP = 0x0000FFFF;
498 496 restore = 0;
499 497 __asm__ volatile ("sync");
500   - }
501   - else {
  498 + } else {
502 499 puts ("VGA: SMI501 (Voyager) with 8 MB\n");
503 500 }
504 501 /* restore origianl FB content */
505 502  
... ... @@ -598,11 +595,46 @@
598 595 #endif
599 596  
600 597 /*
601   - * Returns SM501 register base address. First thing called in the driver.
  598 + * Returns SM501 register base address. First thing called in the
  599 + * driver. Checks if SM501 is physically present.
602 600 */
603 601 unsigned int board_video_init (void)
604 602 {
605   - return SM501_MMIO_BASE;
  603 + u16 save, tmp;
  604 + int restore, ret;
  605 +
  606 + /*
  607 + * Check for Grafic Controller
  608 + */
  609 +
  610 + /* save origianl FB content */
  611 + save = *(volatile u16 *)CFG_CS1_START;
  612 + restore = 1;
  613 +
  614 + /* write test pattern to FB memory */
  615 + *(volatile u16 *)CFG_CS1_START = 0xA5A5;
  616 + __asm__ volatile ("sync");
  617 + /*
  618 + * Put a different pattern on the data lines: otherwise they may float
  619 + * long enough to read back what we wrote.
  620 + */
  621 + tmp = *(volatile u16 *)CFG_FLASH_BASE;
  622 + if (tmp == 0xA5A5)
  623 + puts ("!! possible error in grafic controller detection\n");
  624 +
  625 + if (*(volatile u16 *)CFG_CS1_START != 0xA5A5) {
  626 + /* no grafic controller found */
  627 + restore = 0;
  628 + ret = 0;
  629 + } else {
  630 + ret = SM501_MMIO_BASE;
  631 + }
  632 +
  633 + if (restore) {
  634 + *(volatile u16 *)CFG_CS1_START = save;
  635 + __asm__ volatile ("sync");
  636 + }
  637 + return ret;
606 638 }
607 639  
608 640 /*