msm: Add I2C QUP support for APQ8064

Add the device definitions and platform data to support
I2C QUP on APQ8064 simulator and RUMI3 targets.

Signed-off-by: Kenneth Heitke <kheitke@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-apq8064.c b/arch/arm/mach-msm/board-apq8064.c
index 82de1be..6bfdee8 100644
--- a/arch/arm/mach-msm/board-apq8064.c
+++ b/arch/arm/mach-msm/board-apq8064.c
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/irq.h>
+#include <linux/i2c.h>
 #include <linux/msm_ssbi.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -75,6 +76,7 @@
 static struct platform_device *common_devices[] __initdata = {
 	&apq8064_device_dmov,
 	&apq8064_device_uart_gsbi3,
+	&apq8064_device_qup_i2c_gsbi4,
 	&apq8064_device_qup_spi_gsbi5,
 	&apq8064_device_ssbi_pmic1,
 	&apq8064_device_ssbi_pmic2,
@@ -110,12 +112,26 @@
 	},
 };
 
+static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
+	.clk_freq = 100000,
+	.src_clk_rate = 24000000,
+	.clk = "gsbi_qup_clk",
+	.pclk = "gsbi_pclk",
+};
+
+static void __init apq8064_i2c_init(void)
+{
+	apq8064_device_qup_i2c_gsbi4.dev.platform_data =
+					&apq8064_i2c_qup_gsbi4_pdata;
+}
+
 static void __init apq8064_common_init(void)
 {
 	if (socinfo_init() < 0)
 		pr_err("socinfo_init() failed!\n");
 	msm_clock_init(&apq8064_dummy_clock_init_data);
 	gpiomux_init();
+	apq8064_i2c_init();
 
 	apq8064_device_qup_spi_gsbi5.dev.platform_data =
 						&apq8064_qup_spi_gsbi5_pdata;
diff --git a/arch/arm/mach-msm/devices-8064.c b/arch/arm/mach-msm/devices-8064.c
index b95660d..8bf25b2 100644
--- a/arch/arm/mach-msm/devices-8064.c
+++ b/arch/arm/mach-msm/devices-8064.c
@@ -29,6 +29,7 @@
 #define MSM_GSBI6_PHYS		0x16500000
 #define MSM_GSBI7_PHYS		0x16600000
 
+/* GSBI UART devices */
 #define MSM_UART3DM_PHYS	(MSM_GSBI3_PHYS + 0x40000)
 
 /* GSBI QUP devices */
@@ -91,6 +92,34 @@
 	.resource	= resources_uart_gsbi3,
 };
 
