diff mbox

[v3] OMAP: Fix for bus width which improves SD card's peformance.

Message ID 4BBBC628.9030207@ti.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Nishanth Menon April 6, 2010, 11:39 p.m. UTC
None
diff mbox

Patch

From 09b55eb33749d308586c19485bf1e1723009fc9a Mon Sep 17 00:00:00 2001
From: kishore kadiyala <kishorek.kadiyala@gmail.com>
Date: Wed, 31 Mar 2010 07:03:01 +0000
Subject: [PATCH Vn] OMAP: Fix for bus width which improves SD card's peformance.

This patch improves low speeds for SD cards.
OMAP-MMC controller's can support maximum bus width of '8'.
when bus width is mentioned as "8" in controller data,the SD
stack will check whether bus width is "4" and if not it will
set bus width to "1" and there by degrading performance.
This patch fixes the issue and improves the performance of
SD cards.

Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
Signed-off-by: Venkatraman S <svenkatr@ti.com>
Acked-by: Madhusudhan Chikkature <madhu.cr@ti.com>
Tested-by: Jarkko Nikula <jhnikula@gmail.com>
---
NM Note:
	Completely untested/unreviewed.. just holding on to
	what was in https://patchwork.kernel.org/patch/89898/
	with my suggested mods
 drivers/mmc/host/omap_hsmmc.c |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 83f0aff..89e26bc 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2091,10 +2091,36 @@  static int __init omap_hsmmc_probe(struct platform_device *pdev)
 	mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
 		     MMC_CAP_WAIT_WHILE_BUSY;
 
-	if (mmc_slot(host).wires >= 8)
+	switch(mmc_slot(host).wires) {
+	case 8:
 		mmc->caps |= MMC_CAP_8_BIT_DATA;
-	else if (mmc_slot(host).wires >= 4)
-		mmc->caps |= MMC_CAP_4_BIT_DATA;
+		/* Fall through */
+	case 4:
+		mmc->caps |= MMC_CAP_8_BIT_DATA;
+		break;
+	case 1:
+		/*
+		 * I will still survive with this config.. but warn
+		 * if the board file was goofed up
+		 */
+		dev_warn(mmc_dev(host->mmc), "Using potentially"
+				"unoptimal 1bit config\n");
+		break;
+	default:
+		/* Completely unexpected.. dont wanna croak and die */
+		dev_crit(mmc_dev(host->mmc), "Unknown width %d"
+				"used!\n",mmc_slot(host).wires);
+		mmc_host_disable(host->mmc);
+		if (host->got_dbclk) {
+			 clk_disable(host->dbclk);
+			 clk_put(host->dbclk);
+		}
+		clk_disable(host->iclk);
+		clk_put(host->iclk);
+		clk_put(host->fclk);
+		goto err1;
+
+	}
 
 	if (mmc_slot(host).nonremovable)
 		mmc->caps |= MMC_CAP_NONREMOVABLE;
-- 
1.6.3.3