linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* bug in drivers/mmc/core/core.c
@ 2010-03-22  6:56 Fred LIU
  0 siblings, 0 replies; only message in thread
From: Fred LIU @ 2010-03-22  6:56 UTC (permalink / raw)
  To: linux-mmc

[-- Attachment #1: Type: text/plain, Size: 942 bytes --]

Hi, greetings,

I think below line has a bug in core.c.

According to SD specification, the maximum identification frequency is
400 KHz (physical_layer_2.0.pdf, page 123).
But the original code would set higher than 400 KHz if the f_min is
higher than 400 KHz. Conversely, if f_min is lower than 400 KHz, it is
always set as 400 KHz. This is wrong also.

========================================================

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 3168ebd..0cf7e5c 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -907,7 +907,7 @@ static void mmc_power_up(struct mmc_host *host)
 	 */
 	mmc_delay(10);

-	if (host->f_min > 400000) {
+	if (host->f_min < 400000) {
 		pr_warning("%s: Minimum clock frequency too high for "
 				"identification mode\n", mmc_hostname(host));
 		host->ios.clock = host->f_min;

===========================================================

Best regards,
Fred

[-- Attachment #2: 0001-mmc-Maximum-frequency-of-identification-mode-is-400-.patch --]
[-- Type: application/octet-stream, Size: 800 bytes --]

From 6c53828369641ed737027ce5dab0a6b547b79824 Mon Sep 17 00:00:00 2001
From: fred <fred@fred-desktop.(none)>
Date: Mon, 22 Mar 2010 14:53:34 +0800
Subject: [PATCH] [mmc] Maximum frequency of identification mode is 400 KHz

---
 drivers/mmc/core/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 3168ebd..0cf7e5c 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -907,7 +907,7 @@ static void mmc_power_up(struct mmc_host *host)
 	 */
 	mmc_delay(10);
 
-	if (host->f_min > 400000) {
+	if (host->f_min < 400000) {
 		pr_warning("%s: Minimum clock frequency too high for "
 				"identification mode\n", mmc_hostname(host));
 		host->ios.clock = host->f_min;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-22  7:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-22  6:56 bug in drivers/mmc/core/core.c Fred LIU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).