From: Huber, Andreas <andreas.hu...@keymile.com>

This reads the DIP switch register in the BFTICU (0x40000089). If 'Full reset'
or 'DB erase' is selected, 'actual_bank' is set to 0. This loads the Bootloader
application who does the erase stuff.

Signed-off-by: Andreas Huber <andreas.hu...@keymile.com>
Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
cc: Wolfgang Denk <w...@denx.de>
cc: Valentin Longchamp <valentin.longch...@keymile.com>
cc: Heiko Schocher <h...@denx.de>
---
 board/keymile/mgcoge/mgcoge.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/board/keymile/mgcoge/mgcoge.c b/board/keymile/mgcoge/mgcoge.c
index e932633..dabbec4 100644
--- a/board/keymile/mgcoge/mgcoge.c
+++ b/board/keymile/mgcoge/mgcoge.c
@@ -317,8 +317,21 @@ unsigned int arch_ram_size(void)
        return gd->bd->bi_memsize;
 }
 
+#define DIPSWITCH_OFFSET 0x89
+#define DIPSWITCH_MASK   0x0f
+
 int last_stage_init(void)
 {
+       u8 dip_switch;
+       /* Dip switch */
+       dip_switch = readb(CONFIG_SYS_FPGA_BASE + DIPSWITCH_OFFSET);
+       dip_switch &= DIPSWITCH_MASK;
+       /* dip switch 'full reset' or 'db erase' */
+       if (dip_switch & 0x1 || dip_switch & 0x2) {
+               /* start bootloader */
+               puts("DIP:   Enabled\n");
+               setenv("actual_bank", "0");
+       }
        set_km_env();
        return 0;
 }
-- 
1.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to