From 1615cc224e5d822c91bf0b8128f54680c6e92d2f Mon Sep 17 00:00:00 2001
From: Pierre Ossman <drzeus@drzeus.cx>
Date: Fri, 9 Feb 2007 08:19:07 +0100
Subject: [PATCH 1/5] mmc: wbsd: Remove driver version

The driver version was only really meaningful when it was an
out-of-tree driver. Now we can use the version of the kernel.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
---
 drivers/mmc/wbsd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
index a44d8777ab9f..2d323af20025 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/wbsd.c
@@ -42,7 +42,6 @@
 #include "wbsd.h"
 
 #define DRIVER_NAME "wbsd"
-#define DRIVER_VERSION "1.6"
 
 #define DBG(x...) \
 	pr_debug(DRIVER_NAME ": " x)
@@ -2101,8 +2100,7 @@ static int __init wbsd_drv_init(void)
 	int result;
 
 	printk(KERN_INFO DRIVER_NAME
-		": Winbond W83L51xD SD/MMC card interface driver, "
-		DRIVER_VERSION "\n");
+		": Winbond W83L51xD SD/MMC card interface driver\n");
 	printk(KERN_INFO DRIVER_NAME ": Copyright(c) Pierre Ossman\n");
 
 #ifdef CONFIG_PNP
@@ -2166,7 +2164,6 @@ module_param(dma, int, 0444);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Pierre Ossman <drzeus@drzeus.cx>");
 MODULE_DESCRIPTION("Winbond W83L51xD SD/MMC card interface driver");
-MODULE_VERSION(DRIVER_VERSION);
 
 #ifdef CONFIG_PNP
 MODULE_PARM_DESC(nopnp, "Scan for device instead of relying on PNP. (default 0)");

From 52fbf9c976b36654e08e94c3107ddbaac7e2da33 Mon Sep 17 00:00:00 2001
From: Pierre Ossman <drzeus@drzeus.cx>
Date: Fri, 9 Feb 2007 08:23:41 +0100
Subject: [PATCH 2/5] mmc: sdhci: Remove driver version

The driver version was only really meaningful when it was an
out-of-tree driver. Now we can use the version of the kernel.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
---
 drivers/mmc/sdhci.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 4bf1fea5e2c4..38f0f820af68 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -22,7 +22,6 @@
 #include "sdhci.h"
 
 #define DRIVER_NAME "sdhci"
-#define DRIVER_VERSION "0.12"
 
 #define BUGMAIL "<sdhci-devel@list.drzeus.cx>"
 
