Commit 4532cb696eb717419022dbaa8d408e7df7df7b68

Authored by wdenk
1 parent 02c9bed451

* LWMON extensions:

- Splashscreen support
  - modem support
  - sysmon support
  - temperature dependend enabling of LCD

* Allow booting from old "PPCBoot" disk partitions

* Add support for TQM8255 Board / MPC8255 CPU

Showing 25 changed files with 805 additions and 108 deletions Side-by-side Diff

1 1 ======================================================================
  2 +Changes since U-Boot 0.3.1:
  3 +======================================================================
  4 +
  5 +* LWMON extensions:
  6 + - Splashscreen support
  7 + - modem support
  8 + - sysmon support
  9 + - temperature dependend enabling of LCD
  10 +
  11 +* Allow booting from old "PPCBoot" disk partitions
  12 +
  13 +* Add support for TQM8255 Board / MPC8255 CPU
  14 +
  15 +======================================================================
2 16 Changes for U-Boot 0.3.1:
3 17 ======================================================================
4 18  
... ... @@ -577,6 +577,7 @@
577 577  
578 578 TQM8260_config \
579 579 TQM8260_L2_config \
  580 +TQM8255_266MHz_config \
580 581 TQM8260_266MHz_config \
581 582 TQM8260_L2_266MHz_config \
582 583 TQM8260_300MHz_config: unconfig
... ... @@ -596,7 +597,9 @@
596 597 { echo "#define CONFIG_300MHz" >>include/config.h ; \
597 598 echo "... with 300MHz system clock" ; \
598 599 }
599   - @./mkconfig -a $(call xtract_82xx,$@) ppc mpc8260 tqm8260
  600 + @[ -z "$(findstring TQM8255_,$@)" ] || \
  601 + { echo "#define CONFIG_MPC8255" >>include/config.h ; }
  602 + @./mkconfig -a TQM8260 ppc mpc8260 tqm8260
600 603  
601 604 #########################################################################
602 605 ## 74xx/7xx Systems
... ... @@ -47,11 +47,18 @@
47 47  
48 48 /*------------------------ Local prototypes ---------------------------*/
49 49 static long int dram_size (long int, long int *, long int);
  50 +static void kbd_init (void);
  51 +static int compare_magic (uchar *kbd_data, uchar *str);
50 52  
51 53  
52 54 /*--------------------- Local macros and constants --------------------*/
53 55 #define _NOT_USED_ 0xFFFFFFFF
54 56  
  57 +#ifdef CONFIG_MODEM_SUPPORT
  58 +static int key_pressed(void);
  59 +extern void disable_putc(void);
  60 +#endif /* CONFIG_MODEM_SUPPORT */
  61 +
55 62 /*
56 63 * 66 MHz SDRAM access using UPM A
57 64 */
... ... @@ -396,6 +403,7 @@
396 403 immr->im_cpm.cp_pbodr &= ~PB_ENET_TENA;
397 404 immr->im_cpm.cp_pbdat &= ~PB_ENET_TENA; /* set to 0 = disabled */
398 405 immr->im_cpm.cp_pbdir |= PB_ENET_TENA;
  406 +
399 407 return (0);
400 408 }
401 409  
402 410  
403 411  
404 412  
405 413  
406 414  
407 415  
408 416  
409 417  
410 418  
... ... @@ -466,38 +474,45 @@
466 474 #define KEYBD_SET_DEBUGMODE '#' /* Magic key to enable debug output */
467 475  
468 476 /***********************************************************************
469   -F* Function: int misc_init_r (void) P*A*Z*
  477 +F* Function: int board_postclk_init (void) P*A*Z*
470 478 *
471 479 P* Parameters: none
472 480 P*
473 481 P* Returnvalue: int
474   -P* - 0 is always returned, even in the case of a keyboard
475   -P* error.
  482 +P* - 0 is always returned.
476 483 *
477   -Z* Intention: This function is the misc_init_r() method implementation
  484 +Z* Intention: This function is the board_postclk_init() method implementation
478 485 Z* for the lwmon board.
479   -Z* The keyboard controller is initialized and the result
480   -Z* of a read copied to the environment variable "keybd".
481   -Z* If KEYBD_SET_DEBUGMODE is defined, a check is made for
482   -Z* this key, and if found display to the LCD will be enabled.
483   -Z* The keys in "keybd" are checked against the magic
484   -Z* keycommands defined in the environment.
485   -Z* See also key_match().
486 486 *
487   -D* Design: wd@denx.de
488   -C* Coding: wd@denx.de
489   -V* Verification: dzu@denx.de
490 487 ***********************************************************************/
491   -int misc_init_r (void)
  488 +int board_postclk_init (void)
