summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2013-01-22 17:20:27 +0800
committerSascha Hauer <s.hauer@pengutronix.de>2013-01-31 19:13:45 +0100
commitdc2da4fef158ef3e7aef7e268c87c75396463330 (patch)
tree6650cb67d06e342301f98a019779a3efb90a7f76 /arch
parent41d337174129b8f2d4516b4cdf8ad6e3df21613b (diff)
downloadbarebox-dc2da4fef158ef3e7aef7e268c87c75396463330.tar.gz
barebox-dc2da4fef158ef3e7aef7e268c87c75396463330.tar.xz
at91sam9261ek: add spi support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boards/at91sam9261ek/init.c42
-rw-r--r--arch/arm/configs/at91sam9261ek_defconfig3
-rw-r--r--arch/arm/mach-at91/Kconfig1
3 files changed, 45 insertions, 1 deletions
diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c
index 2597ff8987..57198d4dfe 100644
--- a/arch/arm/boards/at91sam9261ek/init.c
+++ b/arch/arm/boards/at91sam9261ek/init.c
@@ -37,6 +37,7 @@
#include <gpio_keys.h>
#include <readkey.h>
#include <led.h>
+#include <spi/spi.h>
static struct atmel_nand_data nand_pdata = {
.ale = 22,
@@ -309,6 +310,46 @@ static void ek_device_add_leds(void)
static void ek_device_add_leds(void) {}
#endif
+/*
+ * SPI related devices
+ */
+#if defined(CONFIG_DRIVER_SPI_ATMEL)
+/*
+ * SPI devices
+ */
+static struct spi_board_info ek_spi_devices[] = {
+ { /* DataFlash chip */
+ .name = "mtd_dataflash",
+ .chip_select = 0,
+ .max_speed_hz = 15 * 1000 * 1000,
+ .bus_num = 0,
+ },
+#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
+ { /* DataFlash card - jumper (J12) configurable to CS3 or CS0 */
+ .name = "mtd_dataflash",
+ .chip_select = 1,
+ .max_speed_hz = 15 * 1000 * 1000,
+ .bus_num = 0,
+ },
+#endif
+};
+
+static unsigned spi0_standard_cs[] = { AT91_PIN_PA3, AT91_PIN_PA6};
+static struct at91_spi_platform_data spi_pdata = {
+ .chipselect = spi0_standard_cs,
+ .num_chipselect = ARRAY_SIZE(spi0_standard_cs),
+};
+
+static void ek_add_device_spi(void)
+{
+ spi_register_board_info(ek_spi_devices,
+ ARRAY_SIZE(ek_spi_devices));
+ at91_add_device_spi(0, &spi_pdata);
+}
+#else
+static void ek_add_device_spi(void) {}
+#endif
+
static int at91sam9261ek_mem_init(void)
{
at91_add_device_sdram(0);
@@ -326,6 +367,7 @@ static int at91sam9261ek_devices_init(void)
ek_add_device_buttons();
ek_device_add_leds();
ek_add_device_lcdc();
+ ek_add_device_spi();
devfs_add_partition("nand0", 0x00000, SZ_128K, DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
devfs_add_partition("nand0", SZ_128K, SZ_256K, DEVFS_PARTITION_FIXED, "self_raw");
diff --git a/arch/arm/configs/at91sam9261ek_defconfig b/arch/arm/configs/at91sam9261ek_defconfig
index 9c955b4cb6..ac5c6638b9 100644
--- a/arch/arm/configs/at91sam9261ek_defconfig
+++ b/arch/arm/configs/at91sam9261ek_defconfig
@@ -52,9 +52,10 @@ CONFIG_CMD_TFTP=y
CONFIG_FS_TFTP=y
CONFIG_NET_RESOLV=y
CONFIG_DRIVER_NET_DM9K=y
-# CONFIG_SPI is not set
+CONFIG_DRIVER_SPI_ATMEL=y
CONFIG_MTD=y
# CONFIG_MTD_OOB_DEVICE is not set
+CONFIG_MTD_DATAFLASH=y
CONFIG_NAND=y
# CONFIG_NAND_ECC_HW is not set
# CONFIG_NAND_ECC_HW_SYNDROME is not set
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index d7939c3518..86115aa2b6 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -289,6 +289,7 @@ choice
config MACH_AT91SAM9261EK
bool "Atmel AT91SAM9261-EK Evaluation Kit"
select HAS_DM9000
+ select HAVE_AT91_DATAFLASH_CARD
select HAVE_NAND_ATMEL_BUSWIDTH_16
help
Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.