summaryrefslogtreecommitdiff
path: root/post/board/lwmon5/watchdog.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2008-04-25 11:32:01 +0200
committerWolfgang Denk <wd@denx.de>2008-04-25 11:32:01 +0200
commit4b7a6dd89633d60dc4b58476d5ce48247f82a3ca (patch)
treed3cfeccec77867d855289809d6a472617d16c0cc /post/board/lwmon5/watchdog.c
parent926662762e5d280f6a9caed8dd9f49be2ebcaf2f (diff)
parenta6e6fc610e39dec41b79680413d4ed38145bd3c8 (diff)
downloadu-boot-imx-4b7a6dd89633d60dc4b58476d5ce48247f82a3ca.zip
u-boot-imx-4b7a6dd89633d60dc4b58476d5ce48247f82a3ca.tar.gz
u-boot-imx-4b7a6dd89633d60dc4b58476d5ce48247f82a3ca.tar.bz2
Merge branch 'master' of /home/wd/git/u-boot/lwmon5
Conflicts: common/cmd_bootm.c common/cmd_log.c include/common.h post/board/lwmon5/Makefile post/board/lwmon5/dsp.c post/board/lwmon5/dspic.c post/board/lwmon5/fpga.c post/board/lwmon5/gdc.c post/board/lwmon5/sysmon.c post/board/lwmon5/watchdog.c Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'post/board/lwmon5/watchdog.c')
-rw-r--r--post/board/lwmon5/watchdog.c47
1 files changed, 19 insertions, 28 deletions
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 */