[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1487577792-12510-4-git-send-email-riteshh@codeaurora.org>
Date: Mon, 20 Feb 2017 13:33:11 +0530
From: Ritesh Harjani <riteshh@...eaurora.org>
To: ulf.hansson@...aro.org, linux-mmc@...r.kernel.org,
adrian.hunter@...el.com
Cc: shawn.lin@...k-chips.com, devicetree@...r.kernel.org,
andy.gross@...aro.org, linux-arm-msm@...r.kernel.org,
georgi.djakov@...aro.org, alex.lemberg@...disk.com,
mateusz.nowak@...el.com, Yuliy.Izrailov@...disk.com,
asutoshd@...eaurora.org, david.griego@...aro.org,
stummala@...eaurora.org, venkatg@...eaurora.org,
pramod.gurav@...aro.org, jeremymc@...hat.com,
linux-kernel@...r.kernel.org,
Ritesh Harjani <riteshh@...eaurora.org>
Subject: [RFC PATCH 3/4] mmc: mmc: add support for CMD5 awake
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@...eaurora.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.
Powered by blists - more mailing lists