[U-Boot] [PATCH 20/20] ppc, mgcoge, mgcoge2ne: add DIP switch detection

Heiko Schocher hs at denx.de
Tue Mar 8 14:30:18 CET 2011


From: Huber, Andreas <Andreas.Huber at 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.huber at keymile.com>
Signed-off-by: Holger Brunck <holger.brunck at keymile.com>
cc: Wolfgang Denk <wd at denx.de>
cc: Valentin Longchamp <valentin.longchamp at keymile.com>
cc: Heiko Schocher <hs at 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



More information about the U-Boot mailing list