From 4921a149e1470d92e2982e13c709357d90ef5e6c Mon Sep 17 00:00:00 2001 From: Stefan Bigler Date: Fri, 2 May 2014 10:49:27 +0200 Subject: kmp204x: handle dip-switch for factory settings Add readout of dip-switch to revert to factory settings. If one or more dip-switch are set, launch bank 0 that contains the bootloader to do the required action. Signed-off-by: Stefan Bigler Signed-off-by: Valentin Longchamp --- board/keymile/kmp204x/kmp204x.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'board/keymile/kmp204x/kmp204x.c') diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c index 5fceedd7c3..fba1bdd438 100644 --- a/board/keymile/kmp204x/kmp204x.c +++ b/board/keymile/kmp204x/kmp204x.c @@ -116,6 +116,9 @@ int board_early_init_r(void) /* enable the Unit LED (red) & Boot LED (on) */ qrio_set_leds(); + /* enable Application Buffer */ + qrio_enable_app_buffer(); + return ret; } @@ -171,6 +174,18 @@ int hush_init_var(void) #if defined(CONFIG_LAST_STAGE_INIT) int last_stage_init(void) { +#if defined(CONFIG_KMCOGE4) + /* on KMCOGE4, the BFTIC4 is on the LBAPP2 */ + struct bfticu_iomap *bftic4 = + (struct bfticu_iomap *)CONFIG_SYS_LBAPP2_BASE; + u8 dip_switch = in_8((u8 *)&(bftic4->mswitch)) & BFTICU_DIPSWITCH_MASK; + + if (dip_switch != 0) { + /* start bootloader */ + puts("DIP: Enabled\n"); + setenv("actual_bank", "0"); + } +#endif set_km_env(); return 0; } -- cgit v1.2.1