492 489 {
  490 + DECLARE_GLOBAL_DATA_PTR;
  491 +
  492 + kbd_init();
  493 +
  494 +#ifdef CONFIG_MODEM_SUPPORT
  495 + if (key_pressed()) {
  496 + disable_putc(); /* modem doesn't understand banner etc */
  497 + gd->do_mdm_init = 1;
  498 + }
  499 +#endif
  500 +
  501 + return (0);
  502 +}
  503 +
  504 +static void kbd_init (void)
  505 +{
  506 + DECLARE_GLOBAL_DATA_PTR;
  507 +
493 508 uchar kbd_data[KEYBD_DATALEN];
494 509 uchar tmp_data[KEYBD_DATALEN];
495   - uchar keybd_env[2 * KEYBD_DATALEN + 1];
496 510 uchar val, errcd;
497   - uchar *str;
498 511 int i;
499 512  
500 513 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
  514 +
  515 + gd->kbd_status = 0;
501 516  
502 517 /* Read initial keyboard error code */
503 518 val = KEYBD_CMD_READ_STATUS;
... ... @@ -508,7 +523,7 @@
508 523 /* clear "irrelevant" bits. Recommended by Martin Rajek, LWN */
509 524 errcd &= ~(KEYBD_STATUS_H_RESET|KEYBD_STATUS_BROWNOUT);
510 525 if (errcd) {
511   - printf ("KEYBD: Error %02X\n", errcd);
  526 + gd->kbd_status |= errcd << 8;
512 527 }
513 528 /* Reset error code and verify */
514 529 val = KEYBD_CMD_RESET_ERRORS;
515 530  
... ... @@ -521,29 +536,11 @@
521 536  
522 537 val &= KEYBD_STATUS_MASK; /* clear unused bits */
523 538 if (val) { /* permanent error, report it */
524   - printf ("*** Keyboard error code %02X ***\n", val);
525   - sprintf (keybd_env, "%02X", val);
526   - setenv ("keybd", keybd_env);
527   - return 0;
  539 + gd->kbd_status |= val;
  540 + return;
528 541 }
529 542  
530 543 /*
531   - * Now we know that we have a working keyboard, so disable
532   - * all output to the LCD except when a key press is detected.
533   - */
534   -
535   - if ((console_assign (stdout, "serial") < 0) ||
536   - (console_assign (stderr, "serial") < 0)) {
537   - printf ("Can't assign serial port as output device\n");
538   - }
539   -
540   - /* Read Version */
541   - val = KEYBD_CMD_READ_VERSION;
542   - i2c_write (kbd_addr, 0, 0, &val, 1);
543   - i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_VERSIONLEN);
544   - printf ("KEYBD: Version %d.%d\n", kbd_data[0], kbd_data[1]);
545   -
546   - /*
547 544 * Read current keyboard state.
548 545 *
549 546 * After the error reset it may take some time before the
550 547  
... ... @@ -569,7 +566,74 @@
569 566 memcpy (tmp_data, kbd_data, KEYBD_DATALEN);
570 567 udelay (5000);
571 568 }
  569 +}
572 570  
  571 +/***********************************************************************
  572 +F* Function: int misc_init_r (void) P*A*Z*
  573 + *
  574 +P* Parameters: none
  575 +P*
  576 +P* Returnvalue: int
  577 +P* - 0 is always returned, even in the case of a keyboard
  578 +P* error.
  579 + *
  580 +Z* Intention: This function is the misc_init_r() method implementation
  581 +Z* for the lwmon board.
  582 +Z* The keyboard controller is initialized and the result
  583 +Z* of a read copied to the environment variable "keybd".
  584 +Z* If KEYBD_SET_DEBUGMODE is defined, a check is made for
  585 +Z* this key, and if found display to the LCD will be enabled.
  586 +Z* The keys in "keybd" are checked against the magic
  587 +Z* keycommands defined in the environment.
  588 +Z* See also key_match().
  589 + *
  590 +D* Design: wd@denx.de
  591 +C* Coding: wd@denx.de
  592 +V* Verification: dzu@denx.de
  593 + ***********************************************************************/
  594 +int misc_init_r (void)
  595 +{
  596 + DECLARE_GLOBAL_DATA_PTR;
  597 +
  598 + uchar kbd_data[KEYBD_DATALEN];
  599 + uchar keybd_env[2 * KEYBD_DATALEN + 1];
  600 + uchar kbd_init_status = gd->kbd_status >> 8;
  601 + uchar kbd_status = gd->kbd_status;
  602 + uchar val;
  603 + uchar *str;
  604 + int i;
  605 +
  606 + if (kbd_init_status) {
  607 + printf ("KEYBD: Error %02X\n", kbd_init_status);
  608 + }
  609 + if (kbd_status) { /* permanent error, report it */
  610 + printf ("*** Keyboard error code %02X ***\n", kbd_status);
  611 + sprintf (keybd_env, "%02X", kbd_status);
  612 + setenv ("keybd", keybd_env);
  613 + return 0;
  614 + }
  615 +
  616 + /*
  617 + * Now we know that we have a working keyboard, so disable
  618 + * all output to the LCD except when a key press is detected.
  619 + */
  620 +
  621 + if ((console_assign (stdout, "serial") < 0) ||
  622 + (console_assign (stderr, "serial") < 0)) {
  623 + printf ("Can't assign serial port as output device\n");
  624 + }
  625 +
  626 + /* Read Version */
  627 + val = KEYBD_CMD_READ_VERSION;
  628 + i2c_write (kbd_addr, 0, 0, &val, 1);
  629 + i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_VERSIONLEN);
  630 + printf ("KEYBD: Version %d.%d\n", kbd_data[0], kbd_data[1]);
  631 +
  632 + /* Read current keyboard state */
  633 + val = KEYBD_CMD_READ_KEYS;
  634 + i2c_write (kbd_addr, 0, 0, &val, 1);
  635 + i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
  636 +
573 637 for (i = 0; i < KEYBD_DATALEN; ++i) {
574 638 sprintf (keybd_env + i + i, "%02X", kbd_data[i]);
575 639 }
... ... @@ -598,6 +662,56 @@
598 662 static uchar kbd_magic_prefix[] = "key_magic";
599 663 static uchar kbd_command_prefix[] = "key_cmd";
600 664  
  665 +static int compare_magic (uchar *kbd_data, uchar *str)
  666 +{
  667 + uchar compare[KEYBD_DATALEN-1];
  668 + uchar *nxt;
  669 + int i;
  670 +
  671 + /* Don't include modifier byte */
  672 + memcpy (compare, kbd_data+1, KEYBD_DATALEN-1);
  673 +
  674 + for (; str != NULL; str = (*nxt) ? nxt+1 : nxt) {
  675 + uchar c;
  676 + int k;
  677 +
  678 + c = (uchar) simple_strtoul (str, (char **) (&nxt), 16);
  679 +
  680 + if (str == nxt) { /* invalid character */
  681 + break;
  682 + }
  683 +
  684 + /*
  685 + * Check if this key matches the input.
  686 + * Set matches to zero, so they match only once
  687 + * and we can find duplicates or extra keys
  688 + */
  689 + for (k = 0; k < sizeof(compare); ++k) {
  690 + if (compare[k] == '\0') /* only non-zero entries */
  691 + continue;
  692 + if (c == compare[k]) { /* found matching key */
  693 + compare[k] = '\0';
  694 + break;
  695 + }
  696 + }
  697 + if (k == sizeof(compare)) {
  698 + return -1; /* unmatched key */
  699 + }
  700 + }
  701 +
  702 + /*
  703 + * A full match leaves no keys in the `compare' array,
  704 + */
  705 + for (i = 0; i < sizeof(compare); ++i) {
  706 + if (compare[i])
  707 + {
  708 + return -1;
  709 + }
  710 + }
  711 +
  712 + return 0;
  713 +}
  714 +
601 715 /***********************************************************************
602 716 F* Function: static uchar *key_match (uchar *kbd_data) P*A*Z*
603 717 *
604 718  
605 719  
... ... @@ -627,12 +741,9 @@
627 741 ***********************************************************************/
628 742 static uchar *key_match (uchar *kbd_data)
629 743 {
630   - uchar compare[KEYBD_DATALEN-1];
631 744 uchar magic[sizeof (kbd_magic_prefix) + 1];
632   - uchar extra;
633   - uchar *str, *nxt, *suffix;
  745 + uchar *suffix;
634 746 uchar *kbd_magic_keys;
635   - int i;
636 747  
637 748 /*
638 749 * The following string defines the characters that can pe appended
... ... @@ -653,50 +764,7 @@
653 764 #if 0
654 765 printf ("### Check magic \"%s\"\n", magic);
655 766 #endif
656   - /* Don't include modifier byte */
657   - memcpy (compare, kbd_data+1, KEYBD_DATALEN-1);
658   -
659   - extra = 0;
660   -
661   - for (str= getenv(magic); str != NULL; str = (*nxt) ? nxt+1 : nxt) {
662   - uchar c;
663   - int k;
664   -
665   - c = (uchar) simple_strtoul (str, (char **) (&nxt), 16);
666   -
667   - if (str == nxt) { /* invalid character */
668   - break;
669   - }
670   -
671   - /*
672   - * Check if this key matches the input.
673   - * Set matches to zero, so they match only once
674   - * and we can find duplicates or extra keys
675   - */
676   - for (k = 0; k < sizeof(compare); ++k) {
677   - if (compare[k] == '\0') /* only non-zero entries */
678   - continue;
679   - if (c == compare[k]) { /* found matching key */
680   - compare[k] = '\0';
681   - break;
682   - }
683   - }
684   - if (k == sizeof(compare)) {
685   - extra = 1; /* unmatched key */
686   - }
687   - }
688   -
689   - /*
690   - * A full match leaves no keys in the `compare' array,
691   - * and has no extra keys
692   - */
693   -
694   - for (i = 0; i < sizeof(compare); ++i) {
695   - if (compare[i])
696   - break;
697   - }
698   -
699   - if ((i == sizeof(compare)) && (extra == 0)) {
  767 + if (compare_magic(kbd_data, getenv(magic)) == 0) {
700 768 uchar cmd_name[sizeof (kbd_command_prefix) + 1];
701 769 char *cmd;
702 770  
703 771  
... ... @@ -815,7 +883,9 @@
815 883 uchar val;
816 884 int i;
817 885  
  886 +#if 0 /* Done in kbd_init */
818 887 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
  888 +#endif
819 889  
820 890 /* Read keys */
821 891 val = KEYBD_CMD_READ_KEYS;
... ... @@ -964,4 +1034,19 @@
964 1034  
965 1035 while (1);
966 1036 }
  1037 +
  1038 +#ifdef CONFIG_MODEM_SUPPORT
  1039 +static int key_pressed(void)
  1040 +{
  1041 + uchar kbd_data[KEYBD_DATALEN];
  1042 + uchar val;
  1043 +
  1044 + /* Read keys */
  1045 + val = KEYBD_CMD_READ_KEYS;
  1046 + i2c_write (kbd_addr, 0, 0, &val, 1);
  1047 + i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
  1048 +
  1049 + return (compare_magic(kbd_data, CONFIG_MODEM_KEY_MAGIC) == 0);
  1050 +}
  1051 +#endif /* CONFIG_MODEM_SUPPORT */
board/tqm8260/tqm8260.c
... ... @@ -200,7 +200,7 @@
200 200  
201 201 puts ("Board: ");
202 202  
203   - if (!i || strncmp (str, "TQM8260", 7)) {
  203 + if (!i || strncmp (str, "TQM82", 5)) {
204 204 puts ("### No HW ID - assuming TQM8260\n");
205 205 return (0);
206 206 }
... ... @@ -404,7 +404,8 @@
404 404 SHOW_BOOT_PROGRESS (-1);
405 405 return 1;
406 406 }
407   - if (strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
  407 + if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
  408 + (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
408 409 printf ("\n** Invalid partition type \"%.32s\""
409 410 " (expect \"" BOOT_PART_TYPE "\")\n",
410 411 info.type);
... ... @@ -262,7 +262,8 @@
262 262 printf("error reading partinfo\n");
263 263 return 1;
264 264 }
265   - if (strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
  265 + if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
  266 + (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
266 267 printf ("\n** Invalid partition type \"%.32s\""
267 268 " (expect \"" BOOT_PART_TYPE "\")\n",
268 269 info.type);
... ... @@ -376,7 +376,8 @@
376 376 info.size=2880;
377 377 printf("error reading partinfo...try to boot raw\n");
378 378 }
379   - if (strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
  379 + if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
  380 + (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
380 381 printf ("\n** Invalid partition type \"%.32s\""
381 382 " (expect \"" BOOT_PART_TYPE "\")\n",
382 383 info.type);
1 1 /*
2   - * (C) Copyright 2000
  2 + * (C) Copyright 2000-2003
3 3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 4 *
5 5 * See file CREDITS for list of people who contributed to this
6 6  
... ... @@ -22,12 +22,12 @@
22 22 */
23 23  
24 24 /*
25   - * CPU specific code for the MPC8260
  25 + * CPU specific code for the MPC8255 / MPC8260 CPUs
26 26 *
27 27 * written or collected and sometimes rewritten by
28 28 * Magnus Damm <damm@bitsmart.com>
29 29 *
30   - * minor modifications by
  30 + * modified by
31 31 * Wolfgang Denk <wd@denx.de>
32 32 *
33 33 * modified for 8260 by
... ... @@ -64,7 +64,7 @@
64 64 if ((immr & IMMR_ISB_MSK) != CFG_IMMR)
65 65 return -1; /* whoops! someone moved the IMMR */
66 66  
67   - printf ("MPC8260 (Rev %02x, Mask ", rev);
  67 + printf (CPU_ID_STR " (Rev %02x, Mask ", rev);
68 68  
69 69 /*
70 70 * the bottom 16 bits of the immr are the Part Number and Mask Number
... ... @@ -100,6 +100,9 @@
100 100 break;
101 101 case 0x0060:
102 102 printf ("A.0(A) 2K25A");
  103 + break;
  104 + case 0x0062:
  105 + printf ("B.1 4K25A");
103 106 break;
104 107 default:
105 108 printf ("unknown [immr=0x%04x,k=0x%04x]", m, k);
cpu/mpc8260/cpu_init.c
... ... @@ -250,7 +250,7 @@
250 250 int i;
251 251 char *sep;
252 252  
253   - puts ("MPC8260 Reset Status:");
  253 + puts (CPU_ID_STR " Reset Status:");
254 254  
255 255 sep = " ";
256 256 for (i = 0; i < n; i++)
... ... @@ -171,7 +171,7 @@
171 171  
172 172 cp = &corecnf_tab[corecnf];
173 173  
174   - printf ("MPC8260 Clock Configuration\n - Bus-to-Core Mult ");
  174 + printf (CPU_ID_STR " Clock Configuration\n - Bus-to-Core Mult ");
175 175  
176 176 switch (cp->b2c_mult) {
177 177 case _byp:
... ... @@ -32,6 +32,9 @@
32 32 #include <lcdvideo.h>
33 33 #include <linux/types.h>
34 34 #include <devices.h>
  35 +#if defined(CONFIG_POST)
  36 +#include <post.h>
  37 +#endif
35 38  
36 39  
37 40 #ifdef CONFIG_LCD
38 41  
... ... @@ -982,7 +985,11 @@
982 985  
983 986 #if defined(CONFIG_LWMON)
984 987 { uchar c = pic_read (0x60);
  988 +#if defined(CONFIG_LCD) && defined(CONFIG_LWMON) && (CONFIG_POST & CFG_POST_SYSMON)
  989 + c |= 0x04; /* Chip Enable LCD */
  990 +#else
985 991 c |= 0x07; /* Power on CCFL, Enable CCFL, Chip Enable LCD */
  992 +#endif
986 993 pic_write (0x60, c);
987 994 }
988 995 #endif /* CONFIG_LWMON */
... ... @@ -246,6 +246,20 @@
246 246 (((gd->cpu_clk / 16 / gd->baudrate)-1) << 1) | CPM_BRG_EN;
247 247 }
248 248  
  249 +#ifdef CONFIG_MODEM_SUPPORT
  250 +void disable_putc(void)
  251 +{
  252 + DECLARE_GLOBAL_DATA_PTR;
  253 + gd->be_quiet = 1;
  254 +}
  255 +
  256 +void enable_putc(void)
  257 +{
  258 + DECLARE_GLOBAL_DATA_PTR;
  259 + gd->be_quiet = 0;
  260 +}
  261 +#endif
  262 +
249 263 void
250 264 serial_putc(const char c)
251 265 {
... ... @@ -254,6 +268,13 @@
254 268 volatile smc_uart_t *up;
255 269 volatile immap_t *im = (immap_t *)CFG_IMMR;
256 270 volatile cpm8xx_t *cpmp = &(im->im_cpm);
  271 +
  272 +#ifdef CONFIG_MODEM_SUPPORT
  273 + DECLARE_GLOBAL_DATA_PTR;
  274 +
  275 + if (gd->be_quiet)
  276 + return;
  277 +#endif
257 278  
258 279 if (c == '\n')
259 280 serial_putc ('\r');
include/asm-ppc/global_data.h
... ... @@ -70,10 +70,18 @@
70 70 #endif
71 71 #ifdef CONFIG_POST
72 72 unsigned long post_log_word; /* Record POST activities */
  73 + unsigned long post_init_f_time; /* When post_init_f started */
73 74 #endif
74 75 #ifdef CONFIG_BOARD_TYPES
75 76 unsigned long board_type;
76 77 #endif
  78 +#ifdef CONFIG_MODEM_SUPPORT
  79 + unsigned long do_mdm_init;
  80 + unsigned long be_quiet;
  81 +#endif
  82 +#ifdef CONFIG_LWMON
  83 + unsigned long kbd_status;
  84 +#endif
77 85 } gd_t;
78 86  
79 87 /*
... ... @@ -32,7 +32,7 @@
32 32 #define CMD_TBL_BMP MK_CMD_TBL_ENTRY( \
33 33 "bmp", 3, 3, 1, do_bmp, \
34 34 "bmp - manipulate BMP image data\n", \
35   - "\nbmp info <imageAddr> - display image info\n" \
  35 + "info <imageAddr> - display image info\n" \
36 36 "bmp display <imageAddr> - display image\n" \
37 37 ),
38 38 int do_bmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
... ... @@ -31,9 +31,10 @@
31 31 #include <command.h>
32 32  
33 33 /*
34   - * Type string for PPC bootable partitions
  34 + * Type string for U-Boot bootable partitions
35 35 */
36   -#define BOOT_PART_TYPE "U-Boot"
  36 +#define BOOT_PART_TYPE "U-Boot" /* primary boot partition type */
  37 +#define BOOT_PART_COMP "PPCBoot" /* PPCBoot compatibility type */
37 38  
38 39 #if 0
39 40  
include/configs/TQM8260.h
... ... @@ -33,6 +33,7 @@
33 33 * CONFIG_L2_CACHE
34 34 * CONFIG_266MHz
35 35 * CONFIG_300MHz
  36 + * CONFIG_MPC8255
36 37 */
37 38  
38 39 /*
39 40  
... ... @@ -312,10 +313,10 @@
312 313 */
313 314 #if defined(CONFIG_266MHz)
314 315 #define CFG_HRCW_MASTER (HRCW_CIP | HRCW_ISB111 | HRCW_BMS | \
315   - HRCW_MODCK_H0111)
  316 + HRCW_MODCK_H0111)
316 317 #elif defined(CONFIG_300MHz)
317 318 #define CFG_HRCW_MASTER (HRCW_CIP | HRCW_ISB111 | HRCW_BMS | \
318   - HRCW_MODCK_H0110)
  319 + HRCW_MODCK_H0110)