@@ -1528,8 +1527,7 @@ static struct pci_driver sdhci_driver = {
 static int __init sdhci_drv_init(void)
 {
 	printk(KERN_INFO DRIVER_NAME
-		": Secure Digital Host Controller Interface driver, "
-		DRIVER_VERSION "\n");
+		": Secure Digital Host Controller Interface driver\n");
 	printk(KERN_INFO DRIVER_NAME ": Copyright(c) Pierre Ossman\n");
 
 	return pci_register_driver(&sdhci_driver);
@@ -1551,7 +1549,6 @@ module_param(debug_quirks, uint, 0444);
 
 MODULE_AUTHOR("Pierre Ossman <drzeus@drzeus.cx>");
 MODULE_DESCRIPTION("Secure Digital Host Controller Interface driver");
-MODULE_VERSION(DRIVER_VERSION);
 MODULE_LICENSE("GPL");
 
 MODULE_PARM_DESC(debug_nodma, "Forcefully disable DMA transfers. (default 0)");

From acf1da4522add3771f4851c09c7fe6bcf1dd6636 Mon Sep 17 00:00:00 2001
From: Pierre Ossman <drzeus@drzeus.cx>
Date: Fri, 9 Feb 2007 08:29:19 +0100
Subject: [PATCH 3/5] mmc: sdhci: Stop asking for mail

We get enough error reports without having to ask for it.
Remove notices about mailing the development list.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
---
 drivers/mmc/sdhci.c | 35 +++++++++++------------------------
 1 file changed, 11 insertions(+), 24 deletions(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 38f0f820af68..7522f76b15ec 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -23,8 +23,6 @@
 
 #define DRIVER_NAME "sdhci"
 
-#define BUGMAIL "<sdhci-devel@list.drzeus.cx>"
-
 #define DBG(f, x...) \
 	pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x)
 
@@ -153,8 +151,7 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
 	/* hw clears the bit when it's done */
 	while (readb(host->ioaddr + SDHCI_SOFTWARE_RESET) & mask) {
 		if (timeout == 0) {
-			printk(KERN_ERR "%s: Reset 0x%x never completed. "
-				"Please report this to " BUGMAIL ".\n",
+			printk(KERN_ERR "%s: Reset 0x%x never completed.\n",
 				mmc_hostname(host->mmc), (int)mask);
 			sdhci_dumpregs(host);
 			return;
@@ -473,12 +470,11 @@ static void sdhci_finish_data(struct sdhci_host *host)
 
 	if ((data->error == MMC_ERR_NONE) && blocks) {
 		printk(KERN_ERR "%s: Controller signalled completion even "
-			"though there were blocks left. Please report this "
-			"to " BUGMAIL ".\n", mmc_hostname(host->mmc));
+			"though there were blocks left.\n",
+			mmc_hostname(host->mmc));
 		data->error = MMC_ERR_FAILED;
 	} else if (host->size != 0) {
-		printk(KERN_ERR "%s: %d bytes were left untransferred. "
-			"Please report this to " BUGMAIL ".\n",
+		printk(KERN_ERR "%s: %d bytes were left untransferred.\n",
 			mmc_hostname(host->mmc), host->size);
 		data->error = MMC_ERR_FAILED;
 	}
@@ -525,8 +521,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
 	while (readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask) {
 		if (timeout == 0) {
 			printk(KERN_ERR "%s: Controller never released "
-				"inhibit bit(s). Please report this to "
-				BUGMAIL ".\n", mmc_hostname(host->mmc));
+				"inhibit bit(s).\n", mmc_hostname(host->mmc));
 			sdhci_dumpregs(host);
 			cmd->error = MMC_ERR_FAILED;
 			tasklet_schedule(&host->finish_tasklet);
@@ -547,8 +542,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
 	sdhci_set_transfer_mode(host, cmd->data);
 
 	if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) {
-		printk(KERN_ERR "%s: Unsupported response type! "
-			"Please report this to " BUGMAIL ".\n",
+		printk(KERN_ERR "%s: Unsupported response type!\n",
 			mmc_hostname(host->mmc));
 		cmd->error = MMC_ERR_INVALID;
 		tasklet_schedule(&host->finish_tasklet);
@@ -646,9 +640,8 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
 	while (!((clk = readw(host->ioaddr + SDHCI_CLOCK_CONTROL))
 		& SDHCI_CLOCK_INT_STABLE)) {
 		if (timeout == 0) {
-			printk(KERN_ERR "%s: Internal clock never stabilised. "
-				"Please report this to " BUGMAIL ".\n",
-				mmc_hostname(host->mmc));
+			printk(KERN_ERR "%s: Internal clock never "
+				"stabilised.\n", mmc_hostname(host->mmc));
 			sdhci_dumpregs(host);
 			return;
 		}
@@ -898,9 +891,8 @@ static void sdhci_timeout_timer(unsigned long data)
 	spin_lock_irqsave(&host->lock, flags);
 
 	if (host->mrq) {
-		printk(KERN_ERR "%s: Timeout waiting for hardware interrupt. "
-			"Please report this to " BUGMAIL ".\n",
-			mmc_hostname(host->mmc));
+		printk(KERN_ERR "%s: Timeout waiting for hardware "
+			"interrupt.\n", mmc_hostname(host->mmc));
 		sdhci_dumpregs(host);
 
 		if (host->data) {
@@ -934,8 +926,6 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
 		printk(KERN_ERR "%s: Got command interrupt even though no "
 			"command operation was in progress.\n",
 			mmc_hostname(host->mmc));
-		printk(KERN_ERR "%s: Please report this to " BUGMAIL ".\n",
-			mmc_hostname(host->mmc));
 		sdhci_dumpregs(host);
 		return;
 	}
@@ -971,8 +961,6 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
 		printk(KERN_ERR "%s: Got data interrupt even though no "
 			"data operation was in progress.\n",
 			mmc_hostname(host->mmc));
-		printk(KERN_ERR "%s: Please report this to " BUGMAIL ".\n",
-			mmc_hostname(host->mmc));
 		sdhci_dumpregs(host);
 
 		return;
@@ -1044,8 +1032,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
 	intmask &= SDHCI_INT_BUS_POWER;
 
 	if (intmask) {
-		printk(KERN_ERR "%s: Unexpected interrupt 0x%08x. Please "
-			"report this to " BUGMAIL ".\n",
+		printk(KERN_ERR "%s: Unexpected interrupt 0x%08x.\n",
 			mmc_hostname(host->mmc), intmask);
 		sdhci_dumpregs(host);
 

From abc71668b5c99b655c6b2677570748a840d4c713 Mon Sep 17 00:00:00 2001
From: Pierre Ossman <drzeus@drzeus.cx>
Date: Sun, 11 Feb 2007 16:27:13 +0100
Subject: [PATCH 4/5] mmc: wbsd: Remove stray kunmap_atomic()

There was one kunmap_atomic() left over from
4a0ddbd25ad4e03a0a1657f5cb2259c9a35fe9e6 that was causing
crashes.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
---
 drivers/mmc/wbsd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
index 2d323af20025..05ccfc43168f 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/wbsd.c
@@ -343,7 +343,6 @@ static inline void wbsd_dma_to_sg(struct wbsd_host *host, struct mmc_data *data)
 			memcpy(sgbuf, dmabuf, size);
 		else
 			memcpy(sgbuf, dmabuf, sg[i].length);
-		kunmap_atomic(sgbuf, KM_BIO_SRC_IRQ);
 		dmabuf += sg[i].length;
 
 		if (size < sg[i].length)

From 12c834527b85571792f1c4f1d12632185bea44c2 Mon Sep 17 00:00:00 2001
From: Alex Dubov <oakad@yahoo.com>
Date: Sat, 10 Feb 2007 21:16:40 -0800
Subject: [PATCH 5/5] tifm_sd: treat "status error" as normal command
 completion

TI FlasMedia controller attempts to validate command responses and
issues a "status error" if response does not matches its perceived
(by controller) value. As mmc layer does its own validation we can
safely ignore the controller's opinion.

Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
---
 drivers/mmc/tifm_sd.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/tifm_sd.c b/drivers/mmc/tifm_sd.c
index e65f8a0a9349..0581d09c58fc 100644
--- a/drivers/mmc/tifm_sd.c
+++ b/drivers/mmc/tifm_sd.c
@@ -36,8 +36,8 @@ module_param(fixed_timeout, bool, 0644);
 #define TIFM_MMCSD_INAB       0x0080   /* abort / initialize command */
 #define TIFM_MMCSD_READ       0x8000
 
-#define TIFM_MMCSD_DATAMASK   0x001d   /* set bits: EOFB, BRS, CB, EOC */
-#define TIFM_MMCSD_ERRMASK    0x41e0   /* set bits: CERR, CCRC, CTO, DCRC, DTO */
+#define TIFM_MMCSD_DATAMASK   0x401d   /* set bits: CERR, EOFB, BRS, CB, EOC */
+#define TIFM_MMCSD_ERRMASK    0x01e0   /* set bits: CCRC, CTO, DCRC, DTO */
 #define TIFM_MMCSD_EOC        0x0001   /* end of command phase  */
 #define TIFM_MMCSD_CB         0x0004   /* card enter busy state */
 #define TIFM_MMCSD_BRS        0x0008   /* block received/sent   */
@@ -242,7 +242,7 @@ change_state:
 	case IDLE:
 		return;
 	case CMD:
-		if (host_status & TIFM_MMCSD_EOC) {
+		if (host_status & (TIFM_MMCSD_EOC | TIFM_MMCSD_CERR)) {
 			tifm_sd_fetch_resp(cmd, sock);
 			if (cmd->data) {
 				host->state = BRS;
@@ -341,10 +341,7 @@ static void tifm_sd_signal_irq(struct tifm_dev *sock,
 			goto done;
 
 		if (host_status & TIFM_MMCSD_ERRMASK) {
-			if (host_status & TIFM_MMCSD_CERR)
-				error_code = MMC_ERR_FAILED;
-			else if (host_status
-				 & (TIFM_MMCSD_CTO | TIFM_MMCSD_DTO))
+			if (host_status & (TIFM_MMCSD_CTO | TIFM_MMCSD_DTO))
 				error_code = MMC_ERR_TIMEOUT;
 			else if (host_status
 				 & (TIFM_MMCSD_CCRC | TIFM_MMCSD_DCRC))