diff options
Diffstat (limited to 'post/board')
-rw-r--r-- | post/board/lwmon/sysmon.c | 3 | ||||
-rw-r--r-- | post/board/lwmon5/Makefile | 3 | ||||
-rw-r--r-- | post/board/lwmon5/dsp.c | 4 | ||||
-rw-r--r-- | post/board/lwmon5/dspic.c | 33 | ||||
-rw-r--r-- | post/board/lwmon5/fpga.c | 3 | ||||
-rw-r--r-- | post/board/lwmon5/gdc.c | 3 | ||||
-rw-r--r-- | post/board/lwmon5/sysmon.c | 44 | ||||
-rw-r--r-- | post/board/lwmon5/watchdog.c | 47 | ||||
-rw-r--r-- | post/board/netta/codec.c | 3 | ||||
-rw-r--r-- | post/board/netta/dsp.c | 3 |
10 files changed, 50 insertions, 96 deletions
diff --git a/post/board/lwmon/sysmon.c b/post/board/lwmon/sysmon.c index f61d598..ea8b5a9 100644 --- a/post/board/lwmon/sysmon.c +++ b/post/board/lwmon/sysmon.c @@ -24,8 +24,6 @@ #include <post.h> #include <common.h> -#ifdef CONFIG_POST - /* * SYSMON test * @@ -328,4 +326,3 @@ int sysmon_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_SYSMON */ -#endif /* CONFIG_POST */ diff --git a/post/board/lwmon5/Makefile b/post/board/lwmon5/Makefile index 5a92d1c..3cb6426 100644 --- a/post/board/lwmon5/Makefile +++ b/post/board/lwmon5/Makefile @@ -20,9 +20,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA +include $(TOPDIR)/include/autoconf.mk LIB = libpostlwmon5.a -COBJS = sysmon.o watchdog.o dspic.o fpga.o dsp.o gdc.o +COBJS-$(CONFIG_HAS_POST) += sysmon.o watchdog.o dspic.o fpga.o dsp.o gdc.o include $(TOPDIR)/post/rules.mk diff --git a/post/board/lwmon5/dsp.c b/post/board/lwmon5/dsp.c index 1946f09..a96ac7d 100644 --- a/post/board/lwmon5/dsp.c +++ b/post/board/lwmon5/dsp.c @@ -24,11 +24,8 @@ #include <common.h> -#ifdef CONFIG_POST - #include <post.h> - #if CONFIG_POST & CFG_POST_DSP #include <asm/io.h> @@ -54,4 +51,3 @@ int dsp_post_test(int flags) } #endif /* CONFIG_POST & CFG_POST_DSP */ -#endif /* CONFIG_POST */ diff --git a/post/board/lwmon5/dspic.c b/post/board/lwmon5/dspic.c index fcbbc60..eb1c31c 100644 --- a/post/board/lwmon5/dspic.c +++ b/post/board/lwmon5/dspic.c @@ -24,8 +24,6 @@ #include <common.h> -#ifdef CONFIG_POST - /* There are two tests for dsPIC currently implemented: * 1. dsPIC ready test. Done in board_early_init_f(). Only result verified here. * 2. dsPIC POST result test. This test gets dsPIC POST codes and version. @@ -59,27 +57,25 @@ int dspic_init_post_test(int flags) #if CONFIG_POST & CFG_POST_BSPEC2 /* Read a register from the dsPIC. */ -int dspic_read(ushort reg, ushort *data) +int dspic_read(ushort reg) { - uchar buf[sizeof(*data)]; - int rval; - - rval = i2c_read(CFG_I2C_DSPIC_IO_ADDR, reg, sizeof(reg), - buf, sizeof(*data)); + uchar buf[2]; - *data = (buf[0] << 8) | buf[1]; + if (i2c_read(CFG_I2C_DSPIC_IO_ADDR, reg, 2, buf, 2)) + return -1; - return rval; + return (uint)((buf[0] << 8) | buf[1]); } /* Verify error codes regs, display version */ int dspic_post_test(int flags) { - ushort data; + int data; int ret = 0; post_log("\n"); - if (dspic_read(DSPIC_VERSION_REG, &data)) { + data = dspic_read(DSPIC_VERSION_REG); + if (data == -1) { post_log("dsPIC : failed read version\n"); ret = 1; } else { @@ -87,24 +83,23 @@ int dspic_post_test(int flags) (data >> 8) & 0xFF, data & 0xFF); } - if (dspic_read(DSPIC_POST_ERROR_REG, &data)) { + data = dspic_read(DSPIC_POST_ERROR_REG); + if (data != 0) ret = 1; + if (data == -1) { post_log("dsPIC : failed read POST code\n"); } else { post_log("dsPIC POST code 0x%04X\n", data); } - if (data != 0) - ret = 1; - if (dspic_read(DSPIC_SYS_ERROR_REG, &data)) { + data = dspic_read(DSPIC_SYS_ERROR_REG); + if (data == -1) { post_log("dsPIC : failed read system error\n"); ret = 1; - } else if (data != 0) { + } else { post_log("dsPIC SYS-ERROR code: 0x%04X\n", data); - ret = 1; } return ret; } #endif /* CONFIG_POST & CFG_POST_BSPEC2 */ -#endif /* CONFIG_POST */ diff --git a/post/board/lwmon5/fpga.c b/post/board/lwmon5/fpga.c index 2d95b5e..b48390b 100644 --- a/post/board/lwmon5/fpga.c +++ b/post/board/lwmon5/fpga.c @@ -23,8 +23,6 @@ */ #include <common.h> -#ifdef CONFIG_POST - /* This test performs testing of FPGA SCRATCH register, * gets FPGA version and run get_ram_size() on FPGA memory */ @@ -94,4 +92,3 @@ int fpga_post_test(int flags) } #endif /* CONFIG_POST & CFG_POST_BSPEC3 */ -#endif /* CONFIG_POST */ diff --git a/post/board/lwmon5/gdc.c b/post/board/lwmon5/gdc.c index 4af6a7a..bc16685 100644 --- a/post/board/lwmon5/gdc.c +++ b/post/board/lwmon5/gdc.c @@ -23,8 +23,6 @@ */ #include <common.h> -#ifdef CONFIG_POST - /* This test attempts to verify board GDC. A scratch register tested, then * simple memory test (get_ram_size()) run over GDC memory. */ @@ -96,4 +94,3 @@ int gdc_post_test(int flags) return ret; } #endif /* CONFIG_POST & CFG_POST_BSPEC4 */ -#endif /* CONFIG_POST */ diff --git a/post/board/lwmon5/sysmon.c b/post/board/lwmon5/sysmon.c index 0cf1cf2..15661e3 100644 --- a/post/board/lwmon5/sysmon.c +++ b/post/board/lwmon5/sysmon.c @@ -25,8 +25,6 @@ #include <post.h> #include <common.h> -#ifdef CONFIG_POST - /* * SYSMON test * @@ -34,9 +32,9 @@ * The test passes when all the following voltages and temperatures * are within allowed ranges: * - * Temperature -40 .. +85 C - * +5V +4.75 .. +5.25 V - * +5V standby +4.75 .. +5.25 V + * Temperature -40 .. +85 C + * +5V +4.75 .. +5.25 V + * +5V standby +4.75 .. +5.25 V * * LCD backlight is not enabled if temperature values are not within * allowed ranges (-30 .. + 80). The brightness of backlite can be @@ -58,7 +56,7 @@ DECLARE_GLOBAL_DATA_PTR; /* from dspic.c */ -extern int dspic_read(ushort reg, ushort *data); +extern int dspic_read(ushort reg); #define RELOC(x) if (x != NULL) x = (void *) ((ulong) (x) + gd->reloc_off) @@ -67,7 +65,6 @@ typedef struct sysmon_table_s sysmon_table_t; static void sysmon_dspic_init (sysmon_t * this); static int sysmon_dspic_read (sysmon_t * this, uint addr); -static int sysmon_dspic_read_sgn (sysmon_t * this, uint addr); static void sysmon_backlight_disable (sysmon_table_t * this); struct sysmon_s @@ -80,13 +77,9 @@ struct sysmon_s static sysmon_t sysmon_dspic = {CFG_I2C_DSPIC_IO_ADDR, sysmon_dspic_init, sysmon_dspic_read}; -static sysmon_t sysmon_dspic_sgn = - {CFG_I2C_DSPIC_IO_ADDR, sysmon_dspic_init, sysmon_dspic_read_sgn}; - static sysmon_t * sysmon_list[] = { &sysmon_dspic, - &sysmon_dspic_sgn, NULL }; @@ -114,17 +107,17 @@ struct sysmon_table_s static sysmon_table_t sysmon_table[] = { - {"Temperature", " C", &sysmon_dspic_sgn, NULL, sysmon_backlight_disable, + {"Temperature", " C", &sysmon_dspic, NULL, sysmon_backlight_disable, 1, 1, -32768, 32767, 0xFFFF, 0x8000-40, 0x8000+85, 0, - 0x8000-30, 0x8000+80, 0, 0x12BC}, + 0x8000-30, 0x8000+80, 0, 0x12BC}, {"+ 5 V", "V", &sysmon_dspic, NULL, NULL, - 100, 1000, 0, 0xFFFF, 0xFFFF, 4750, 5250, 0, - 4750, 5250, 0, 0x12CA}, + 100, 1000, -0x8000, 0x7FFF, 0xFFFF, 0x8000+4750, 0x8000+5250, 0, + 0x8000+4750, 0x8000+5250, 0, 0x12CA}, {"+ 5 V standby", "V", &sysmon_dspic, NULL, NULL, - 100, 1000, 0, 0xFFFF, 0xFFFF, 4750, 5250, 0, - 4750, 5250, 0, 0x12C6}, + 100, 1000, -0x8000, 0x7FFF, 0xFFFF, 0x8000+4750, 0x8000+5250, 0, + 0x8000+4750, 0x8000+5250, 0, 0x12C6}, }; static int sysmon_table_size = sizeof(sysmon_table) / sizeof(sysmon_table[0]); @@ -161,7 +154,9 @@ static char *sysmon_unit_value (sysmon_table_t *s, uint val) static char buf[32]; char *p, sign; int decimal, frac; - int unit_val = + int unit_val; + + unit_val = s->unit_min + (s->unit_max - s->unit_min) * val / s->val_mask; if (val == -1) @@ -197,18 +192,10 @@ static void sysmon_dspic_init (sysmon_t * this) static int sysmon_dspic_read (sysmon_t * this, uint addr) { - ushort data; - - return (dspic_read(addr, &data)) ? -1 : data; -} - -static int sysmon_dspic_read_sgn (sysmon_t * this, uint addr) -{ - ushort data; + int res = dspic_read(addr); /* To fit into the table range we should add 0x8000 */ - return (dspic_read(addr, &data)) ? -1 : - (signed short)data + 0x8000; + return (res == -1) ? -1 : (res + 0x8000); } static void sysmon_backlight_disable (sysmon_table_t * this) @@ -256,4 +243,3 @@ int sysmon_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_SYSMON */ -#endif /* CONFIG_POST */ diff --git a/post/board/lwmon5/watchdog.c b/post/board/lwmon5/watchdog.c index 899fbfb..16c01be 100644 --- a/post/board/lwmon5/watchdog.c +++ b/post/board/lwmon5/watchdog.c @@ -24,14 +24,11 @@ #include <common.h> -/* - * This test verifies if the reason of last reset was an abnormal voltage +/* This test verifies if the reason of last reset was an abnormal voltage * condition, than it performs watchdog test, measuing time required to * trigger watchdog reset. */ -#ifdef CONFIG_POST - #include <post.h> #if CONFIG_POST & CFG_POST_WATCHDOG @@ -55,9 +52,8 @@ static void watchdog_magic_write(uint value) int sysmon1_post_test(int flags) { - if (gpio_read_in_bit(CFG_GPIO_SYSMON_STATUS) == 0) { - /* - * 3.1. GPIO62 is low + if (gpio_read_in_bit(CFG_GPIO_SYSMON_STATUS)) { + /* 3.1. GPIO62 is low * Assuming system voltage failure. */ post_log("Abnormal voltage detected (GPIO62)\n"); @@ -69,14 +65,11 @@ int sysmon1_post_test(int flags) int lwmon5_watchdog_post_test(int flags) { - ulong time; - /* On each reset scratch register 1 should be tested, * but first test GPIO62: */ if (!(flags & POST_MANUAL) && sysmon1_post_test(flags)) { - /* - * 3.1. GPIO62 is low + /* 3.1. GPIO62 is low * Assuming system voltage failure. */ /* 3.1.1. Set scratch register 1 to 0x0000xxxx */ @@ -86,12 +79,12 @@ int lwmon5_watchdog_post_test(int flags) } if (watchdog_magic_read() != CFG_WATCHDOG_MAGIC) { - /* - * 3.2. Scratch register 1 differs from magic value 0x1248xxxx + /* 3.2. Scratch register 1 differs from magic value 0x1248xxxx * Assuming PowerOn */ int ints; ulong base; + ulong time; /* 3.2.1. Set magic value to scratch register */ watchdog_magic_write(CFG_WATCHDOG_MAGIC); @@ -109,28 +102,26 @@ int lwmon5_watchdog_post_test(int flags) if (ints) enable_interrupts (); - /* - * 3.2.5. Reset didn't happen. - Set 0x0000xxxx + /* 3.2.5. Reset didn't happen. - Set 0x0000xxxx * into scratch register 1 */ watchdog_magic_write(0); /* 3.2.6. Mark test as failed. */ post_log("hw watchdog time : %u ms, failed ", time); return 2; + } else { + /* 3.3. Scratch register matches magic value 0x1248xxxx + * Assume this is watchdog-initiated reset + */ + ulong time; + /* 3.3.1. So, the test succeed, save measured time to syslog. */ + time = in_be32((void *)CFG_WATCHDOG_TIME_ADDR); + post_log("hw watchdog time : %u ms, passed ", time); + /* 3.3.2. Set scratch register 1 to 0x0000xxxx */ + watchdog_magic_write(0); + return 0; } - - /* - * 3.3. Scratch register matches magic value 0x1248xxxx - * Assume this is watchdog-initiated reset - */ - /* 3.3.1. So, the test succeed, save measured time to syslog. */ - time = in_be32((void *)CFG_WATCHDOG_TIME_ADDR); - post_log("hw watchdog time : %u ms, passed ", time); - /* 3.3.2. Set scratch register 1 to 0x0000xxxx */ - watchdog_magic_write(0); - - return 0; + return -1; } #endif /* CONFIG_POST & CFG_POST_WATCHDOG */ -#endif /* CONFIG_POST */ diff --git a/post/board/netta/codec.c b/post/board/netta/codec.c index e881752..115e331 100644 --- a/post/board/netta/codec.c +++ b/post/board/netta/codec.c @@ -31,8 +31,6 @@ * in the board specific function. */ -#ifdef CONFIG_POST - #include <post.h> #if CONFIG_POST & CFG_POST_CODEC @@ -45,4 +43,3 @@ int codec_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_CODEC */ -#endif /* CONFIG_POST */ diff --git a/post/board/netta/dsp.c b/post/board/netta/dsp.c index 63531a2..dcef4e8 100644 --- a/post/board/netta/dsp.c +++ b/post/board/netta/dsp.c @@ -31,8 +31,6 @@ * in the board specific function. */ -#ifdef CONFIG_POST - #include <post.h> #if CONFIG_POST & CFG_POST_DSP @@ -45,4 +43,3 @@ int dsp_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_DSP */ -#endif /* CONFIG_POST */ |