diff mbox

sdhci: adjust sd 3.0 host controller spec clock divider

Message ID CDD4A6CE-487A-4740-87BA-96EEBF1E8217@marvell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Philip Rakity Oct. 1, 2010, 3:03 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 96c7f60..73a94fe 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1003,14 +1003,12 @@  static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
 		goto out;
 
 	if (host->version >= SDHCI_SPEC_300) {
-		/* Version 3.00 divisors must be a multiple of 2. */
 		if (host->max_clk <= clock)
 			div = 1;
 		else {
-			for (div = 2; div < SDHCI_MAX_DIV_SPEC_300; div += 2) {
-				if ((host->max_clk / div) <= clock)
-					break;
-			}
+			div = host->max_clk/clock;
+			if (host->max_clk % clock)
+				div++;
 		}
 	} else {
 		/* Version 2.00 divisors must be a power of 2. */