mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Daniel Glöckner" <dg@emlix.com>
To: Chris Zankel <chris@zankel.net>,
	David Brownell <dbrownell@users.sourceforge.net>
Cc: spi-devel-general@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, "Daniel Glöckner" <dg@emlix.com>
Subject: [patch 2/6] xtensa: add s6000 spi host to s6105 platform
Date: Mon, 23 Mar 2009 16:34:18 +0100	[thread overview]
Message-ID: <1237822462-32109-2-git-send-email-dg@emlix.com> (raw)
In-Reply-To: <1237822462-32109-1-git-send-email-dg@emlix.com>

Signed-off-by: Daniel Glöckner <dg@emlix.com>
---
 arch/xtensa/platforms/s6105/device.c |   48 ++++++++++++++++++++++++++++++++++
 arch/xtensa/platforms/s6105/setup.c  |    5 +++-
 2 files changed, 52 insertions(+), 1 deletions(-)

diff --git a/arch/xtensa/platforms/s6105/device.c b/arch/xtensa/platforms/s6105/device.c
index 9394e6f..a7ea916 100644
--- a/arch/xtensa/platforms/s6105/device.c
+++ b/arch/xtensa/platforms/s6105/device.c
@@ -14,6 +14,8 @@
 #include <linux/platform_device.h>
 #include <linux/serial.h>
 #include <linux/serial_8250.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/spi_s6000.h>
 
 #include <variant/hardware.h>
 #include <variant/dmac.h>
@@ -24,6 +26,7 @@
 #define UART_INTNUM		4
 #define GMAC_INTNUM		5
 #define I2C_INTNUM		6
+#define SPI_INTNUM		11
 
 static const signed char gpio3_irq_mappings[] = {
 	S6_INTC_GPIO(3),
@@ -49,11 +52,17 @@ static const signed char i2c_irq_mappings[] = {
 	-1
 };
 
+static const signed char spi_irq_mappings[] = {
+	S6_INTC_SPI,
+	-1
+};
+
 const signed char *platform_irq_mappings[NR_IRQS] = {
 	[GPIO3_INTNUM] = gpio3_irq_mappings,
 	[UART_INTNUM] = uart_irq_mappings,
 	[GMAC_INTNUM] = gmac_irq_mappings,
 	[I2C_INTNUM] = i2c_irq_mappings,
+	[SPI_INTNUM] = spi_irq_mappings,
 };
 
 static struct plat_serial8250_port serial_platform_data[] = {
@@ -173,6 +182,36 @@ static struct i2c_board_info __initdata s6_i2c_devices[] = {
 	},
 };
 
+static struct resource s6_spi_resource[] = {
+	{
+		.name   = "mem",
+		.start  = (resource_size_t)S6_REG_SPI,
+		.end    = (resource_size_t)S6_REG_SPI + 0x1000 - 1,
+		.flags  = IORESOURCE_MEM,
+	},
+	{
+		.name   = "irq",
+		.start  = (resource_size_t)SPI_INTNUM,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+#define S6_SPI_BUS_NUM	0
+
+static __devinitdata struct s6_spi_platform_data s6_spi_pdata = {
+	.bus_num     = S6_SPI_BUS_NUM,
+	.cs_polarity = 0x00,
+	.clock       = "PCLK",
+};
+
+#define S6_SPI_CS_BOOT_FLASH	0
+#define S6_SPI_CS_BACK_PANEL	1
+#define S6_SPI_CS_EXPANSION	3
+#define S6_SPI_CS_MMC_SLOT	4
+
+static struct spi_board_info __initdata s6_spi_devices[] = {
+};
+
 static struct platform_device platform_devices[] = {
 	{
 		.name = "serial8250",
@@ -195,6 +234,14 @@ static struct platform_device platform_devices[] = {
 			.platform_data = &s6_i2c_pdata,
 		},
 	},
+	{
+		.name = "spi_s6000",
+		.resource = s6_spi_resource,
+		.num_resources = ARRAY_SIZE(s6_spi_resource),
+		.dev = {
+			.platform_data = &s6_spi_pdata,
+		},
+	},
 };
 
 static int __init device_init(void)
@@ -203,6 +250,7 @@ static int __init device_init(void)
 
 	i2c_register_board_info(S6_I2C_BUS_NUM, s6_i2c_devices,
 				ARRAY_SIZE(s6_i2c_devices));
+	spi_register_board_info(s6_spi_devices, ARRAY_SIZE(s6_spi_devices));
 	s6_gmac_resource[5].start = prepare_phy_irq(GPIO_PHY_IRQ);
 
 	for (i = 0; i < ARRAY_SIZE(platform_devices); i++)
diff --git a/arch/xtensa/platforms/s6105/setup.c b/arch/xtensa/platforms/s6105/setup.c
index e64db1c..5ffa148 100644
--- a/arch/xtensa/platforms/s6105/setup.c
+++ b/arch/xtensa/platforms/s6105/setup.c
@@ -58,7 +58,10 @@ void __init platform_setup(char **cmdline)
 
 void __init platform_init(bp_tag_t *first)
 {
-	s6_setup_gpio(0);
+	s6_setup_gpio(1 << GPIO_SPI_CS0 |
+			1 << GPIO_SPI_CS1 |
+			1 << GPIO_SPI_CS3 |
+			1 << GPIO_SPI_CS4);
 	gpio_request(GPIO_LED1_NGREEN, "led1_green");
 	gpio_request(GPIO_LED1_RED, "led1_red");
 	gpio_direction_output(GPIO_LED1_NGREEN, 1);
-- 
1.6.2.107.ge47ee


  reply	other threads:[~2009-03-23 15:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-23 15:34 [patch 1/6] spi: s6000 spi host driver Daniel Glöckner
2009-03-23 15:34 ` Daniel Glöckner [this message]
2009-03-23 15:34 ` [patch 3/6] xtensa: add spi mmc host to s6105 platform Daniel Glöckner
2009-03-24 20:09   ` David Brownell
2009-04-02 10:31     ` Daniel Glöckner
2009-03-23 15:34 ` [patch 4/6] xtensa: add m25p80 " Daniel Glöckner
2009-03-23 15:34 ` [patch 5/6] xtensa: enable s6000 spi host in s6105_defconfig Daniel Glöckner
2009-03-23 15:37   ` Daniel Glöckner
2009-03-23 15:34 ` [patch 6/6] xtensa: enable spi mmc " Daniel Glöckner

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=1237822462-32109-2-git-send-email-dg@emlix.com \
    --to=dg@emlix.com \
    --cc=chris@zankel.net \
    --cc=dbrownell@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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

Powered by JetHome