319 320 #else
320 321 #define CFG_HRCW_MASTER (HRCW_CIP | HRCW_ISB111 | HRCW_BMS)
321 322 #endif
include/configs/lwmon.h
... ... @@ -40,10 +40,13 @@
40 40 #define CONFIG_LWMON 1 /* ...on a LWMON board */
41 41  
42 42 #define CONFIG_BOARD_PRE_INIT 1 /* Call board_pre_init */
  43 +#define CONFIG_BOARD_POSTCLK_INIT 1 /* Call board_postclk_init */
43 44  
44 45 #define CONFIG_LCD 1 /* use LCD controller ... */
45 46 #define CONFIG_HLD1045 1 /* ... with a HLD1045 display */
46 47  
  48 +#define CONFIG_SPLASH_SCREEN /* ... with splashscreen support*/
  49 +
47 50 #if 1
48 51 #define CONFIG_8xx_CONS_SMC2 1 /* Console is on SMC2 */
49 52 #else
... ... @@ -72,7 +75,8 @@
72 75 CFG_POST_I2C | \
73 76 CFG_POST_SPI | \
74 77 CFG_POST_USB | \
75   - CFG_POST_SPR)
  78 + CFG_POST_SPR | \
  79 + CFG_POST_SYSMON)
76 80  
77 81 #define CONFIG_BOOTCOMMAND "run flash_self"
78 82  
... ... @@ -134,7 +138,7 @@
134 138 else immr->im_cpm.cp_pbdat &= ~PB_SDA
135 139 #define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \
136 140 else immr->im_cpm.cp_pbdat &= ~PB_SCL
137   -#define I2C_DELAY udelay(1) /* 1/4 I2C clock duration */
  141 +#define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */
138 142 #endif /* CONFIG_SOFT_I2C */
139 143  
140 144  
... ... @@ -229,7 +233,7 @@
229 233 */
230 234 #define CFG_INIT_RAM_ADDR CFG_IMMR
231 235 #define CFG_INIT_RAM_END 0x2F00 /* End of used area in DPRAM */
232   -#define CFG_GBL_DATA_SIZE 64 /* size in bytes reserved for initial data */
  236 +#define CFG_GBL_DATA_SIZE 68 /* size in bytes reserved for initial data */
