From: Ritesh Harjani <riteshh@codeaurora.org>
To: ulf.hansson@linaro.org, linux-mmc@vger.kernel.org,
adrian.hunter@intel.com
Cc: shawn.lin@rock-chips.com, devicetree@vger.kernel.org,
andy.gross@linaro.org, linux-arm-msm@vger.kernel.org,
georgi.djakov@linaro.org, alex.lemberg@sandisk.com,
mateusz.nowak@intel.com, Yuliy.Izrailov@sandisk.com,
asutoshd@codeaurora.org, david.griego@linaro.org,
stummala@codeaurora.org, venkatg@codeaurora.org,
pramod.gurav@linaro.org, jeremymc@redhat.com,
linux-kernel@vger.kernel.org,
Ritesh Harjani <riteshh@codeaurora.org>
Subject: [RFC PATCH 3/4] mmc: mmc: add support for CMD5 awake
Date: Mon, 20 Feb 2017 13:33:11 +0530 [thread overview]
Message-ID: <1487577792-12510-4-git-send-email-riteshh@codeaurora.org> (raw)
In-Reply-To: <1487577792-12510-1-git-send-email-riteshh@codeaurora.org>
This patch adds CMD5 awake support for emmc.
This will be used to awake emmc from suspend together
with partial_init support to reduce resume latencies.
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
---
drivers/mmc/core/mmc.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 7fd7228..83bcc86 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1827,7 +1827,7 @@ static int mmc_can_sleep(struct mmc_card *card)
return (card && card->ext_csd.rev >= 3);
}
-static int mmc_sleep(struct mmc_host *host)
+static int mmc_sleepawake(struct mmc_host *host, bool sleep)
{
struct mmc_command cmd = {};
struct mmc_card *card = host->card;
@@ -1837,13 +1837,16 @@ static int mmc_sleep(struct mmc_host *host)
/* Re-tuning can't be done once the card is deselected */
mmc_retune_hold(host);
- err = mmc_deselect_cards(host);
- if (err)
- goto out_release;
+ if (sleep) {
+ err = mmc_deselect_cards(host);
+ if (err)
+ goto out_release;
+ }
cmd.opcode = MMC_SLEEP_AWAKE;
cmd.arg = card->rca << 16;
- cmd.arg |= 1 << 15;
+ if (sleep)
+ cmd.arg |= 1 << 15;
/*
* If the max_busy_timeout of the host is specified, validate it against
@@ -1871,11 +1874,24 @@ static int mmc_sleep(struct mmc_host *host)
if (!cmd.busy_timeout || !(host->caps & MMC_CAP_WAIT_WHILE_BUSY))
mmc_delay(timeout_ms);
+ if (!sleep)
+ err = mmc_select_card(card);
+
out_release:
mmc_retune_release(host);
return err;
}
+static int mmc_sleep(struct mmc_host *host)
+{
+ return mmc_sleepawake(host, true);
+}
+
+static int mmc_awake(struct mmc_host *host)
+{
+ return mmc_sleepawake(host, false);
+}
+
static int mmc_can_poweroff_notify(const struct mmc_card *card)
{
return card &&
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2017-02-20 8:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-20 8:03 [RFC PATCH 0/4] mmc: core: Provide CMD5 awake and partial_init support Ritesh Harjani
2017-02-20 8:03 ` [RFC PATCH 1/4] Documentation: mmc: add mmc-sleep-awake Ritesh Harjani
2017-02-27 19:04 ` Rob Herring
2017-02-20 8:03 ` [RFC PATCH 2/4] mmc: core: add mmc-sleep-awake caps Ritesh Harjani
2017-02-20 8:03 ` Ritesh Harjani [this message]
2017-02-20 8:03 ` [RFC PATCH 4/4] mmc: core: Implement mmc_partial_init during resume Ritesh Harjani
2017-02-21 7:40 ` Adrian Hunter
[not found] ` <1487577792-12510-5-git-send-email-riteshh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-02-21 10:51 ` Ulf Hansson
2017-02-20 11:39 ` [RFC PATCH 0/4] mmc: core: Provide CMD5 awake and partial_init support Ulf Hansson
2017-02-20 13:04 ` Ritesh Harjani
2017-02-22 0:55 ` Shawn Lin
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=1487577792-12510-4-git-send-email-riteshh@codeaurora.org \
--to=riteshh@codeaurora.org \
--cc=Yuliy.Izrailov@sandisk.com \
--cc=adrian.hunter@intel.com \
--cc=alex.lemberg@sandisk.com \
--cc=andy.gross@linaro.org \
--cc=asutoshd@codeaurora.org \
--cc=david.griego@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=georgi.djakov@linaro.org \
--cc=jeremymc@redhat.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=mateusz.nowak@intel.com \
--cc=pramod.gurav@linaro.org \
--cc=shawn.lin@rock-chips.com \
--cc=stummala@codeaurora.org \
--cc=ulf.hansson@linaro.org \
--cc=venkatg@codeaurora.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).