All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sonic Zhang <sonic.adi@gmail.com>
To: Chris Ball <cjb@laptop.org>
Cc: linux-mmc@vger.kernel.org, Bob Liu <liubbo@gmail.com>,
	uclinux-dist-devel@blackfin.uclinux.org,
	Sonic Zhang <sonic.zhang@analog.com>
Subject: [PATCH 4/4] mmc: bfin_sdh: Reset SD controller when resume from power saving mode.
Date: Tue, 7 Aug 2012 11:10:15 +0800	[thread overview]
Message-ID: <1344309015-13248-4-git-send-email-sonic.adi@gmail.com> (raw)
In-Reply-To: <1344309015-13248-1-git-send-email-sonic.adi@gmail.com>

From: Sonic Zhang <sonic.zhang@analog.com>

Without reset, SD controller may stay in disable mode, SD card can't
be detected when resume from power saving mode.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
 drivers/mmc/host/bfin_sdh.c |   35 +++++++++++++++++++----------------
 1 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c
index 57b7548..a95a09a 100644
--- a/drivers/mmc/host/bfin_sdh.c
+++ b/drivers/mmc/host/bfin_sdh.c
@@ -512,6 +512,23 @@ static irqreturn_t sdh_stat_irq(int irq, void *devid)
 	return IRQ_RETVAL(handled);
 }
 
+static void sdh_reset(void)
+{
+#if defined(CONFIG_BF54x)
+	/* Secure Digital Host shares DMA with Nand controller */
+	bfin_write_DMAC1_PERIMUX(bfin_read_DMAC1_PERIMUX() | 0x1);
+#endif
+
+	bfin_write_SDH_CFG(bfin_read_SDH_CFG() | CLKS_EN);
+	SSYNC();
+
+	/* Disable card inserting detection pin. set MMC_CAP_NEEDS_POLL, and
+	 * mmc stack will do the detection.
+	 */
+	bfin_write_SDH_CFG((bfin_read_SDH_CFG() & 0x1F) | (PUP_SDDAT | PUP_SDDAT3));
+	SSYNC();
+}
+
 static int __devinit sdh_probe(struct platform_device *pdev)
 {
 	struct mmc_host *mmc;
@@ -588,19 +605,8 @@ static int __devinit sdh_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "unable to request peripheral pins\n");
 		goto out4;
 	}
-#if defined(CONFIG_BF54x)
-	/* Secure Digital Host shares DMA with Nand controller */
-	bfin_write_DMAC1_PERIMUX(bfin_read_DMAC1_PERIMUX() | 0x1);
-#endif
 
-	bfin_write_SDH_CFG(bfin_read_SDH_CFG() | CLKS_EN);
-	SSYNC();
-
-	/* Disable card inserting detection pin. set MMC_CAP_NEEDS_POLL, and
-	 * mmc stack will do the detection.
-	 */
-	bfin_write_SDH_CFG((bfin_read_SDH_CFG() & 0x1F) | (PUP_SDDAT | PUP_SDDAT3));
-	SSYNC();
+	sdh_reset();
 
 	mmc_add_host(mmc);
 	return 0;
@@ -667,10 +673,7 @@ static int sdh_resume(struct platform_device *dev)
 		return ret;
 	}
 
-#if defined(CONFIG_BF54x)
-	/* Secure Digital Host shares DMA with Nand controller */
-	bfin_write_DMAC1_PERIMUX(bfin_read_DMAC1_PERIMUX() | 0x1);
-#endif
+	sdh_reset();
 
 	if (mmc)
 		ret = mmc_resume_host(mmc);
-- 
1.7.0.4



  parent reply	other threads:[~2012-08-07  3:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07  3:10 [PATCH 1/4] mmc: bfin_sdh: limit mmc DMA segment len to 1 for bf518 Sonic Zhang
2012-08-07  3:10 ` [PATCH 2/4] mmc: bfin_sdh: Port bf5xx SD host driver to support new RSI controller in bf60x Sonic Zhang
2012-08-08  4:15   ` Chris Ball
2012-08-07  3:10 ` [PATCH 3/4] mmc: bfin_sdh: Remove redundent suspend and resume setting Sonic Zhang
2012-08-08  4:20   ` Chris Ball
2012-08-07  3:10 ` Sonic Zhang [this message]
2012-08-08  4:20   ` [PATCH 4/4] mmc: bfin_sdh: Reset SD controller when resume from power saving mode Chris Ball
2012-08-08  3:23 ` [PATCH 1/4] mmc: bfin_sdh: limit mmc DMA segment len to 1 for bf518 Sonic Zhang
2012-08-08  3:31   ` Chris Ball
     [not found]     ` <87zk66vz45.fsf-DGHOrqG7t0YzNDMTQreKSUB+6BGkLq7r@public.gmane.org>
2012-08-08  3:36       ` Chris Ball
2012-08-08  3:40         ` Zhang, Sonic
2012-08-08  3:39     ` Zhang, Sonic
2012-08-08  3:42       ` Chris Ball
2012-08-08  4:11 ` Chris Ball

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=1344309015-13248-4-git-send-email-sonic.adi@gmail.com \
    --to=sonic.adi@gmail.com \
    --cc=cjb@laptop.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=liubbo@gmail.com \
    --cc=sonic.zhang@analog.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.