233 237 #define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
234 238 #define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
235 239  
... ... @@ -570,6 +574,11 @@
570 574 */
571 575 #define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
572 576 #define BOOTFLAG_WARM 0x02 /* Software reboot */
  577 +
  578 +#define CONFIG_MODEM_SUPPORT 1 /* enable modem initialization stuff */
  579 +#undef CONFIG_MODEM_SUPPORT_DEBUG
  580 +
  581 +#define CONFIG_MODEM_KEY_MAGIC "3C+3F" /* hold down these keys to enable modem */
573 582  
574 583 #endif /* __CONFIG_H */
... ... @@ -24,11 +24,18 @@
24 24 /*
25 25 * mpc8260.h
26 26 *
27   - * MPC8260 specific definitions
  27 + * MPC8255 / MPC8260 specific definitions
28 28 */
29 29  
30 30 #ifndef __MPC8260_H__
31 31 #define __MPC8260_H__
  32 +
  33 +#ifdef CONFIG_MPC8255
  34 +#define CPU_ID_STR "MPC8255"
  35 +#endif
  36 +#ifndef CPU_ID_STR
  37 +#define CPU_ID_STR "MPC8260"
  38 +#endif
32 39  
33 40 /*-----------------------------------------------------------------------
34 41 * Exception offsets (PowerPC standard)
... ... @@ -54,8 +54,11 @@
54 54 char *desc;
55 55 int flags;
56 56 int (*test) (int flags);
  57 + int (*init_f) (void);
  58 + void (*reloc) (void);
57 59 unsigned long testid;
58 60 };
  61 +int post_init_f (void);
59 62 void post_bootmode_init (void);
60 63 int post_bootmode_get (unsigned int * last_test);
61 64 void post_bootmode_clear (void);
... ... @@ -64,6 +67,7 @@
64 67 int post_info (char *name);
65 68 int post_log (char *format, ...);
66 69 void post_reloc (void);
  70 +unsigned long post_time_ms (unsigned long base);
67 71  
68 72 extern struct post_test post_list[];
69 73 extern unsigned int post_list_size;
... ... @@ -81,6 +85,7 @@
81 85 #define CFG_POST_SPI 0x00000100
82 86 #define CFG_POST_USB 0x00000200
83 87 #define CFG_POST_SPR 0x00000400
  88 +#define CFG_POST_SYSMON 0x00000800
84 89  
85 90 #endif /* CONFIG_POST */
86 91  
... ... @@ -24,7 +24,7 @@
24 24 #ifndef __VERSION_H__
25 25 #define __VERSION_H__
26 26  
27   -#define U_BOOT_VERSION "U-Boot 0.3.1"
  27 +#define U_BOOT_VERSION "U-Boot 0.3.2"
28 28  
29 29 #endif /* __VERSION_H__ */
... ... @@ -308,6 +308,9 @@
308 308 #if defined(CONFIG_DTT) /* Digital Thermometers and Thermostats */
309 309 dtt_init,
310 310 #endif
  311 +#ifdef CONFIG_POST
  312 + post_init_f,
  313 +#endif
311 314 INIT_FUNC_WATCHDOG_RESET
312 315 init_func_ram,
313 316 #if defined(CFG_DRAM_TEST)
... ... @@ -976,6 +979,13 @@
976 979 }
977 980 #endif
978 981  
  982 +#ifdef CONFIG_MODEM_SUPPORT
  983 + {
  984 + extern int do_mdm_init;
  985 + do_mdm_init = gd->do_mdm_init;
  986 + }
  987 +#endif
  988 +
979 989 /* Initialization complete - start the monitor */
980 990  
981 991 /* main_loop() can return to retry autoboot, if so just run it again. */
... ... @@ -992,6 +1002,104 @@
992 1002 puts ("### ERROR ### Please RESET the board ###\n");
993 1003 for (;;);
994 1004 }
  1005 +
  1006 +#ifdef CONFIG_MODEM_SUPPORT
  1007 +/* called from main loop (common/main.c) */
  1008 +extern void dbg(const char *fmt, ...);
  1009 +int mdm_init (void)
  1010 +{
  1011 + char env_str[16];
  1012 + char *init_str;
  1013 + int i;
  1014 + extern char console_buffer[];
  1015 + static inline void mdm_readline(char *buf, int bufsiz);
  1016 + extern void enable_putc(void);
  1017 + extern int hwflow_onoff(int);
  1018 +
  1019 + enable_putc(); /* enable serial_putc() */
  1020 +
  1021 +#ifdef CONFIG_HWFLOW
  1022 + init_str = getenv("mdm_flow_control");
  1023 + if (init_str && (strcmp(init_str, "rts/cts") == 0))
  1024 + hwflow_onoff (1);
  1025 + else
  1026 + hwflow_onoff(-1);
  1027 +#endif
  1028 +
  1029 + for (i = 1;;i++) {
  1030 + sprintf(env_str, "mdm_init%d", i);
  1031 + if ((init_str = getenv(env_str)) != NULL) {
  1032 + serial_puts(init_str);
  1033 + serial_puts("\n");
  1034 + for(;;) {
  1035 + mdm_readline(console_buffer, CFG_CBSIZE);
  1036 + dbg("ini%d: [%s]", i, console_buffer);
  1037 +
  1038 + if ((strcmp(console_buffer, "OK") == 0) ||
  1039 + (strcmp(console_buffer, "ERROR") == 0)) {
  1040 + dbg("ini%d: cmd done", i);
  1041 + break;
  1042 + } else /* in case we are originating call ... */
  1043 + if (strncmp(console_buffer, "CONNECT", 7) == 0) {
  1044 + dbg("ini%d: connect", i);
  1045 + return 0;
  1046 + }
  1047 + }
  1048 + } else
  1049 + break; /* no init string - stop modem init */
  1050 +
  1051 + udelay(100000);
  1052 + }
  1053 +
  1054 + udelay(100000);
  1055 +
  1056 + /* final stage - wait for connect */
  1057 + for(;i > 1;) { /* if 'i' > 1 - wait for connection
  1058 + message from modem */
  1059 + mdm_readline(console_buffer, CFG_CBSIZE);
  1060 + dbg("ini_f: [%s]", console_buffer);
  1061 + if (strncmp(console_buffer, "CONNECT", 7) == 0) {
  1062 + dbg("ini_f: connected");
  1063 + return 0;
  1064 + }
  1065 + }
  1066 +
  1067 + return 0;
  1068 +}
  1069 +
  1070 +/* 'inline' - We have to do it fast */
  1071 +static inline void mdm_readline(char *buf, int bufsiz)
  1072 +{
  1073 + char c;
  1074 + char *p;
  1075 + int n;
  1076 +
  1077 + n = 0;
  1078 + p = buf;
  1079 + for(;;) {
  1080 + c = serial_getc();
  1081 +
  1082 + /* dbg("(%c)", c); */
  1083 +
  1084 + switch(c) {
  1085 + case '\r':
  1086 + break;
  1087 + case '\n':
  1088 + *p = '\0';
  1089 + return;
  1090 +
  1091 + default:
  1092 + if(n++ > bufsiz) {
  1093 + *p = '\0';
  1094 + return; /* sanity check */
  1095 + }
  1096 + *p = c;
  1097 + p++;
  1098 + break;
  1099 + }
  1100 + }
  1101 +}
  1102 +#endif
