msm: dma: remove crci conflict checking

The crci conflict checking code was designed for a system where a crci's
mux could be changed at runtime. In reality, our chips configure these
statically, so it is not necessary.

Signed-off-by: Jeff Ohlstein <johlstei@codeaurora.org>
diff --git a/arch/arm/mach-msm/dma.c b/arch/arm/mach-msm/dma.c
index 7aecb66..edee32f 100644
--- a/arch/arm/mach-msm/dma.c
+++ b/arch/arm/mach-msm/dma.c
@@ -59,7 +59,6 @@
 	int channel_active;
 	struct list_head ready_commands[MSM_DMOV_CHANNEL_COUNT];
 	struct list_head active_commands[MSM_DMOV_CHANNEL_COUNT];
-	unsigned int crci_mask;
 	spinlock_t lock;
 	unsigned int irq;
 	struct clk *clk;
@@ -276,132 +275,10 @@
 }
 EXPORT_SYMBOL(msm_dmov_stop_cmd);
 
-#define	CRCI_UNUSED   0
-#define	CRCI_CONFLICT 1
-#define	CRCI_MUX_OFF  2
-#define	CRCI_MUX_ON   3
-
-#ifdef CONFIG_MSM_ADM3
-static int crci_mask_compare(unsigned int x, unsigned int y)
-{
-	unsigned int mask;
-	int i;
-	for (i = 0; i < MSM_DMOV_CRCI_COUNT; i++) {
-		mask = (x ^ y) >> (2*i);
-		if ((mask & 3) == CRCI_CONFLICT)
-			return 1;
-	}
-	return 0;
-}
-#endif
-
-static int check_crci_conflict(struct msm_dmov_cmd *cmd, int adm)
-{
-#ifdef CONFIG_MSM_ADM3
-	int i;
-	struct msm_dmov_cmd *iter;
-	struct list_head *cmd_list;
-	unsigned int active_crci_mask = 0;
-
-	for (i = 0; i < MSM_DMOV_CHANNEL_COUNT; i++) {
-		cmd_list = &dmov_conf[adm].active_commands[i];
-		list_for_each_entry(iter, cmd_list, list) {
-			active_crci_mask |= iter->crci_mask;
-		}
-	}
-	return crci_mask_compare(cmd->crci_mask, active_crci_mask);
-#endif
-	return 0;
-}
-
-#define CRCI_MUXSEL(n) (((n) >> 4) & 1)
-#define CRCI_NUM(n)    ((n) & 0xF)
-
-unsigned int msm_dmov_build_crci_mask(int n, ...)
-{
-	unsigned int mask = 0;
-#ifdef CONFIG_MSM_ADM3
-	int i;
-	int crci;
-	int crci_num;
-	unsigned int crci_muxsel;
-	va_list crcis;
-	va_start(crcis, n);
-	for (i = 0; i < n; i++) {
-		crci = va_arg(crcis, int);
-		crci_muxsel = CRCI_MUXSEL(crci);
-		crci_num = CRCI_NUM(crci);
-		mask |= (1 << (2*crci_num + 1));
-		mask |= (crci_muxsel << (2*crci_num));
-	}
-	va_end(crcis);
-#endif
-	return mask;
-}
-EXPORT_SYMBOL(msm_dmov_build_crci_mask);
-
-
-static void set_crci_mask(int crci_mask, int adm)
-{
-#ifdef CONFIG_MSM_ADM3
-	int i;
-	int blk_size;
-	unsigned int crci_ctl;
-	unsigned int tmp_crci_mask;
-	unsigned int blank_mask;
-
-	for (i = 0; i < MSM_DMOV_CRCI_COUNT; i++) {
-		tmp_crci_mask = (crci_mask >> (2*i)) & 3;
-		if (crci_mask_compare(dmov_conf[adm].crci_mask,
-				      tmp_crci_mask << (2*i))) {
-			blank_mask = ~(3 << (2*i));
-			blk_size = dmov_conf[adm].crci_conf[i].blk_size;
-			crci_ctl =  DMOV_CRCI_CTL_BLK_SZ(blk_size);
-			if (tmp_crci_mask == CRCI_MUX_ON)
-				crci_ctl |= DMOV_CRCI_MUX;
-
-			writel_relaxed(crci_ctl, DMOV_REG(DMOV_CRCI_CTL(i),
-				       adm));
-			dmov_conf[adm].crci_mask &= blank_mask;
-			dmov_conf[adm].crci_mask |= (tmp_crci_mask << (2*i));
-		}
-	}
-	wmb();
-#endif
-}
-
-static void start_ready_cmds(int adm)
-{
-#ifdef CONFIG_MSM_ADM3
-	int i;
-	unsigned int status;
-	struct list_head *rdy;
-	struct list_head *act;
-	struct msm_dmov_cmd *cmd;
-	for (i = 0; i < MSM_DMOV_CHANNEL_COUNT; i++) {
-		rdy = &dmov_conf[adm].ready_commands[i];
-		act = &dmov_conf[adm].active_commands[i];
-		cmd = list_entry(rdy->next, typeof(*cmd), list);
-		if (!list_empty(rdy) && !check_crci_conflict(cmd, adm)) {
-			status = readl_relaxed(DMOV_REG(DMOV_STATUS(i), adm));
-			if (status & DMOV_STATUS_CMD_PTR_RDY) {
-				list_del(&cmd->list);
-				list_add_tail(&cmd->list, act);
-				dmov_conf[adm].channel_active |= (1 << i);
-				set_crci_mask(cmd->crci_mask, adm);
-				writel_relaxed(cmd->cmdptr,
-				       DMOV_REG(DMOV_CMD_PTR(i), adm));
-			}
-		}
-	}
-#endif
-}
-
 void msm_dmov_enqueue_cmd_ext(unsigned id, struct msm_dmov_cmd *cmd)
 {
 	unsigned long irq_flags;
 	unsigned int status;
-	int conflict;
 	int adm = DMOV_ID_TO_ADM(id);
 	int ch = DMOV_ID_TO_CHAN(id);
 
@@ -413,8 +290,7 @@
 	dmov_conf[adm].clk_ctl = CLK_EN;
 
 	status = readl_relaxed(DMOV_REG(DMOV_STATUS(ch), adm));
-	conflict = check_crci_conflict(cmd, adm);
-	if ((status & DMOV_STATUS_CMD_PTR_RDY) && !conflict) {
+	if (status & DMOV_STATUS_CMD_PTR_RDY) {
 		PRINT_IO("msm_dmov_enqueue_cmd(%d), start command, status %x\n",
 			id, status);
 		if (cmd->exec_func)
@@ -424,15 +300,13 @@
 			enable_irq(dmov_conf[adm].irq);
 		dmov_conf[adm].channel_active |= 1U << ch;
 		PRINT_IO("Writing %x exactly to register", cmd->cmdptr);
-		set_crci_mask(cmd->crci_mask, adm);
 		writel_relaxed(cmd->cmdptr, DMOV_REG(DMOV_CMD_PTR(ch), adm));
 	} else {
 		if (!dmov_conf[adm].channel_active) {
 			dmov_conf[adm].clk_ctl = CLK_TO_BE_DIS;
 			mod_timer(&dmov_conf[adm].timer, jiffies + HZ);
 		}
-		if (list_empty(&dmov_conf[adm].active_commands[ch])
-		    && !conflict)
+		if (list_empty(&dmov_conf[adm].active_commands[ch]))
 			PRINT_ERROR("msm_dmov_enqueue_cmd_ext(%d), stalled, "
 				"status %x\n", id, status);
 		PRINT_IO("msm_dmov_enqueue_cmd(%d), enqueue command, status "
@@ -489,14 +363,13 @@
 	complete(&cmd->complete);
 }
 
-int msm_dmov_exec_cmd(unsigned id, unsigned int crci_mask, unsigned int cmdptr)
+int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr)
 {
 	struct msm_dmov_exec_cmdptr_cmd cmd;
 
 	PRINT_FLOW("dmov_exec_cmdptr(%d, %x)\n", id, cmdptr);
 
 	cmd.dmov_cmd.cmdptr = cmdptr;
-	cmd.dmov_cmd.crci_mask = crci_mask;
 	cmd.dmov_cmd.complete_func = dmov_exec_cmdptr_complete_func;
 	cmd.dmov_cmd.exec_func = NULL;
 	cmd.id = id;
@@ -609,7 +482,6 @@
 			rmb();
 			ch_status = readl_relaxed(DMOV_REG(DMOV_STATUS(ch),
 						  adm));
-#ifndef CONFIG_MSM_ADM3
 			PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
 			if ((ch_status & DMOV_STATUS_CMD_PTR_RDY) &&
 			    !list_empty(&dmov_conf[adm].ready_commands[ch])) {
@@ -625,7 +497,6 @@
 				writel_relaxed(cmd->cmdptr,
 					       DMOV_REG(DMOV_CMD_PTR(ch), adm));
 			}
-#endif
 		} while (ch_status & DMOV_STATUS_RSLT_VALID);
 		if (list_empty(&dmov_conf[adm].active_commands[ch]) &&
 				list_empty(&dmov_conf[adm].ready_commands[ch]))
@@ -633,7 +504,6 @@
 		PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
 	}
 
-	start_ready_cmds(adm);
 	if (!dmov_conf[adm].channel_active) {
 		disable_irq_nosync(dmov_conf[adm].irq);
 		dmov_conf[adm].clk_ctl = CLK_TO_BE_DIS;
diff --git a/arch/arm/mach-msm/dma_test.c b/arch/arm/mach-msm/dma_test.c
index 3a31542..de1ee0a 100644
--- a/arch/arm/mach-msm/dma_test.c
+++ b/arch/arm/mach-msm/dma_test.c
@@ -140,7 +140,7 @@
 					sizeof(*priv->command_ptr_ptr),
 					DMA_TO_DEVICE);
 
-	msm_dmov_exec_cmd(TEST_CHANNEL, 0,
+	msm_dmov_exec_cmd(TEST_CHANNEL,
 			  DMOV_CMD_PTR_LIST | DMOV_CMD_ADDR(mapped_cmd_ptr));
 
 	dma_unmap_single(NULL, (dma_addr_t) mapped_cmd_ptr,
diff --git a/arch/arm/mach-msm/include/mach/dma.h b/arch/arm/mach-msm/include/mach/dma.h
index 4134d25..dc8c611 100644
--- a/arch/arm/mach-msm/include/mach/dma.h
+++ b/arch/arm/mach-msm/include/mach/dma.h
@@ -31,7 +31,6 @@
 struct msm_dmov_cmd {
 	struct list_head list;
 	unsigned int cmdptr;
-	unsigned int crci_mask;
 	void (*complete_func)(struct msm_dmov_cmd *cmd,
 			      unsigned int result,
 			      struct msm_dmov_errdata *err);
@@ -43,8 +42,7 @@
 void msm_dmov_enqueue_cmd_ext(unsigned id, struct msm_dmov_cmd *cmd);
 void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful);
 void msm_dmov_flush(unsigned int id);
-int msm_dmov_exec_cmd(unsigned id, unsigned int crci_mask, unsigned int cmdptr);
-unsigned int msm_dmov_build_crci_mask(int n, ...);
+int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr);
 
 #define DMOV_CRCIS_PER_CONF 10