diff options
author | Hannes Schmelzer | 2018-07-06 15:41:26 +0200 |
---|---|---|
committer | Tom Rini | 2018-07-19 17:03:35 -0400 |
commit | 73e9db22abf5d6ee9db88efa4a1b404f972b8e24 (patch) | |
tree | 3f54ed5c2315d0aefd6bc894d6fd1e0cf613aa45 /board/BuR/brppt1 | |
parent | d63f7130cea19c5f356ba651f0cbd37a964c1dc6 (diff) |
board/BuR/brppt1: implement more flexible boot process
With this commit we do:
- set the bootdelay in all brppt1 defconfigs to 0, this makes
development easier, since we can break into serial console.
- move CONFIG_BOOTCOMMAND from header file to defconfig
- introduce b_mode variable for selecting the final boot-target.
This b_mode represents the boot-switch, which can found on most b&r
targets. On the brppt1 this boot-switch is derived from some gpio and
the bootcounter within the RTC block, making it so possible to force
a boot-target (as example for repair-case).
- refactor the environment for booting new flexible way
primary we want to get some bootscr.img within the mass-storage,
this script then loads everything needed for the boot.
For legacy reason we implement the t30lgcy#x boot targets, booting the
already delivered linux-images.
- make space for the cfgscr within mtdparts on brppt1_nand
Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
Diffstat (limited to 'board/BuR/brppt1')
-rw-r--r-- | board/BuR/brppt1/board.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/board/BuR/brppt1/board.c b/board/BuR/brppt1/board.c index f970f9832d2..87b76a660c5 100644 --- a/board/BuR/brppt1/board.c +++ b/board/BuR/brppt1/board.c @@ -140,11 +140,33 @@ int board_init(void) } #ifdef CONFIG_BOARD_LATE_INIT +static char *bootmodeascii[16] = { + "BOOT", "reserved", "reserved", "reserved", + "RUN", "reserved", "reserved", "reserved", + "reserved", "reserved", "reserved", "reserved", + "PME", "reserved", "reserved", "DIAG", +}; + int board_late_init(void) { - if (0 == gpio_get_value(REPSWITCH)) { - env_set("bootcmd", "run netconsole"); - } + unsigned char bmode = 0; + ulong bootcount = 0; + + bootcount = bootcount_load() & 0xF; + + if (gpio_get_value(REPSWITCH) == 0 || bootcount == 12) + bmode = 12; + else if (bootcount > 0) + bmode = 0; + else + bmode = 4; + + printf("Mode: %s\n", bootmodeascii[bmode & 0x0F]); + env_set_ulong("b_mode", bmode); + + /* get sure that bootcmd isn't affected by any bootcount value */ + env_set_ulong("bootlimit", 0); + return 0; } #endif /* CONFIG_BOARD_LATE_INIT */ |