msm_serial_hs: Enable GSBI6 as UARTDM device

This change configures GSBI6 into UARTDM mode.
It adds configuration require for clocks, ADM Channels and CRCI.

CRs-Fixed: 299610
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-msm8960.c b/arch/arm/mach-msm/board-msm8960.c
index 9db8593..c75971b 100644
--- a/arch/arm/mach-msm/board-msm8960.c
+++ b/arch/arm/mach-msm/board-msm8960.c
@@ -2681,6 +2681,7 @@
 	&msm_device_dmov,
 	&msm_device_smd,
 	&msm8960_device_uart_gsbi5,
+	&msm_device_uart_dm6,
 	&msm_device_saw_core0,
 	&msm_device_saw_core1,
 	&msm8960_device_ext_5v_vreg,
diff --git a/arch/arm/mach-msm/clock-8960.c b/arch/arm/mach-msm/clock-8960.c
index a86762a..76d9590 100644
--- a/arch/arm/mach-msm/clock-8960.c
+++ b/arch/arm/mach-msm/clock-8960.c
@@ -3765,7 +3765,7 @@
 	CLK_LOOKUP("gsbi_uart_clk",	gsbi3_uart_clk.c,	NULL),
 	CLK_LOOKUP("gsbi_uart_clk",	gsbi4_uart_clk.c,	NULL),
 	CLK_LOOKUP("gsbi_uart_clk",	gsbi5_uart_clk.c, "msm_serial_hsl.0"),
-	CLK_LOOKUP("uartdm_clk",	gsbi6_uart_clk.c,	NULL),
+	CLK_LOOKUP("uartdm_clk",	gsbi6_uart_clk.c, "msm_serial_hs.0"),
 	CLK_LOOKUP("gsbi_uart_clk",	gsbi7_uart_clk.c,	NULL),
 	CLK_LOOKUP("gsbi_uart_clk",	gsbi8_uart_clk.c,	NULL),
 	CLK_LOOKUP("gsbi_uart_clk",	gsbi9_uart_clk.c,	NULL),
@@ -3811,7 +3811,7 @@
 	CLK_LOOKUP("gsbi_pclk",		gsbi3_p_clk.c,		"qup_i2c.3"),
 	CLK_LOOKUP("gsbi_pclk",		gsbi4_p_clk.c, "qup_i2c.4"),
 	CLK_LOOKUP("gsbi_pclk",		gsbi5_p_clk.c,	"msm_serial_hsl.0"),
-	CLK_LOOKUP("uartdm_pclk",	gsbi6_p_clk.c,		NULL),
+	CLK_LOOKUP("uartdm_pclk",	gsbi6_p_clk.c,  "msm_serial_hs.0"),
 	CLK_LOOKUP("gsbi_pclk",		gsbi7_p_clk.c,		NULL),
 	CLK_LOOKUP("gsbi_pclk",		gsbi8_p_clk.c,		NULL),
 	CLK_LOOKUP("gsbi_pclk",		gsbi9_p_clk.c,		NULL),
diff --git a/arch/arm/mach-msm/devices-8960.c b/arch/arm/mach-msm/devices-8960.c
index 49378a4..ebc1826 100644
--- a/arch/arm/mach-msm/devices-8960.c
+++ b/arch/arm/mach-msm/devices-8960.c
@@ -20,6 +20,8 @@
 #include <linux/msm_kgsl.h>
 #include <linux/android_pmem.h>
 #include <mach/irqs-8960.h>
+#include <mach/dma.h>
+#include <linux/dma-mapping.h>
 #include <mach/board.h>
 #include <mach/msm_iomap.h>
 #include <mach/msm_hsusb.h>
@@ -56,6 +58,7 @@
 
 #define MSM_UART2DM_PHYS	(MSM_GSBI2_PHYS + 0x40000)
 #define MSM_UART5DM_PHYS	(MSM_GSBI5_PHYS + 0x40000)
+#define MSM_UART6DM_PHYS	(MSM_GSBI6_PHYS + 0x40000)
 
 /* GSBI QUP devices */
 #define MSM_GSBI1_QUP_PHYS	(MSM_GSBI1_PHYS + 0x80000)
@@ -173,6 +176,49 @@
 	.num_resources	= ARRAY_SIZE(resources_uart_gsbi2),
 	.resource	= resources_uart_gsbi2,
 };
+/* GSBI 6 used into UARTDM Mode */
+static struct resource msm_uart_dm6_resources[] = {
+	{
+		.start	= MSM_UART6DM_PHYS,
+		.end	= MSM_UART6DM_PHYS + PAGE_SIZE - 1,
+		.name	= "uartdm_resource",
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= GSBI6_UARTDM_IRQ,
+		.end	= GSBI6_UARTDM_IRQ,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= MSM_GSBI6_PHYS,
+		.end	= MSM_GSBI6_PHYS + 4 - 1,
+		.name	= "gsbi_resource",
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= DMOV_HSUART_GSBI6_TX_CHAN,
+		.end	= DMOV_HSUART_GSBI6_RX_CHAN,
+		.name	= "uartdm_channels",
+		.flags	= IORESOURCE_DMA,
+	},
+	{
+		.start	= DMOV_HSUART_GSBI6_TX_CRCI,
+		.end	= DMOV_HSUART_GSBI6_RX_CRCI,
+		.name	= "uartdm_crci",
+		.flags	= IORESOURCE_DMA,
+	},
+};
+static u64 msm_uart_dm6_dma_mask = DMA_BIT_MASK(32);
+struct platform_device msm_device_uart_dm6 = {
+	.name	= "msm_serial_hs",
+	.id	= 0,
+	.num_resources	= ARRAY_SIZE(msm_uart_dm6_resources),
+	.resource	= msm_uart_dm6_resources,
+	.dev	= {
+		.dma_mask		= &msm_uart_dm6_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
+};
 
 static struct resource resources_uart_gsbi5[] = {
 	{
diff --git a/arch/arm/mach-msm/devices.h b/arch/arm/mach-msm/devices.h
index e9599af..5bb8b8e 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -42,6 +42,7 @@
 extern struct platform_device msm_device_uart_dm3;
 extern struct platform_device msm_device_uart_dm12;
 extern struct platform_device *msm_device_uart_gsbi9;
+extern struct platform_device msm_device_uart_dm6;
 
 extern struct platform_device msm8960_device_uart_gsbi2;
 extern struct platform_device msm8960_device_uart_gsbi5;
diff --git a/arch/arm/mach-msm/include/mach/dma.h b/arch/arm/mach-msm/include/mach/dma.h
index ea299b1..4134d25 100644
--- a/arch/arm/mach-msm/include/mach/dma.h
+++ b/arch/arm/mach-msm/include/mach/dma.h
@@ -201,6 +201,12 @@
 #define DMOV_CE_OUT_CHAN       1
 #define DMOV_CE_OUT_CRCI       3
 
+#define DMOV_HSUART_GSBI6_TX_CHAN	7
+#define DMOV_HSUART_GSBI6_TX_CRCI	6
+
+#define DMOV_HSUART_GSBI6_RX_CHAN	8
+#define DMOV_HSUART_GSBI6_RX_CRCI	11
+
 /* SDC doesn't use ADM on 8960. Need these to compile */
 #define DMOV_SDC1_CHAN         13
 #define DMOV_SDC1_CRCI         0