public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] MMC compatibility fix - GO_IDLE
Date: Wed, 22 Sep 2004 15:17:35 +0100	[thread overview]
Message-ID: <20040922151735.D2347@flint.arm.linux.org.uk> (raw)
In-Reply-To: <414C065A.7000602@drzeus.cx>; from drzeus-list@drzeus.cx on Sat, Sep 18, 2004 at 11:56:42AM +0200

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

On Sat, Sep 18, 2004 at 11:56:42AM +0200, Pierre Ossman wrote:
> This patch adds a GO_IDLE before sending a new SEND_OP_COND (as required 
> by MMC standard).

Thanks; I haven't completely vanished off the face of the planet.

We already have a function using MMC_GO_IDLE_STATE, so I suggest we
separate this out.  If you need a 1ms delay after sending this, maybe
the other case also needs this delay as well?

How about this patch?

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

[-- Attachment #2: mmc-idlecards.diff --]
[-- Type: text/plain, Size: 1447 bytes --]

diff -u linux-2.6-mmc/drivers/mmc/mmc.c linux/drivers/mmc/mmc.c
--- linux-2.6-mmc/drivers/mmc/mmc.c	Mon Sep 20 10:23:16 2004
+++ linux/drivers/mmc/mmc.c	Wed Sep 22 15:14:00 2004
@@ -451,11 +451,26 @@
 }
 
 /*
+ * Tell attached cards to go to IDLE state
+ */
+static void mmc_idle_cards(struct mmc_host *host)
+{
+	struct mmc_command cmd;
+
+	cmd.opcode = MMC_GO_IDLE_STATE;
+	cmd.arg = 0;
+	cmd.flags = MMC_RSP_NONE;
+
+	mmc_wait_for_cmd(host, &cmd, 0);
+
+	mmc_delay(1);
+}
+
+/*
  * Apply power to the MMC stack.
  */
 static void mmc_power_up(struct mmc_host *host)
 {
-	struct mmc_command cmd;
 	int bit = fls(host->ocr_avail) - 1;
 
 	host->ios.vdd = bit;
@@ -470,12 +485,6 @@
 	host->ops->set_ios(host, &host->ios);
 
 	mmc_delay(2);
-
-	cmd.opcode = MMC_GO_IDLE_STATE;
-	cmd.arg = 0;
-	cmd.flags = MMC_RSP_NONE;
-
-	mmc_wait_for_cmd(host, &cmd, 0);
 }
 
 static void mmc_power_off(struct mmc_host *host)
@@ -647,12 +656,22 @@
 		u32 ocr;
 
 		mmc_power_up(host);
+		mmc_idle_cards(host);
 
 		err = mmc_send_op_cond(host, 0, &ocr);
 		if (err != MMC_ERR_NONE)
 			return;
 
 		host->ocr = mmc_select_voltage(host, ocr);
+
+		/*
+		 * Since we're changing the OCR value, we seem to
+		 * need to tell some cards to go back to the idle
+		 * state.  We wait 1ms to give cards time to
+		 * respond.
+		 */
+		if (host->ocr)
+			mmc_idle_cards(host);
 	} else {
 		host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
 		host->ios.clock = host->f_min;

  reply	other threads:[~2004-09-22 14:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-18  9:56 [PATCH 1/3] MMC compatibility fix - GO_IDLE Pierre Ossman
2004-09-22 14:17 ` Russell King [this message]
2004-09-22 17:45   ` Pierre Ossman
2004-09-22 19:15     ` Russell King

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=20040922151735.D2347@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=drzeus-list@drzeus.cx \
    --cc=linux-kernel@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