mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@nokia.com>
To: Pierre Ossman <drzeus-mmc@drzeus.cx>
Cc: Jarkko Lavinen <jarkko.lavinen@nokia.com>,
	Adrian Hunter <adrian.hunter@nokia.com>,
	Grazvydas Ignotas <notasas@gmail.com>,
	David Brownell <david-b@pacbell.net>,
	linux-omap Mailing List <linux-omap@vger.kernel.org>,
	Tony Lindgren <tony@atomide.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH 10/10] OMAP: HSMMC: Wait for SDBP
Date: Thu, 12 Mar 2009 18:24:00 +0200	[thread overview]
Message-ID: <20090312162400.19421.13764.sendpatchset@ahunter-laptop> (raw)
In-Reply-To: <20090312162252.19421.34019.sendpatchset@ahunter-laptop>

>From e543f7849ab668fa0cbabc048e37e090e7b6f167 Mon Sep 17 00:00:00 2001
From: Adrian Hunter <adrian.hunter@nokia.com>
Date: Thu, 12 Mar 2009 17:08:26 +0200
Subject: [PATCH] OMAP: HSMMC: Wait for SDBP

It is necessary to wait for bus power before sending
any commands.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
---
 drivers/mmc/host/omap_hsmmc.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 91381f4..2f444c8 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -546,6 +546,19 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+static void set_sd_bus_power(struct mmc_omap_host *host)
+{
+	unsigned long i;
+
+	OMAP_HSMMC_WRITE(host->base, HCTL,
+			 OMAP_HSMMC_READ(host->base, HCTL) | SDBP);
+	for (i = 0; i < loops_per_jiffy; i++) {
+		if (OMAP_HSMMC_READ(host->base, HCTL) & SDBP)
+			break;
+		cpu_relax();
+	}
+}
+
 /*
  * Switch MMC interface voltage ... only relevant for MMC1.
  *
@@ -602,9 +615,7 @@ static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd)
 		reg_val |= SDVS30;
 
 	OMAP_HSMMC_WRITE(host->base, HCTL, reg_val);
-
-	OMAP_HSMMC_WRITE(host->base, HCTL,
-		OMAP_HSMMC_READ(host->base, HCTL) | SDBP);
+	set_sd_bus_power(host);
 
 	return 0;
 err:
@@ -997,8 +1008,7 @@ static void omap_hsmmc_init(struct mmc_omap_host *host)
 	OMAP_HSMMC_WRITE(host->base, SYSCONFIG, value | AUTOIDLE);
 
 	/* Set SD bus power bit */
-	value = OMAP_HSMMC_READ(host->base, HCTL);
-	OMAP_HSMMC_WRITE(host->base, HCTL, value | SDBP);
+	set_sd_bus_power(host);
 }
 
 static struct mmc_host_ops mmc_omap_ops = {
-- 
1.5.6.3


  parent reply	other threads:[~2009-03-12 16:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12 16:22 [PATCH 0/10] omap_hsmmc patches Adrian Hunter
2009-03-12 16:22 ` [PATCH 1/10] OMAP: HSMMC: Do dma cleanup also with data CRC errors Adrian Hunter
2009-03-12 16:23 ` [PATCH 2/10] OMAP: HSMMC: Fix response type for busy after response Adrian Hunter
2009-03-12 16:23 ` [PATCH 3/10] OMAP: HSMMC: Implement scatter-gather emulation Adrian Hunter
2009-03-12 16:23 ` [PATCH 4/10] OMAP: HSMMC: Add 8-bit bus width mode support Adrian Hunter
2009-03-12 16:23 ` [PATCH 5/10] OMAP: HSMMC: Allow cover switch to cause rescan Adrian Hunter
2009-03-12 16:23 ` [PATCH 6/10] OMAP: HSMMC: Do not prefix slot name Adrian Hunter
2009-03-12 16:23 ` [PATCH 7/10] OMAP: HSMMC: Disable SDBP at suspend Adrian Hunter
2009-03-12 16:23 ` [PATCH 8/10] OMAP: HSMMC: Make driver support dynamic idle Adrian Hunter
2009-03-22 14:30   ` Pierre Ossman
2009-03-12 16:23 ` [PATCH 9/10] OMAP: HSMMC: Fix MMC3 dma Adrian Hunter
2009-03-13 10:16   ` Adrian Hunter
2009-03-12 16:24 ` Adrian Hunter [this message]
2009-03-22 14:31 ` [PATCH 0/10] omap_hsmmc patches Pierre Ossman

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=20090312162400.19421.13764.sendpatchset@ahunter-laptop \
    --to=adrian.hunter@nokia.com \
    --cc=david-b@pacbell.net \
    --cc=drzeus-mmc@drzeus.cx \
    --cc=jarkko.lavinen@nokia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=notasas@gmail.com \
    --cc=tony@atomide.com \
    /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

all inboxes | Powered by JetHome®