+static struct resource resources_qup_i2c_gsbi4[] = {
+	{
+		.name	= "gsbi_qup_i2c_addr",
+		.start	= MSM_GSBI4_PHYS,
+		.end	= MSM_GSBI4_PHYS + MSM_QUP_SIZE - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.name	= "qup_phys_addr",
+		.start	= MSM_GSBI4_QUP_PHYS,
+		.end	= MSM_GSBI4_QUP_PHYS + 4 - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.name	= "qup_err_intr",
+		.start	= GSBI4_QUP_IRQ,
+		.end	= GSBI4_QUP_IRQ,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device apq8064_device_qup_i2c_gsbi4 = {
+	.name		= "qup_i2c",
+	.id		= 4,
+	.num_resources	= ARRAY_SIZE(resources_qup_i2c_gsbi4),
+	.resource	= resources_qup_i2c_gsbi4,
+};
+
 static struct resource resources_qup_spi_gsbi5[] = {
 	{
 		.name   = "spi_base",
@@ -440,11 +469,16 @@
 	CLK_DUMMY("gsbi_uart_clk",	GSBI5_UART_CLK,		NULL, OFF),
 	CLK_DUMMY("uartdm_clk",		GSBI6_UART_CLK,		NULL, OFF),
 	CLK_DUMMY("gsbi_uart_clk",	GSBI7_UART_CLK,		NULL, OFF),
-	CLK_DUMMY("spi_clk",		GSBI1_QUP_CLK,		NULL, OFF),
+	CLK_DUMMY("gsbi_uart_clk",	GSBI8_UART_CLK,		NULL, OFF),
+	CLK_DUMMY("gsbi_uart_clk",	GSBI9_UART_CLK,		NULL, OFF),
+	CLK_DUMMY("gsbi_uart_clk",	GSBI10_UART_CLK,	NULL, OFF),
+	CLK_DUMMY("gsbi_uart_clk",	GSBI11_UART_CLK,	NULL, OFF),
+	CLK_DUMMY("gsbi_uart_clk",	GSBI12_UART_CLK,	NULL, OFF),
+	CLK_DUMMY("gsbi_qup_clk",	GSBI1_QUP_CLK,		NULL, OFF),
 	CLK_DUMMY("gsbi_qup_clk",	GSBI2_QUP_CLK,		NULL, OFF),
 	CLK_DUMMY("gsbi_qup_clk",	GSBI3_QUP_CLK,		NULL, OFF),
-	CLK_DUMMY("gsbi_qup_clk",	GSBI4_QUP_CLK,		NULL, OFF),
-	CLK_DUMMY("spi_clk",	GSBI5_QUP_CLK,		 "spi_qsd.0", OFF),
+	CLK_DUMMY("gsbi_qup_clk",	GSBI4_QUP_CLK,	 "qup_i2c.4", OFF),
+	CLK_DUMMY("spi_clk",		GSBI5_QUP_CLK,	 "spi_qsd.0", OFF),
 	CLK_DUMMY("gsbi_qup_clk",	GSBI6_QUP_CLK,		NULL, OFF),
 	CLK_DUMMY("gsbi_qup_clk",	GSBI7_QUP_CLK,		NULL, OFF),
 	CLK_DUMMY("pdm_clk",		PDM_CLK,		NULL, OFF),
@@ -472,11 +506,11 @@
 	CLK_DUMMY("sata_rxoob_clk",     SATA_RXOOB_CLK,         NULL, OFF),
 	CLK_DUMMY("sata_pmalive_clk",   SATA_PMALIVE_CLK,       NULL, OFF),
 	CLK_DUMMY("sata_phy_ref_clk",   SATA_PHY_REF_CLK,       NULL, OFF),
-	CLK_DUMMY("spi_pclk",		GSBI1_P_CLK,		NULL, OFF),
+	CLK_DUMMY("gsbi_pclk",		GSBI1_P_CLK,		NULL, OFF),
 	CLK_DUMMY("gsbi_pclk",		GSBI2_P_CLK,		NULL, OFF),
 	CLK_DUMMY("gsbi_pclk",		GSBI3_P_CLK,
 						  "msm_serial_hsl.0", OFF),
-	CLK_DUMMY("gsbi_pclk",		GSBI4_P_CLK,		NULL, OFF),
+	CLK_DUMMY("gsbi_pclk",		GSBI4_P_CLK,	 "qup_i2c.4", OFF),
 	CLK_DUMMY("spi_pclk",		GSBI5_P_CLK,	 "spi_qsd.0", OFF),
 	CLK_DUMMY("uartdm_pclk",	GSBI6_P_CLK,		NULL, OFF),
 	CLK_DUMMY("gsbi_pclk",		GSBI7_P_CLK,		NULL, OFF),
diff --git a/arch/arm/mach-msm/devices.h b/arch/arm/mach-msm/devices.h
index c54dcd3..1689ce0 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -55,6 +55,7 @@
 extern struct platform_device msm8960_gemini_device;
 
 extern struct platform_device apq8064_device_uart_gsbi3;
+extern struct platform_device apq8064_device_qup_i2c_gsbi4;
 extern struct platform_device apq8064_device_qup_spi_gsbi5;
 extern struct platform_device apq8064_device_ssbi_pmic1;
 extern struct platform_device apq8064_device_ssbi_pmic2;