[patch 2/6] xtensa: add s6000 spi host to s6105 platform

From: Daniel GlÃckner
Date: Mon Mar 23 2009 - 11:34:17 EST


Signed-off-by: Daniel GlÃckner <dg@xxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/