995 1103  
996 1104 #if 0 /* We could use plain global data, but the resulting code is bigger */
997 1105 /*
... ... @@ -27,7 +27,7 @@
27 27 LIB = libpost.a
28 28  
29 29 AOBJS = cache_8xx.o
30   -COBJS = post.o tests.o cpu.o rtc.o watchdog.o memory.o i2c.o cache.o
  30 +COBJS = post.o tests.o cpu.o rtc.o watchdog.o memory.o i2c.o cache.o sysmon.o
31 31 COBJS += uart.o ether.o usb.o spr.o
32 32  
33 33 include $(TOPDIR)/post/rules.mk
... ... @@ -36,6 +36,30 @@
36 36  
37 37 #define BOOTMODE_MAGIC 0xDEAD0000
38 38  
  39 +int post_init_f (void)
  40 +{
  41 + DECLARE_GLOBAL_DATA_PTR;
  42 +
  43 + int res = 0;
  44 + unsigned int i;
  45 +
  46 + for (i = 0; i < post_list_size; i++) {
  47 + struct post_test *test = post_list + i;
  48 +
  49 + if (test->init_f && test->init_f()) {
  50 + res = -1;
  51 + }
  52 + }
  53 +
  54 + gd->post_init_f_time = post_time_ms(0);
  55 + if (!gd->post_init_f_time)
  56 + {
  57 + printf("post/post.c: post_time_ms seems not to be implemented\n");
  58 + }
  59 +
  60 + return res;
  61 +}
  62 +
39 63 void post_bootmode_init (void)
40 64 {
41 65 DECLARE_GLOBAL_DATA_PTR;
42 66  
... ... @@ -365,7 +389,35 @@
365 389 addr = (ulong) (test->test) + gd->reloc_off;
366 390 test->test = (int (*)(int flags)) addr;
367 391 }
  392 +
  393 + if (test->init_f) {
  394 + addr = (ulong) (test->init_f) + gd->reloc_off;
  395 + test->init_f = (int (*)(void)) addr;
  396 + }
  397 +
  398 + if (test->reloc) {
  399 + addr = (ulong) (test->reloc) + gd->reloc_off;
  400 + test->reloc = (void (*)(void)) addr;
  401 +
  402 + test->reloc();
  403 + }
368 404 }
  405 +}
  406 +
  407 +
  408 +/*
  409 + * Some tests (e.g. SYSMON) need the time when post_init_f started,
  410 + * but we cannot use get_timer() at this point.
  411 + *
  412 + * On PowerPC we implement it using the timebase register.
  413 + */
  414 +unsigned long post_time_ms (unsigned long base)
  415 +{
  416 +#ifdef CONFIG_PPC
  417 + return (unsigned long)get_ticks () / (get_tbclk () / CFG_HZ) - base;
  418 +#else
  419 + return 0; /* Not implemented yet */
  420 +#endif
369 421 }
370 422  
371 423 #endif /* CONFIG_POST */
  1 +/*
  2 + * (C) Copyright 2003
  3 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4 + *
  5 + * See file CREDITS for list of people who contributed to this
  6 + * project.
  7 + *
  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.
  12 + *
  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.
  17 + *
  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,
  21 + * MA 02111-1307 USA
  22 + */
  23 +
  24 +#include <post.h>
  25 +#include <common.h>
  26 +
  27 +#ifdef CONFIG_POST
  28 +
  29 +/*
  30 + * SYSMON test
  31 + *
  32 + * This test performs the system hardware monitoring.
  33 + * The test passes when all the following voltages and temperatures
  34 + * are within allowed ranges:
  35 + *
  36 + * Board temperature
  37 + * Front temperature
  38 + * +3.3V CPU logic
  39 + * +5V logic
  40 + * +12V PCMCIA
  41 + * +12V CCFL
  42 + * +5V standby
  43 + *
  44 + * CCFL is not enabled if temperature values are not within allowed ranges
  45 + *
  46 + * See the list off all parameters in the sysmon_table below
  47 + */
  48 +
  49 +#include <post.h>
  50 +#include <watchdog.h>
  51 +#include <i2c.h>
  52 +
  53 +static int sysmon_temp_invalid = 0;
  54 +
  55 +#if CONFIG_POST & CFG_POST_SYSMON
  56 +
  57 +/* #define DEBUG */
  58 +
  59 +#define RELOC(x) if (x != NULL) x = (void *) ((ulong) (x) + gd->reloc_off)
  60 +
  61 +typedef struct sysmon_s sysmon_t;
  62 +typedef struct sysmon_table_s sysmon_table_t;
  63 +
  64 +static void sysmon_lm87_init (sysmon_t * this);
  65 +static void sysmon_pic_init (sysmon_t * this);
  66 +static uint sysmon_i2c_read (sysmon_t * this, uint addr);
  67 +static uint sysmon_i2c_read_sgn (sysmon_t * this, uint addr);
  68 +static void sysmon_ccfl_disable (sysmon_table_t * this);
  69 +static void sysmon_ccfl_enable (sysmon_table_t * this);
  70 +
  71 +struct sysmon_s
  72 +{
  73 + uchar chip;
  74 + void (*init)(sysmon_t *);
  75 + uint (*read)(sysmon_t *, uint);
  76 +};
  77 +
  78 +static sysmon_t sysmon_lm87 =
  79 + {CFG_I2C_SYSMON_ADDR, sysmon_lm87_init, sysmon_i2c_read};
  80 +static sysmon_t sysmon_lm87_sgn =
  81 + {CFG_I2C_SYSMON_ADDR, sysmon_lm87_init, sysmon_i2c_read_sgn};
  82 +static sysmon_t sysmon_pic =
  83 + {CFG_I2C_PICIO_ADDR, sysmon_pic_init, sysmon_i2c_read};
  84 +
  85 +static sysmon_t * sysmon_list[] =
  86 +{
  87 + &sysmon_lm87,
  88 + &sysmon_lm87_sgn,
  89 + &sysmon_pic,
  90 + NULL
  91 +};
  92 +
  93 +struct sysmon_table_s
  94 +{
  95 + char * name;
  96 + char * unit_name;
  97 + sysmon_t * sysmon;
  98 + void (*exec_before)(sysmon_table_t *);
  99 + void (*exec_after)(sysmon_table_t *);
  100 +
  101 + int unit_div;
  102 + int unit_min;
  103 + int unit_max;
  104 + uint val_mask;
  105 + uint val_min;
  106 + uint val_max;
  107 + int val_valid;
  108 + uint addr;
  109 +};
  110 +
  111 +static sysmon_table_t sysmon_table[] =
  112 +{
  113 + {"Board temperature", " C", &sysmon_lm87_sgn, NULL, sysmon_ccfl_disable,
  114 + 1, -128, 127, 0xFF, 0x58, 0xD5, 0, 0x27},
  115 +
  116 + {"Front temperature", " C", &sysmon_lm87, NULL, sysmon_ccfl_disable,
  117 + 100, -27316, 8984, 0xFF, 0xA4, 0xFC, 0, 0x29},
  118 +
  119 + {"+3.3V CPU logic", "V", &sysmon_lm87, NULL, NULL,
  120 + 1000, 0, 4386, 0xFF, 0xB6, 0xC9, 0, 0x22},
  121 +
  122 + {"+5V logic", "V", &sysmon_lm87, NULL, NULL,
  123 + 1000, 0, 6630, 0xFF, 0xB6, 0xCA, 0, 0x23},
  124 +
  125 + {"+12V PCMCIA", "V", &sysmon_lm87, NULL, NULL,
  126 + 1000, 0, 15460, 0xFF, 0xBC, 0xD0, 0, 0x21},
  127 +
  128 + {"+12V CCFL", "V", &sysmon_lm87, NULL, sysmon_ccfl_enable,
  129 + 1000, 0, 15900, 0xFF, 0xB6, 0xCA, 0, 0x24},
  130 +
  131 + {"+5V standby", "V", &sysmon_pic, NULL, NULL,
  132 + 1000, 0, 6040, 0xFF, 0xC8, 0xDE, 0, 0x7C},
  133 +};
  134 +static int sysmon_table_size = sizeof(sysmon_table) / sizeof(sysmon_table[0]);
  135 +
  136 +static int conversion_done = 0;
  137 +
  138 +
  139 +int sysmon_init_f (void)
  140 +{
  141 + sysmon_t ** l;
  142 + ulong reg;
  143 +
  144 + /* Power on CCFL, PCMCIA */
  145 + reg = pic_read (0x60);
  146 + reg |= 0x09;
  147 + pic_write (0x60, reg);
  148 +
  149 + for (l = sysmon_list; *l; l++)
  150 + {
  151 + (*l)->init(*l);
  152 + }
  153 +
  154 + return 0;
  155 +}
  156 +
  157 +void sysmon_reloc (void)
  158 +{
  159 + DECLARE_GLOBAL_DATA_PTR;
  160 +
  161 + sysmon_t ** l;
  162 + sysmon_table_t * t;
  163 +
  164 + for (l = sysmon_list; *l; l++)
  165 + {
  166 + RELOC(*l);
  167 + RELOC((*l)->init);
  168 + RELOC((*l)->read);
  169 + }
  170 +
  171 + for (t = sysmon_table; t < sysmon_table + sysmon_table_size; t ++)
  172 + {
  173 + RELOC(t->exec_before);
  174 + RELOC(t->exec_after);
  175 + RELOC(t->sysmon);
  176 + }
  177 +}
  178 +
  179 +static char * sysmon_unit_value (sysmon_table_t * s, uint val)
  180 +{
  181 + static char buf[32];
  182 + int unit_val =
  183 + s->unit_min + (s->unit_max - s->unit_min) * val / s->val_mask;
  184 + char * p;
  185 + int dec, frac;
  186 +
  187 + sprintf(buf, "%+d", unit_val / s->unit_div);
  188 +
  189 + frac = (unit_val > 0 ? unit_val : -unit_val) % s->unit_div;
  190 + p = buf + strlen(buf);
  191 +
  192 + dec = s->unit_div;
  193 +
  194 + if (dec != 1)
  195 + {
  196 + *p++ = '.';
  197 + }
  198 +
  199 + for (dec /= 10; dec != 0; dec /= 10)
  200 + {
  201 + *p++ = '0' + frac / dec % 10;
  202 + }
  203 +
  204 + strcpy(p, s->unit_name);
  205 +
  206 + return buf;
  207 +}
  208 +
  209 +static void sysmon_lm87_init (sysmon_t * this)
  210 +{
  211 + uchar val;
  212 +
  213 + /* Detect LM87 chip */
  214 + if (i2c_read(this->chip, 0x40, 1, &val, 1) || (val & 0x80) != 0 ||
  215 + i2c_read(this->chip, 0x3E, 1, &val, 1) || val != 0x02)
  216 + {
  217 + printf("Error: LM87 not found at 0x%02X\n", this->chip);
  218 + return;
  219 + }
  220 +
  221 + /* Configure pins 5,6 as AIN */
  222 + val = 0x03;
  223 + if (i2c_write(this->chip, 0x16, 1, &val, 1))
  224 + {
  225 + printf("Error: can't write LM87 config register\n");
  226 + return;
  227 + }
  228 +
  229 + /* Start monitoring */
  230 + val = 0x01;
  231 + if (i2c_write(this->chip, 0x40, 1, &val, 1))
  232 + {
  233 + printf("Error: can't write LM87 config register\n");
  234 + return;
  235 + }
  236 +}
  237 +
  238 +static void sysmon_pic_init (sysmon_t * this)
  239 +{
  240 +}
  241 +
  242 +static uint sysmon_i2c_read (sysmon_t * this, uint addr)
  243 +{
  244 + uchar val;
  245 + uint res = i2c_read(this->chip, addr, 1, &val, 1);
  246 +
  247 + return res == 0 ? val : -1;
  248 +}
  249 +
  250 +static uint sysmon_i2c_read_sgn (sysmon_t * this, uint addr)
  251 +{
  252 + uchar val;
  253 + return i2c_read(this->chip, addr, 1, &val, 1) == 0 ?
  254 + 128 + (signed char)val : -1;
  255 +}
  256 +
  257 +static void sysmon_ccfl_disable (sysmon_table_t * this)
  258 +{
  259 + if (!this->val_valid)
  260 + {
  261 + sysmon_temp_invalid = 1;
  262 + }
  263 +}
  264 +
  265 +static void sysmon_ccfl_enable (sysmon_table_t * this)
  266 +{
  267 + ulong reg;
  268 +
  269 + if (!sysmon_temp_invalid)
  270 + {
  271 + reg = pic_read (0x60);
  272 + reg |= 0x02;
  273 + pic_write (0x60, reg);
  274 + }
  275 +}
  276 +
  277 +int sysmon_post_test (int flags)
  278 +{
  279 + DECLARE_GLOBAL_DATA_PTR;
  280 +
  281 + int res = 0;
  282 + sysmon_table_t * t;
  283 + uint val;
  284 +
  285 + /*
  286 + * The A/D conversion on the LM87 sensor takes 300 ms.
  287 + */
  288 + if (! conversion_done)
  289 + {
  290 + while (post_time_ms(gd->post_init_f_time) < 300) WATCHDOG_RESET ();
  291 + conversion_done = 1;
  292 + }
  293 +
  294 + for (t = sysmon_table; t < sysmon_table + sysmon_table_size; t ++)
  295 + {
  296 + if (t->exec_before)
  297 + {
  298 + t->exec_before(t);
  299 + }
  300 +
  301 + val = t->sysmon->read(t->sysmon, t->addr);
  302 + t->val_valid = val >= t->val_min && val <= t->val_max;
  303 +
  304 + if (t->exec_after)
  305 + {
  306 + t->exec_after(t);
  307 + }
  308 +
  309 +#ifndef DEBUG
  310 + if (!t->val_valid)
  311 +#endif
  312 + {
  313 + printf("%-17s = %-10s ", t->name, sysmon_unit_value(t, val));
  314 + printf("allowed range");
  315 + printf(" %-8s ..", sysmon_unit_value(t, t->val_min));
  316 + printf(" %-8s", sysmon_unit_value(t, t->val_max));
  317 + printf(" %s\n", t->val_valid ? "OK" : "FAIL");
  318 + }
  319 +
  320 + if (!t->val_valid)
  321 + {
  322 + res = -1;
  323 + }
  324 + }
  325 +
  326 + return res;
  327 +}
  328 +
  329 +#endif /* CONFIG_POST & CFG_POST_SYSMON */
  330 +#endif /* CONFIG_POST */
