mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/4] at91sam9x5ek: add spi support
Date: Thu,  1 Nov 2012 22:16:54 +0100	[thread overview]
Message-ID: <1351804616-31047-2-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1351804616-31047-1-git-send-email-plagnioj@jcrosoft.com>

on all the cpu module we have a at25 except on the cogent where we have a at45

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9x5ek/init.c     |   37 +++++++++++++++++++++++++++++++
 arch/arm/configs/at91sam9x5ek_defconfig |    5 ++++-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/at91sam9x5ek/init.c b/arch/arm/boards/at91sam9x5ek/init.c
index 48eebac..afb50e8 100644
--- a/arch/arm/boards/at91sam9x5ek/init.c
+++ b/arch/arm/boards/at91sam9x5ek/init.c
@@ -41,6 +41,7 @@
 #include <readkey.h>
 #include <linux/w1-gpio.h>
 #include <w1_mac_address.h>
+#include <spi/spi.h>
 
 #include "hw_version.h"
 
@@ -125,6 +126,41 @@ static void ek_add_device_i2c(void)
 	at91_add_device_i2c(0, i2c_devices, ARRAY_SIZE(i2c_devices));
 }
 
+static const struct spi_board_info ek_cm_cogent_spi_devices[] = {
+	{
+		.name		= "mtd_dataflash",
+		.chip_select	= 0,
+		.max_speed_hz	= 15 * 1000 * 1000,
+		.bus_num	= 0,
+	}
+};
+
+static const struct spi_board_info ek_spi_devices[] = {
+	{
+		.name		= "m25p80",
+		.chip_select	= 0,
+		.max_speed_hz	= 30 * 1000 * 1000,
+		.bus_num	= 0,
+	}
+};
+
+static unsigned spi0_standard_cs[] = { AT91_PIN_PA14};
+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)
+{
+	if (at91sam9x5ek_cm_is_vendor(VENDOR_COGENT))
+		spi_register_board_info(ek_cm_cogent_spi_devices,
+				ARRAY_SIZE(ek_cm_cogent_spi_devices));
+	else
+		spi_register_board_info(ek_spi_devices,
+				ARRAY_SIZE(ek_spi_devices));
+	at91_add_device_spi(0, &spi_pdata);
+}
+
 /*
  * USB Host port
  */
@@ -181,6 +217,7 @@ static int at91sam9x5ek_devices_init(void)
 	ek_add_device_w1();
 	ek_add_device_nand();
 	ek_add_device_eth();
+	ek_add_device_spi();
 	at91_add_device_usbh_ohci(&ek_usbh_data);
 	ek_add_led();
 	ek_add_device_i2c();
diff --git a/arch/arm/configs/at91sam9x5ek_defconfig b/arch/arm/configs/at91sam9x5ek_defconfig
index c71fe0d..5611b95 100644
--- a/arch/arm/configs/at91sam9x5ek_defconfig
+++ b/arch/arm/configs/at91sam9x5ek_defconfig
@@ -52,10 +52,13 @@ CONFIG_CMD_TFTP=y
 CONFIG_FS_TFTP=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_DRIVER_NET_MACB=y
-# CONFIG_SPI is not set
+CONFIG_DRIVER_SPI_ATMEL=y
+CONFIG_MTD_M25P80=y
 CONFIG_I2C=y
 CONFIG_I2C_GPIO=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
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-11-01 21:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-01 19:50 [PATCH 0/4 v2] at91sam9x5ek: add spi and mci support Jean-Christophe PLAGNIOL-VILLARD
2012-11-01 21:16 ` [PATCH 1/4] at91sam9x5: add spi support Jean-Christophe PLAGNIOL-VILLARD
2012-11-01 21:16   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-11-01 21:16   ` [PATCH 3/4] at91sam9x5: add mci support Jean-Christophe PLAGNIOL-VILLARD
2012-11-01 21:16   ` [PATCH 4/4] at91sam9x5ek: " Jean-Christophe PLAGNIOL-VILLARD
2012-11-02  9:39 ` [PATCH 0/4 v2] at91sam9x5ek: add spi and " Jean-Christophe PLAGNIOL-VILLARD
  -- strict thread matches above, loose matches on Subject: below --
2012-11-03 11:34 [PATCH 0/4 v3] " Jean-Christophe PLAGNIOL-VILLARD
2012-11-03 11:36 ` [PATCH 1/4] at91sam9x5: add spi support Jean-Christophe PLAGNIOL-VILLARD
2012-11-03 11:36   ` [PATCH 2/4] at91sam9x5ek: " Jean-Christophe PLAGNIOL-VILLARD
2012-11-01 19:30 [PATCH 0/4] at91sam9x5ek: add spi and mci support Jean-Christophe PLAGNIOL-VILLARD
2012-11-01 19:36 ` [PATCH 1/4] at91sam9x5: add spi support Jean-Christophe PLAGNIOL-VILLARD
2012-11-01 19:36   ` [PATCH 2/4] at91sam9x5ek: " Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1351804616-31047-2-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox