[U-Boot] [PATCH] arm, at91: add spi dataflash support for the taurus board

Heiko Schocher hs at denx.de
Wed Oct 1 07:26:43 CEST 2014


Signed-off-by: Heiko Schocher <hs at denx.de>
Cc: Andreas Bießmann <andreas.devel at googlemail.com>
Cc: Bo Shen <voice.shen at atmel.com>
---
 board/siemens/taurus/taurus.c | 22 ++++++++++++++++++++++
 include/configs/taurus.h      | 11 +++++++++++
 2 files changed, 33 insertions(+)

diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c
index 673b302..98ce441 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -22,6 +22,8 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/at91sam9_sdramc.h>
 #include <atmel_mci.h>
+#include <asm/arch/at91_spi.h>
+#include <spi.h>
 
 #include <net.h>
 #include <netdev.h>
@@ -127,6 +129,25 @@ int board_early_init_f(void)
 	return 0;
 }
 
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+	return bus == 0 && cs == 0;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TAURUS_SPI_CS_PIN, 0);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TAURUS_SPI_CS_PIN, 1);
+}
+
+void spi_init_f(void)
+{
+	/* everything done in board_init */
+}
 int board_init(void)
 {
 	/* adress of boot parameters */
@@ -139,6 +160,7 @@ int board_init(void)
 #ifdef CONFIG_MACB
 	taurus_macb_hw_init();
 #endif
+	at91_spi0_hw_init(TAURUS_SPI_MASK);
 
 	return 0;
 }
diff --git a/include/configs/taurus.h b/include/configs/taurus.h
index aadf4cd..e30542d 100644
--- a/include/configs/taurus.h
+++ b/include/configs/taurus.h
@@ -127,6 +127,17 @@
 #define CONFIG_USB_STORAGE
 #endif
 
+/* SPI EEPROM */
+#define CONFIG_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH
+#define CONFIG_ATMEL_SPI
+#define CONFIG_SPI_FLASH_STMICRO
+#define CONFIG_SYS_SPI_WRITE_TOUT		(5 * CONFIG_SYS_HZ)
+#define TAURUS_SPI_MASK (1 << 4)
+#define TAURUS_SPI_CS_PIN	AT91_PIN_PA3
+
 /* load address */
 #define CONFIG_SYS_LOAD_ADDR			0x22000000
 
-- 
1.8.3.1



More information about the U-Boot mailing list