msm: Add SPI QUP support for MSM9615.
Add the device definitions and platform data to support
SPI QUP on MSM9615.
Signed-off-by: Harini Jayaraman <harinij@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-9615.c b/arch/arm/mach-msm/board-9615.c
index 95bcf65..f391e30 100644
--- a/arch/arm/mach-msm/board-9615.c
+++ b/arch/arm/mach-msm/board-9615.c
@@ -19,12 +19,14 @@
#include <mach/msm_iomap.h>
#include <mach/gpio.h>
#include <mach/gpiomux.h>
+#include <mach/msm_spi.h>
#include "timer.h"
#include "devices.h"
static struct platform_device *common_devices[] = {
&msm9615_device_uart_gsbi4,
&msm9615_device_qup_i2c_gsbi5,
+ &msm9615_device_qup_spi_gsbi3,
};
static struct gpiomux_setting gsbi4 = {
@@ -39,8 +41,44 @@
.pull = GPIOMUX_PULL_NONE,
};
+static struct gpiomux_setting gsbi3 = {
+ .func = GPIOMUX_FUNC_1,
+ .drv = GPIOMUX_DRV_8MA,
+ .pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting gsbi3_cs1_config = {
+ .func = GPIOMUX_FUNC_4,
+ .drv = GPIOMUX_DRV_8MA,
+ .pull = GPIOMUX_PULL_NONE,
+};
+
struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = {
{
+ .gpio = 8, /* GSBI3 QUP SPI_CLK */
+ .settings = {
+ [GPIOMUX_SUSPENDED] = &gsbi3,
+ },
+ },
+ {
+ .gpio = 9, /* GSBI3 QUP SPI_CS_N */
+ .settings = {
+ [GPIOMUX_SUSPENDED] = &gsbi3,
+ },
+ },
+ {
+ .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */
+ .settings = {
+ [GPIOMUX_SUSPENDED] = &gsbi3,
+ },
+ },
+ {
+ .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */
+ .settings = {
+ [GPIOMUX_SUSPENDED] = &gsbi3,
+ },
+ },
+ {
.gpio = 12, /* GSBI4 UART */
.settings = {
[GPIOMUX_SUSPENDED] = &gsbi4,
@@ -76,6 +114,13 @@
[GPIOMUX_SUSPENDED] = &gsbi5,
},
},
+ {
+ /* GPIO 19 can be used for I2C/UART on GSBI5 */
+ .gpio = 19, /* GSBI3 QUP SPI_CS_1 */
+ .settings = {
+ [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config,
+ },
+ },
};
static int __init gpiomux_init(void)
@@ -93,6 +138,10 @@
return 0;
}
+static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = {
+ .max_clock_speed = 24000000,
+};
+
static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = {
.clk_freq = 100000,
.src_clk_rate = 24000000,
@@ -109,6 +158,8 @@
msm9615_device_init();
gpiomux_init();
msm9615_i2c_init();
+ msm9615_device_qup_spi_gsbi3.dev.platform_data =
+ &msm9615_qup_spi_gsbi3_pdata;
platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
}
diff --git a/arch/arm/mach-msm/clock-9615.c b/arch/arm/mach-msm/clock-9615.c
index 8b12c18..be33026 100644
--- a/arch/arm/mach-msm/clock-9615.c
+++ b/arch/arm/mach-msm/clock-9615.c
@@ -1503,7 +1503,7 @@
CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, NULL),
CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, NULL),
- CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, NULL),
+ CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "spi_qsd.0"),
CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, NULL),
CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "qup_i2c.0"),
@@ -1518,7 +1518,7 @@
CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, NULL),
CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, NULL),
- CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, NULL),
+ CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "spi_qsd.0"),
CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "msm_serial_hsl.0"),
CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "qup_i2c.0"),
diff --git a/arch/arm/mach-msm/devices-9615.c b/arch/arm/mach-msm/devices-9615.c
index eaa741a..d114714 100644
--- a/arch/arm/mach-msm/devices-9615.c
+++ b/arch/arm/mach-msm/devices-9615.c
@@ -95,6 +95,34 @@
.resource = resources_qup_i2c_gsbi5,
};
+static struct resource resources_qup_spi_gsbi3[] = {
+ {
+ .name = "spi_base",
+ .start = MSM_GSBI3_QUP_PHYS,
+ .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .name = "gsbi_base",
+ .start = MSM_GSBI3_PHYS,
+ .end = MSM_GSBI3_PHYS + 4 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .name = "spi_irq_in",
+ .start = GSBI3_QUP_IRQ,
+ .end = GSBI3_QUP_IRQ,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device msm9615_device_qup_spi_gsbi3 = {
+ .name = "spi_qsd",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
+ .resource = resources_qup_spi_gsbi3,
+};
+
#ifdef CONFIG_CACHE_L2X0
static int __init l2x0_cache_init(void)
{
diff --git a/arch/arm/mach-msm/devices.h b/arch/arm/mach-msm/devices.h
index 7778657..3fab424 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -68,6 +68,7 @@
extern struct platform_device msm9615_device_uart_gsbi4;
extern struct platform_device msm9615_device_qup_i2c_gsbi5;
+extern struct platform_device msm9615_device_qup_spi_gsbi3;
extern struct platform_device msm_device_sdc1;
extern struct platform_device msm_device_sdc2;