... ... @@ -42,7 +42,13 @@
42 42 extern int spi_post_test (int flags);
43 43 extern int usb_post_test (int flags);
44 44 extern int spr_post_test (int flags);
  45 +extern int sysmon_post_test (int flags);
45 46  
  47 +extern int sysmon_init_f (void);
  48 +
  49 +extern void sysmon_reloc (void);
  50 +
  51 +
46 52 struct post_test post_list[] =
47 53 {
48 54 #if CONFIG_POST & CFG_POST_CACHE
... ... @@ -52,6 +58,8 @@
52 58 "This test verifies the CPU cache operation.",
53 59 POST_RAM | POST_ALWAYS,
54 60 &cache_post_test,
  61 + NULL,
  62 + NULL,
55 63 CFG_POST_CACHE
56 64 },
57 65 #endif
... ... @@ -62,6 +70,8 @@
62 70 "This test checks the watchdog timer.",
63 71 POST_RAM | POST_POWERON | POST_POWERFAIL | POST_MANUAL | POST_REBOOT,
64 72 &watchdog_post_test,
  73 + NULL,
  74 + NULL,
65 75 CFG_POST_WATCHDOG
66 76 },
67 77 #endif
... ... @@ -72,6 +82,8 @@
72 82 "This test verifies the I2C operation.",
73 83 POST_RAM | POST_ALWAYS,
74 84 &i2c_post_test,
  85 + NULL,
  86 + NULL,
