[PATCH 07/11] ARM: add PrimeCell generic DMA to MMCI/PL180 v5

Previous thread: [PATCH 06/11] ARM: add generic PrimeCell interface to DMA40 v1 by Linus Walleij on Wednesday, April 7, 2010 - 4:13 pm. (1 message)

Next thread: [PATCH 08/11] ARM: add PrimeCell generic DMA to PL011 v5 by Linus Walleij on Wednesday, April 7, 2010 - 4:13 pm. (1 message)
From: Linus Walleij
Date: Wednesday, April 7, 2010 - 4:13 pm

This extends the MMCI/PL180 driver with generic DMA engine support
using the PrimeCell DMA engine interface.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
 drivers/mmc/host/mmci.c   |  290 ++++++++++++++++++++++++++++++++++++++-------
 drivers/mmc/host/mmci.h   |    7 +-
 include/linux/amba/mmci.h |   16 +++
 3 files changed, 268 insertions(+), 45 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index ff115d9..37ab678 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -2,7 +2,7 @@
  *  linux/drivers/mmc/host/mmci.c - ARM PrimeCell MMCI PL180/1 driver
  *
  *  Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
- *  Copyright (C) 2010 ST-Ericsson AB.
+ *  Copyright (C) 2010 ST-Ericsson SA
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -23,8 +23,11 @@
 #include <linux/clk.h>
 #include <linux/scatterlist.h>
 #include <linux/gpio.h>
-#include <linux/amba/mmci.h>
 #include <linux/regulator/consumer.h>
+#include <linux/dmaengine.h>
+#include <linux/dma-mapping.h>
+#include <linux/amba/dma.h>
+#include <linux/amba/mmci.h>
 
 #include <asm/cacheflush.h>
 #include <asm/div64.h>
@@ -98,12 +101,209 @@ static void mmci_stop_data(struct mmci_host *host)
 	host->data = NULL;
 }
 
+static void
+mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c)
+{
+	void __iomem *base = host->base;
+
+	dev_dbg(mmc_dev(host->mmc), "op %02x arg %08x flags %08x\n",
+		cmd->opcode, cmd->arg, cmd->flags);
+
+	if (readl(base + MMCICOMMAND) & MCI_CPSM_ENABLE) {
+		writel(0, base + MMCICOMMAND);
+		udelay(1);
+	}
+
+	c |= cmd->opcode | MCI_CPSM_ENABLE;
+	if (cmd->flags & MMC_RSP_PRESENT) {
+		if (cmd->flags & MMC_RSP_136)
+			c |= MCI_CPSM_LONGRSP;
+		c |= MCI_CPSM_RESPONSE;
+	}
+	if (/*interrupt*/0)
+		c |= MCI_CPSM_INTERRUPT;
+
+	host->cmd = cmd;
+
+	writel(cmd->arg, base + ...
Previous thread: [PATCH 06/11] ARM: add generic PrimeCell interface to DMA40 v1 by Linus Walleij on Wednesday, April 7, 2010 - 4:13 pm. (1 message)

Next thread: [PATCH 08/11] ARM: add PrimeCell generic DMA to PL011 v5 by Linus Walleij on Wednesday, April 7, 2010 - 4:13 pm. (1 message)