From: wdenk Date: Sat, 28 Jun 2003 09:10:42 +0000 (+0000) Subject: * Allow to call sysmon function interactively X-Git-Tag: LABEL_2003_06_28_1800-stable X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ed579b4210cc5341d511e090239ca697e91ad728;p=oweals%2Fu-boot.git * Allow to call sysmon function interactively * PIC on LWMON board needs delay after power-on * Add missing RSR definitions for MPC8xx * Improve log buffer handling: guarantee clean reset after power-on --- diff --git a/CHANGELOG b/CHANGELOG index eaa5cc326c..513d04ab6b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,14 @@ Changes since U-Boot 0.4.0: ====================================================================== +* Allow to call sysmon function interactively + +* PIC on LWMON board needs delay after power-on + +* Add missing RSR definitions for MPC8xx + +* Improve log buffer handling: guarantee clean reset after power-on + * Add support for EXBITGEN board * Add support for SL8245 board diff --git a/board/lwmon/lwmon.c b/board/lwmon/lwmon.c index b359ec758d..f1544ae38e 100644 --- a/board/lwmon/lwmon.c +++ b/board/lwmon/lwmon.c @@ -38,6 +38,7 @@ V* Verification: dzu@denx.de #include #include #include +#include #include #include @@ -72,9 +73,9 @@ const uint sdram_table[] = /* * SDRAM Initialization (offset 5 in UPM RAM) * - * This is no UPM entry point. The following definition uses - * the remaining space to establish an initialization - * sequence, which is executed by a RUN command. + * This is no UPM entry point. The following definition uses + * the remaining space to establish an initialization + * sequence, which is executed by a RUN command. * */ 0x1FF5FC34, 0xEFEABC34, 0x1FB57C35, /* last */ @@ -120,9 +121,9 @@ const uint sdram_table[] = /* * SDRAM Initialization (offset 5 in UPM RAM) * - * This is no UPM entry point. The following definition uses - * the remaining space to establish an initialization - * sequence, which is executed by a RUN command. + * This is no UPM entry point. The following definition uses + * the remaining space to establish an initialization + * sequence, which is executed by a RUN command. * */ 0x1FF5FC34, 0xEFEABC34, 0x1FB57C35, /* last */ @@ -131,7 +132,7 @@ const uint sdram_table[] = */ 0x0E2DBC04, 0x10AF7C04, 0xF0AFFC00, 0xF0AFFC00, 0xF1AFFC00, 0xEFBAFC00, 0x1FF5FC47, /* last */ - _NOT_USED_, + _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, /* @@ -145,7 +146,7 @@ const uint sdram_table[] = */ 0x0E29BC04, 0x10A77C00, 0xF0AFFC00, 0xF0AFFC00, 0xE1BAFC04, 0x1FF5FC47, /* last */ - _NOT_USED_, _NOT_USED_, + _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, /* @@ -510,9 +511,12 @@ static void kbd_init (void) int i; i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE); - + gd->kbd_status = 0; + /* Forced by PIC. Delays <= 175us loose */ + udelay(1000); + /* Read initial keyboard error code */ val = KEYBD_CMD_READ_STATUS; i2c_write (kbd_addr, 0, 0, &val, 1); @@ -542,13 +546,13 @@ static void kbd_init (void) /* * Read current keyboard state. * - * After the error reset it may take some time before the - * keyboard PIC picks up a valid keyboard scan - the total - * scan time is approx. 1.6 ms (information by Martin Rajek, - * 28 Sep 2002). We read a couple of times for the keyboard - * to stabilize, using a big enough delay. - * 10 times should be enough. If the data is still changing, - * we use what we get :-( + * After the error reset it may take some time before the + * keyboard PIC picks up a valid keyboard scan - the total + * scan time is approx. 1.6 ms (information by Martin Rajek, + * 28 Sep 2002). We read a couple of times for the keyboard + * to stabilize, using a big enough delay. + * 10 times should be enough. If the data is still changing, + * we use what we get :-( */ memset (tmp_data, 0xFF, KEYBD_DATALEN); /* impossible value */ @@ -848,12 +852,6 @@ int do_pic (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) printf ("Usage:\n%s\n", cmdtp->usage); return 1; } -cmd_tbl_t U_BOOT_CMD(pic) = MK_CMD_ENTRY( - "pic", 4, 1, do_pic, - "pic - read and write PIC registers\n", - "read reg - read PIC register `reg'\n" - "pic write reg val - write value `val' to PIC register `reg'\n" -); /*********************************************************************** F* Function: int do_kbd (cmd_tbl_t *cmdtp, int flag, @@ -907,12 +905,6 @@ int do_kbd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -cmd_tbl_t U_BOOT_CMD(kdb) = MK_CMD_ENTRY( - "kbd", 1, 1, do_kbd, - "kbd - read keyboard status\n", - NULL -); - /* Read and set LSB switch */ #define CFG_PC_TXD1_ENA 0x0008 /* PC.12 */ @@ -979,14 +971,6 @@ int do_lsb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } -cmd_tbl_t U_BOOT_CMD(lsb) = MK_CMD_ENTRY( - "lsb", 2, 1, do_lsb, - "lsb - check and set LSB switch\n", - "on - switch LSB on\n" - "lsb off - switch LSB off\n" - "lsb - print current setting\n" -); - #endif /* CFG_CMD_BSP */ /*----------------------------- Utilities -----------------------------*/ diff --git a/common/cmd_log.c b/common/cmd_log.c index b07dc7533c..ce414b16dd 100644 --- a/common/cmd_log.c +++ b/common/cmd_log.c @@ -74,18 +74,24 @@ static unsigned long *ext_logged_chars; void logbuff_init_ptrs (void) { DECLARE_GLOBAL_DATA_PTR; - unsigned long *ext_tag; char *s; log_buf = (unsigned char *)(gd->bd->bi_memsize-LOGBUFF_LEN); - ext_tag = (unsigned long *)(log_buf)-4; ext_log_start = (unsigned long *)(log_buf)-3; ext_log_size = (unsigned long *)(log_buf)-2; ext_logged_chars = (unsigned long *)(log_buf)-1; - if (*ext_tag!=LOGBUFF_MAGIC) { +#ifdef CONFIG_POST + /* The post routines have setup the word so we can simply test it */ + if (post_word_load () & POST_POWERON) { logged_chars = log_size = log_start = 0; - *ext_tag = LOGBUFF_MAGIC; } +#else + /* No post routines, so we do our own checking */ + if (post_word_load () != LOGBUFF_MAGIC) { + logged_chars = log_size = log_start = 0; + post_word_store (LOGBUFF_MAGIC); + } +#endif /* Initialize default loglevel if present */ if ((s = getenv ("loglevel")) != NULL) console_loglevel = (int)simple_strtoul (s, NULL, 10); @@ -195,16 +201,7 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } } -#if defined(CONFIG_LOGBUFFER) -cmd_tbl_t U_BOOT_CMD(LOG) = MK_CMD_ENTRY( - "log", 255, 1, do_log, - "log - manipulate logbuffer\n", - "log info - show pointer details\n" - "log reset - clear contents\n" - "log show - show contents\n" - "log append - append to the logbuffer\n" -); -#endif /* CONFIG_LOGBUFFER */ + static int logbuff_printk(const char *line) { int i; diff --git a/cpu/mpc8260/commproc.c b/cpu/mpc8260/commproc.c index dcbffc4412..c523ee4dca 100644 --- a/cpu/mpc8260/commproc.c +++ b/cpu/mpc8260/commproc.c @@ -188,7 +188,7 @@ m8260_cpm_extcbrg(uint brg, uint rate, uint extclk, int pinsel) *bp |= CPM_BRG_EXTC_CLK5_15; } -#ifdef CONFIG_POST +#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER) void post_word_store (ulong a) { @@ -206,4 +206,4 @@ ulong post_word_load (void) return *save_addr; } -#endif /* CONFIG_POST */ +#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/ diff --git a/cpu/mpc8xx/commproc.c b/cpu/mpc8xx/commproc.c index 62a4458a5e..37c72a7273 100644 --- a/cpu/mpc8xx/commproc.c +++ b/cpu/mpc8xx/commproc.c @@ -91,7 +91,7 @@ uint dpram_base_align (uint align) } #endif /* CFG_ALLOC_DPRAM */ -#ifdef CONFIG_POST +#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER) void post_word_store (ulong a) { @@ -109,4 +109,4 @@ ulong post_word_load (void) return *(volatile ulong *) save_addr; } -#endif /* CONFIG_POST */ +#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/ diff --git a/include/mpc8xx.h b/include/mpc8xx.h index ef6d3f7dd9..1a65f10ca2 100644 --- a/include/mpc8xx.h +++ b/include/mpc8xx.h @@ -117,6 +117,20 @@ #define PISCR_PTE 0x0001 /* Periodic Timer Enable */ #endif +/*----------------------------------------------------------------------- + * RSR - Reset Status Register 5-4 + */ +#define RSR_JTRS 0x01000000 /* JTAG Reset Status */ +#define RSR_DBSRS 0x02000000 /* Debug Port Soft Reset Status */ +#define RSR_DBHRS 0x04000000 /* Debug Port Hard Reset Status */ +#define RSR_CSRS 0x08000000 /* Check Stop Reset Status */ +#define RSR_SWRS 0x10000000 /* Software Watchdog Reset Status*/ +#define RSR_LLRS 0x20000000 /* Loss-of-Lock Reset Status */ +#define RSR_ESRS 0x40000000 /* External Soft Reset Status */ +#define RSR_EHRS 0x80000000 /* External Hard Reset Status */ + +#define RSR_ALLBITS (RSR_JTRS|RSR_DBSRS|RSR_DBHRS|RSR_CSRS|RSR_SWRS|RSR_LLRS|RSR_ESRS|RSR_EHRS) + /*----------------------------------------------------------------------- * PLPRCR - PLL, Low-Power, and Reset Control Register 15-30 */ diff --git a/post/sysmon.c b/post/sysmon.c index 30a5cb20a7..3d77bce353 100644 --- a/post/sysmon.c +++ b/post/sysmon.c @@ -32,7 +32,7 @@ * This test performs the system hardware monitoring. * The test passes when all the following voltages and temperatures * are within allowed ranges: - * + * * Board temperature * Front temperature * +3.3V CPU logic @@ -40,7 +40,7 @@ * +12V PCMCIA * +12V CCFL * +5V standby - * + * * CCFL is not enabled if temperature values are not within allowed ranges * * See the list off all parameters in the sysmon_table below @@ -150,7 +150,7 @@ int sysmon_init_f (void) { (*l)->init(*l); } - + return 0; } @@ -185,24 +185,24 @@ static char * sysmon_unit_value (sysmon_table_t * s, uint val) int dec, frac; sprintf(buf, "%+d", unit_val / s->unit_div); - + frac = (unit_val > 0 ? unit_val : -unit_val) % s->unit_div; p = buf + strlen(buf); - + dec = s->unit_div; - + if (dec != 1) { *p++ = '.'; } - + for (dec /= 10; dec != 0; dec /= 10) { *p++ = '0' + frac / dec % 10; } - + strcpy(p, s->unit_name); - + return buf; } @@ -217,7 +217,7 @@ static void sysmon_lm87_init (sysmon_t * this) printf("Error: LM87 not found at 0x%02X\n", this->chip); return; } - + /* Configure pins 5,6 as AIN */ val = 0x03; if (i2c_write(this->chip, 0x16, 1, &val, 1)) @@ -306,9 +306,7 @@ int sysmon_post_test (int flags) t->exec_after(t); } -#ifndef DEBUG - if (!t->val_valid) -#endif + if ((!t->val_valid) || (flags & POST_MANUAL)) { printf("%-17s = %-10s ", t->name, sysmon_unit_value(t, val)); printf("allowed range");