From 73e9db22abf5d6ee9db88efa4a1b404f972b8e24 Mon Sep 17 00:00:00 2001 From: Hannes Schmelzer Date: Fri, 6 Jul 2018 15:41:26 +0200 Subject: 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 --- board/BuR/brppt1/board.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'board/BuR') diff --git a/board/BuR/brppt1/board.c b/board/BuR/brppt1/board.c index f970f9832d..87b76a660c 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 */ -- cgit