[U-Boot] [PATCH 18/20] arm/km: implement weak function board_spi_clam_bus/release

Valentin Longchamp valentin.longchamp at keymile.com
Thu Jun 7 12:06:58 CEST 2012


They are needed on all km_arm boards where we have the environement
variables in the NOR Flash. First boards using this feature are
kmcoge5un and kmnusa.

Signed-off-by: Valentin Longchamp <valentin.longchamp at keymile.com>
Signed-off-by: Holger Brunck <holger.brunck at keymile.com>
cc: Gerlando Falauto <gerlando.falauto at keymile.com>
cc: Prafulla Wadaskar <prafulla at marvell.com>
---
 board/keymile/km_arm/km_arm.c |   26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 8e4c382..a71bd2f 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -36,6 +36,7 @@
 #include <nand.h>
 #include <netdev.h>
 #include <miiphy.h>
+#include <spi.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/errno.h>
@@ -307,29 +308,18 @@ int board_late_init(void)
 	return 0;
 }
 
-int km_hw_spi_bus_claim(int on)
+int board_spi_claim_bus(struct spi_slave *slave)
 {
-	int gpio_value = !on;
-
-	if (on) {
-		kwmpp_config[0] = MPP0_SPI_SCn;
-		kwmpp_config[1] = MPP1_SPI_MOSI;
-		kwmpp_config[2] = MPP2_SPI_SCK;
-		kwmpp_config[3] = MPP3_SPI_MISO;
-	} else {
-		kwmpp_config[0] = MPP0_NF_IO2;
-		kwmpp_config[1] = MPP1_NF_IO3;
-		kwmpp_config[2] = MPP2_NF_IO4;
-		kwmpp_config[3] = MPP3_NF_IO5;
-	}
-
-	/* Multi-Purpose Pins Functionality configuration */
-	kirkwood_mpp_conf(kwmpp_config, NULL);
-	kw_gpio_set_value(KM_FLASH_GPIO_PIN, gpio_value);
+	kw_gpio_set_value(KM_FLASH_GPIO_PIN, 0);
 
 	return 0;
 }
 
+void board_spi_release_bus(struct spi_slave *slave)
+{
+	kw_gpio_set_value(KM_FLASH_GPIO_PIN, 1);
+}
+
 #if defined(CONFIG_CMD_SF)
 int do_spi_toggle(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-- 
1.7.1



More information about the U-Boot mailing list