[U-Boot] [PATCH v2 13/14] arm/km: add implementation for read_dip_switch

Holger Brunck holger.brunck at keymile.com
Wed Jun 13 15:33:19 CEST 2012


From: Thomas Herzmann <thomas.herzmann at keymile.com>

Add a function to read the dip_switch on kmcoge5un. If the
switch is set the actual_bank is set to 0 and this SW is
booted.

Signed-off-by: Thomas Herzmann <thomas.herzmann at keymile.com>
Signed-off-by: Holger Brunck <holger.brunck at keymile.com>
cc: Valentin Longchamp <valentin.longchamp at keymile.com>
cc: Prafulla Wadaskar <prafulla at marvell.com>
---
changes for v2:
  - nothing

 board/keymile/km_arm/km_arm.c |   14 +++++++++++++-
 include/configs/km_kirkwood.h |    3 ---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 1348186..7e8bdfe 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -290,12 +290,24 @@ int board_init(void)
 
 int board_late_init(void)
 {
+#if defined(CONFIG_KMCOGE5UN)
+/* I/O pin to erase flash RGPP09 = MPP43 */
+#define KM_FLASH_ERASE_ENABLE	43
+	u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE);
+
+	/* if pin 1 do full erase */
+	if (dip_switch != 0) {
+		/* start bootloader */
+		puts("DIP:   Enabled\n");
+		setenv("actual_bank", "0");
+	}
+#endif
+
 #if defined(CONFIG_KM_FPGA_CONFIG)
 	wait_for_fpga_config();
 	fpga_reset();
 	toggle_eeprom_spi_bus();
 #endif
-
 	return 0;
 }
 
diff --git a/include/configs/km_kirkwood.h b/include/configs/km_kirkwood.h
index b29e1a6..c42d0cb 100644
--- a/include/configs/km_kirkwood.h
+++ b/include/configs/km_kirkwood.h
@@ -184,8 +184,5 @@
 #undef  CONFIG_KIRKWOOD_PCIE_INIT
 #endif
 
-#ifndef CONFIG_KM_FPGA_CONFIG
-#undef  BOARD_LATE_INIT
-#endif
 
 #endif /* _CONFIG_KM_KIRKWOOD */
-- 
1.7.1



More information about the U-Boot mailing list