msm: Add I2C QUP support for MSM9615

Add the device definitions and platform data to support
I2C 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 cd93212..95bcf65 100644
--- a/arch/arm/mach-msm/board-9615.c
+++ b/arch/arm/mach-msm/board-9615.c
@@ -12,6 +12,7 @@
  */
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
+#include <linux/i2c.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/board.h>
@@ -23,6 +24,7 @@
 
 static struct platform_device *common_devices[] = {
 	&msm9615_device_uart_gsbi4,
+	&msm9615_device_qup_i2c_gsbi5,
 };
 
 static struct gpiomux_setting gsbi4 = {
@@ -31,6 +33,12 @@
 	.pull = GPIOMUX_PULL_NONE,
 };
 
+static struct gpiomux_setting gsbi5 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
 struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = {
 	{
 		.gpio      = 12,	/* GSBI4 UART */
@@ -56,6 +64,18 @@
 			[GPIOMUX_SUSPENDED] = &gsbi4,
 		},
 	},
+	{
+		.gpio      = 16,	/* GSBI5 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi5,
+		},
+	},
+	{
+		.gpio      = 17,	/* GSBI5 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi5,
+		},
+	},
 };
 
 static int __init gpiomux_init(void)
@@ -73,10 +93,22 @@
 	return 0;
 }
 
+static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = {
+	.clk_freq = 100000,
+	.src_clk_rate = 24000000,
+};
+
+static void __init msm9615_i2c_init(void)
+{
+	msm9615_device_qup_i2c_gsbi5.dev.platform_data =
+					&msm9615_i2c_qup_gsbi5_pdata;
+}
+
 static void __init msm9615_common_init(void)
 {
 	msm9615_device_init();
 	gpiomux_init();
+	msm9615_i2c_init();
 	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 0103f55..8b12c18 100644
--- a/arch/arm/mach-msm/clock-9615.c
+++ b/arch/arm/mach-msm/clock-9615.c
@@ -1505,7 +1505,7 @@
 	CLK_LOOKUP("core_clk",	gsbi2_qup_clk.c, NULL),
 	CLK_LOOKUP("core_clk",	gsbi3_qup_clk.c, NULL),
 	CLK_LOOKUP("core_clk",	gsbi4_qup_clk.c, NULL),
-	CLK_LOOKUP("core_clk",	gsbi5_qup_clk.c, NULL),
+	CLK_LOOKUP("core_clk",	gsbi5_qup_clk.c, "qup_i2c.0"),
 
 	CLK_LOOKUP("pdm_clk",		pdm_clk.c,		NULL),
 	CLK_LOOKUP("pmem_clk",		pmem_clk.c,		NULL),
@@ -1520,7 +1520,7 @@
 	CLK_LOOKUP("iface_clk",	gsbi2_p_clk.c, NULL),
 	CLK_LOOKUP("iface_clk",	gsbi3_p_clk.c, NULL),
 	CLK_LOOKUP("iface_clk",	gsbi4_p_clk.c, "msm_serial_hsl.0"),
-	CLK_LOOKUP("iface_clk",	gsbi5_p_clk.c, NULL),
+	CLK_LOOKUP("iface_clk",	gsbi5_p_clk.c, "qup_i2c.0"),
 
 	CLK_LOOKUP("usb_hs_pclk",		usb_hs1_p_clk.c,	NULL),
 	CLK_LOOKUP("usb_hs_system_clk",		usb_hs1_sys_clk.c,	NULL),
diff --git a/arch/arm/mach-msm/devices-9615.c b/arch/arm/mach-msm/devices-9615.c
index 3bc950e..eaa741a 100644
--- a/arch/arm/mach-msm/devices-9615.c
+++ b/arch/arm/mach-msm/devices-9615.c
@@ -23,9 +23,23 @@
 #include <asm/hardware/cache-l2x0.h>
 #include "devices.h"
 
+/* Address of GSBI blocks */
+#define MSM_GSBI1_PHYS          0x16000000
+#define MSM_GSBI2_PHYS          0x16100000
+#define MSM_GSBI3_PHYS          0x16200000
 #define MSM_GSBI4_PHYS		0x16300000
+#define MSM_GSBI5_PHYS          0x16400000
+
 #define MSM_UART4DM_PHYS	(MSM_GSBI4_PHYS + 0x40000)
 
+/* GSBI QUP devices */
+#define MSM_GSBI1_QUP_PHYS      (MSM_GSBI1_PHYS + 0x80000)
+#define MSM_GSBI2_QUP_PHYS      (MSM_GSBI2_PHYS + 0x80000)
+#define MSM_GSBI3_QUP_PHYS      (MSM_GSBI3_PHYS + 0x80000)
+#define MSM_GSBI4_QUP_PHYS      (MSM_GSBI4_PHYS + 0x80000)
+#define MSM_GSBI5_QUP_PHYS      (MSM_GSBI5_PHYS + 0x80000)
+#define MSM_QUP_SIZE            SZ_4K
+
 static struct resource resources_uart_gsbi4[] = {
 	{
 		.start	= GSBI4_UARTDM_IRQ,
@@ -53,6 +67,34 @@
 	.resource	= resources_uart_gsbi4,
 };
 
+static struct resource resources_qup_i2c_gsbi5[] = {
+	{
+		.name	= "gsbi_qup_i2c_addr",
+		.start	= MSM_GSBI5_PHYS,
+		.end	= MSM_GSBI5_PHYS + MSM_QUP_SIZE - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.name	= "qup_phys_addr",
+		.start	= MSM_GSBI5_QUP_PHYS,
+		.end	= MSM_GSBI5_QUP_PHYS + 4 - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.name	= "qup_err_intr",
+		.start	= GSBI5_QUP_IRQ,
+		.end	= GSBI5_QUP_IRQ,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device msm9615_device_qup_i2c_gsbi5 = {
+	.name		= "qup_i2c",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(resources_qup_i2c_gsbi5),
+	.resource	= resources_qup_i2c_gsbi5,
+};
+
 #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 2547fb4..7778657 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -67,6 +67,7 @@
 extern struct platform_device apq8064_device_ssbi_pmic2;
 
 extern struct platform_device msm9615_device_uart_gsbi4;
+extern struct platform_device msm9615_device_qup_i2c_gsbi5;
 
 extern struct platform_device msm_device_sdc1;
 extern struct platform_device msm_device_sdc2;