X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=post%2Fboard%2Flwmon5%2Fwatchdog.c;h=1332da21d05fcb60131e8bfda64a546cbd3026e6;hb=d4db3b86a5e090e21db710bedbbe3e50d4c56428;hp=1246278a58195484f28f06fb09cd6863f6bfe00f;hpb=84666476841cef3ef6df5c5a2a110d43b0936999;p=platform%2Fkernel%2Fu-boot.git diff --git a/post/board/lwmon5/watchdog.c b/post/board/lwmon5/watchdog.c index 1246278..1332da2 100644 --- a/post/board/lwmon5/watchdog.c +++ b/post/board/lwmon5/watchdog.c @@ -3,23 +3,7 @@ * * Developed for DENX Software Engineering GmbH * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * SPDX-License-Identifier: GPL-2.0+ */ #include @@ -31,34 +15,37 @@ #include -#if CONFIG_POST & CFG_POST_WATCHDOG +#if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG #include -#include +#include #include static uint watchdog_magic_read(void) { - return in_be32((void *)CFG_WATCHDOG_FLAGS_ADDR) & - CFG_WATCHDOG_MAGIC_MASK; + return in_be32((void *)CONFIG_SYS_WATCHDOG_FLAGS_ADDR) & + CONFIG_SYS_WATCHDOG_MAGIC_MASK; } static void watchdog_magic_write(uint value) { - out_be32((void *)CFG_WATCHDOG_FLAGS_ADDR, value | - (in_be32((void *)CFG_WATCHDOG_FLAGS_ADDR) & - ~CFG_WATCHDOG_MAGIC_MASK)); + out_be32((void *)CONFIG_SYS_WATCHDOG_FLAGS_ADDR, value | + (in_be32((void *)CONFIG_SYS_WATCHDOG_FLAGS_ADDR) & + ~CONFIG_SYS_WATCHDOG_MAGIC_MASK)); } int sysmon1_post_test(int flags) { - if (gpio_read_in_bit(CFG_GPIO_SYSMON_STATUS) == 0) { + if (gpio_read_in_bit(CONFIG_SYS_GPIO_SYSMON_STATUS) == 0) { /* * 3.1. GPIO62 is low * Assuming system voltage failure. */ - post_log("Abnormal voltage detected (GPIO62)\n"); + post_log("sysmon1 Abnormal voltage detected (GPIO62)\n"); + post_log("POST sysmon1 FAILED\n"); return 1; + } else { + post_log("sysmon1 PASSED\n"); } return 0; @@ -79,7 +66,7 @@ int lwmon5_watchdog_post_test(int flags) return 1; } - if (watchdog_magic_read() != CFG_WATCHDOG_MAGIC) { + if (watchdog_magic_read() != CONFIG_SYS_WATCHDOG_MAGIC) { /* 3.2. Scratch register 1 differs from magic value 0x1248xxxx * Assuming PowerOn */ @@ -88,18 +75,18 @@ int lwmon5_watchdog_post_test(int flags) ulong time; /* 3.2.1. Set magic value to scratch register */ - watchdog_magic_write(CFG_WATCHDOG_MAGIC); + watchdog_magic_write(CONFIG_SYS_WATCHDOG_MAGIC); ints = disable_interrupts (); /* 3.2.2. strobe watchdog once */ WATCHDOG_RESET(); - out_be32((void *)CFG_WATCHDOG_TIME_ADDR, 0); + out_be32((void *)CONFIG_SYS_WATCHDOG_TIME_ADDR, 0); /* 3.2.3. save time of strobe in scratch register 2 */ base = post_time_ms (0); /* 3.2.4. Wait for 150 ms (enough for reset to happen) */ while ((time = post_time_ms (base)) < 150) - out_be32((void *)CFG_WATCHDOG_TIME_ADDR, time); + out_be32((void *)CONFIG_SYS_WATCHDOG_TIME_ADDR, time); if (ints) enable_interrupts (); @@ -116,13 +103,19 @@ int lwmon5_watchdog_post_test(int flags) */ 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; + time = in_be32((void *)CONFIG_SYS_WATCHDOG_TIME_ADDR); + if (time > 90 ) { /* ms*/ + post_log("hw watchdog time : %u ms, passed ", time); + /* 3.3.2. Set scratch register 1 to 0x0000xxxx */ + watchdog_magic_write(0); + return 0; + } else { + /*test minimum watchdogtime */ + post_log("hw watchdog time : %u ms, failed ", time); + return 2; + } } return -1; } -#endif /* CONFIG_POST & CFG_POST_WATCHDOG */ +#endif /* CONFIG_POST & CONFIG_SYS_POST_WATCHDOG */