linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: ulf.hansson@linaro.org, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org, nsekhar@ti.com
Cc: adrian.hunter@intel.com, neilb@suse.de,
	zhonghui.fu@linux.intel.com, afenkart@gmail.com, kishon@ti.com
Subject: [RFC PATCH 2/2] mmc: core: sdio: claim host before power up or power off
Date: Mon, 24 Aug 2015 15:45:17 +0530	[thread overview]
Message-ID: <1440411317-8813-2-git-send-email-kishon@ti.com> (raw)
In-Reply-To: <1440411317-8813-1-git-send-email-kishon@ti.com>

mmc_sdio_runtime_resume and mmc_sdio_runtime_suspend does power up and
power off respectively but does so without claiming the host. Among other
things mmc_claim_host inovkes pm_runtime_get_sync to enable the clocks.
Invoke mmc_claim_host before mmc_power_up and mmc_power_off in
mmc_sdio_runtime_resume and mmc_sdio_runtime_suspend respectively.

This is required since certain platforms (like TI SoCs) access
the controller registers during power up.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/mmc/core/sdio.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 0cbbfb8..40795b2 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -1023,16 +1023,24 @@ static int mmc_sdio_power_restore(struct mmc_host *host)
 
 static int mmc_sdio_runtime_suspend(struct mmc_host *host)
 {
+	mmc_claim_host(host);
 	/* No references to the card, cut the power to it. */
 	mmc_power_off(host);
+	mmc_release_host(host);
 	return 0;
 }
 
 static int mmc_sdio_runtime_resume(struct mmc_host *host)
 {
+	int ret;
+
+	mmc_claim_host(host);
 	/* Restore power and re-initialize. */
 	mmc_power_up(host, host->card->ocr);
-	return mmc_sdio_power_restore(host);
+	ret = _mmc_sdio_power_restore(host);
+	mmc_release_host(host);
+
+	return ret;
 }
 
 static int mmc_sdio_reset(struct mmc_host *host)
-- 
1.7.9.5


  reply	other threads:[~2015-08-24 10:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-24 10:15 [RFC PATCH 1/2] mmc: core: sdio: move mmc_sdio_init_card to a separate function Kishon Vijay Abraham I
2015-08-24 10:15 ` Kishon Vijay Abraham I [this message]
2015-09-11 12:45   ` [RFC PATCH 2/2] mmc: core: sdio: claim host before power up or power off Ulf Hansson
2015-09-11 13:17     ` Kishon Vijay Abraham I

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=1440411317-8813-2-git-send-email-kishon@ti.com \
    --to=kishon@ti.com \
    --cc=adrian.hunter@intel.com \
    --cc=afenkart@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=nsekhar@ti.com \
    --cc=ulf.hansson@linaro.org \
    --cc=zhonghui.fu@linux.intel.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;
as well as URLs for NNTP newsgroup(s).