linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fred LIU <a18596@motorola.com>
To: linux-mmc@vger.kernel.org
Subject: bug in drivers/mmc/core/core.c
Date: Mon, 22 Mar 2010 14:56:36 +0800	[thread overview]
Message-ID: <edce52581003212356r4fd5cfd6hd0209345f21fc79a@mail.gmail.com> (raw)

[-- 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


                 reply	other threads:[~2010-03-22  7:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=edce52581003212356r4fd5cfd6hd0209345f21fc79a@mail.gmail.com \
    --to=a18596@motorola.com \
    --cc=linux-mmc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).