75 87 CFG_POST_I2C
76 88 },
77 89 #endif
... ... @@ -82,6 +94,8 @@
82 94 "This test verifies the RTC operation.",
83 95 POST_RAM | POST_POWERFAIL | POST_MANUAL,
84 96 &rtc_post_test,
  97 + NULL,
  98 + NULL,
85 99 CFG_POST_RTC
86 100 },
87 101 #endif
... ... @@ -92,6 +106,8 @@
92 106 "This test checks RAM.",
93 107 POST_ROM | POST_POWERON | POST_POWERFAIL | POST_PREREL,
94 108 &memory_post_test,
  109 + NULL,
  110 + NULL,
95 111 CFG_POST_MEMORY
96 112 },
97 113 #endif
... ... @@ -103,6 +119,8 @@
103 119 " CPU.",
104 120 POST_RAM | POST_ALWAYS,
105 121 &cpu_post_test,
  122 + NULL,
  123 + NULL,
106 124 CFG_POST_CPU
107 125 },
108 126 #endif
... ... @@ -113,6 +131,8 @@
113 131 "This test verifies the UART operation.",
114 132 POST_RAM | POST_POWERFAIL | POST_MANUAL,
115 133 &uart_post_test,
  134 + NULL,
  135 + NULL,
116 136 CFG_POST_UART
117 137 },
118 138 #endif
... ... @@ -123,6 +143,8 @@
123 143 "This test verifies the ETHERNET operation.",
124 144 POST_RAM | POST_ALWAYS | POST_MANUAL,
125 145 &ether_post_test,
  146 + NULL,
  147 + NULL,
126 148 CFG_POST_ETHER
127 149 },
128 150 #endif
... ... @@ -133,6 +155,8 @@
133 155 "This test verifies the SPI operation.",
134 156 POST_RAM | POST_ALWAYS | POST_MANUAL,
135 157 &spi_post_test,
  158 + NULL,
  159 + NULL,
136 160 CFG_POST_SPI
137 161 },
138 162 #endif
... ... @@ -143,6 +167,8 @@
143 167 "This test verifies the USB operation.",
144 168 POST_RAM | POST_ALWAYS | POST_MANUAL,
145 169 &usb_post_test,
  170 + NULL,
  171 + NULL,
146 172 CFG_POST_USB
147 173 },
148 174 #endif
149 175  
... ... @@ -153,7 +179,21 @@
153 179 "This test checks SPR contents.",
154 180 POST_ROM | POST_ALWAYS | POST_PREREL,
155 181 &spr_post_test,
  182 + NULL,
  183 + NULL,
156 184 CFG_POST_SPR
  185 + },
  186 +#endif
  187 +#if CONFIG_POST & CFG_POST_SYSMON
  188 + {
  189 + "SYSMON test",
  190 + "sysmon",
  191 + "This test monitors system hardware.",
  192 + POST_RAM | POST_ALWAYS,
  193 + &sysmon_post_test,
  194 + &sysmon_init_f,
  195 + &sysmon_reloc,
  196 + CFG_POST_SYSMON
157 197 },
158 198 #endif
159 199 };