diff options
author | wdenk <wdenk> | 2003-08-05 17:43:17 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2003-08-05 17:43:17 +0000 |
commit | bdccc4fedcf9c5fc1f06e8f833d792198c9d04ae (patch) | |
tree | 00c1b93f6731d838eae4f8f688d4f95c14471d0a /common/main.c | |
parent | 96dd9af4c7c5669924c2e40734b246f207b9a8b4 (diff) | |
download | u-boot-imx-bdccc4fedcf9c5fc1f06e8f833d792198c9d04ae.zip u-boot-imx-bdccc4fedcf9c5fc1f06e8f833d792198c9d04ae.tar.gz u-boot-imx-bdccc4fedcf9c5fc1f06e8f833d792198c9d04ae.tar.bz2 |
* Map ISP1362 USB OTG controller for NSCU board
* Patch by Brad Parker, 02 Aug 2003:
fix sc520_cdp problems
* Implement Boot Cycle Detection (Req. 2.3 of OSDL CGL Reqirements)
* Allow erase command to cross flash bank boundaries
Diffstat (limited to 'common/main.c')
-rw-r--r-- | common/main.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/common/main.c b/common/main.c index 5ddecca..d08bc47 100644 --- a/common/main.c +++ b/common/main.c @@ -32,6 +32,8 @@ #include <hush.h> #endif +#include <post.h> + #if defined(CONFIG_BOOT_RETRY_TIME) && defined(CONFIG_RESET_TO_RETRY) extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* for do_reset() prototype */ #endif @@ -258,6 +260,12 @@ void main_loop (void) #ifdef CONFIG_PREBOOT char *p; #endif +#ifdef CONFIG_BOOTCOUNT_LIMIT + unsigned long bootcount = 0; + unsigned long bootlimit = 0; + char *bcs; + char bcs_set[16]; +#endif /* CONFIG_BOOTCOUNT_LIMIT */ #if defined(CONFIG_VFD) && defined(VFD_TEST_LOGO) ulong bmp = 0; /* default bitmap */ @@ -270,6 +278,16 @@ void main_loop (void) trab_vfd (bmp); #endif /* CONFIG_VFD && VFD_TEST_LOGO */ +#ifdef CONFIG_BOOTCOUNT_LIMIT + bootcount = bootcount_load(); + bootcount++; + bootcount_store (bootcount); + sprintf (bcs_set, "%lu", bootcount); + setenv ("bootcount", bcs_set); + bcs = getenv ("bootlimit"); + bootlimit = bcs ? simple_strtoul (bcs, NULL, 10) : 0; +#endif /* CONFIG_BOOTCOUNT_LIMIT */ + #ifdef CONFIG_MODEM_SUPPORT debug ("DEBUG: main_loop: do_mdm_init=%d\n", do_mdm_init); if (do_mdm_init) { @@ -322,7 +340,15 @@ void main_loop (void) init_cmd_timeout (); # endif /* CONFIG_BOOT_RETRY_TIME */ - s = getenv ("bootcmd"); +#ifdef CONFIG_BOOTCOUNT_LIMIT + if (bootlimit && (bootcount > bootlimit)) { + printf ("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n", + (unsigned)bootlimit); + s = getenv ("altbootcmd"); + } + else +#endif /* CONFIG_BOOTCOUNT_LIMIT */ + s = getenv ("bootcmd"); debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>"); |