From: Adrian Hunter <adrian.hunter@intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
Tomas Winkler <tomas.winkler@intel.com>
Subject: [PATCH RFC 2/3] mmc: mmc: Factor out mmc_hs400_to_hs() and __mmc_hs_to_hs200()
Date: Thu, 21 Apr 2016 16:28:33 +0300 [thread overview]
Message-ID: <1461245314-6282-3-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1461245314-6282-1-git-send-email-adrian.hunter@intel.com>
Factor out mmc_hs400_to_hs() and __mmc_hs_to_hs200() so they can be
re-used in a later patch.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/core/mmc.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index a3fff994e6af..4f771c6088f7 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1162,7 +1162,7 @@ int mmc_hs200_to_hs400(struct mmc_card *card)
return mmc_select_hs400(card);
}
-int mmc_hs400_to_hs200(struct mmc_card *card)
+static int mmc_hs400_to_hs(struct mmc_card *card)
{
struct mmc_host *host = card->host;
bool send_status = true;
@@ -1208,6 +1208,24 @@ int mmc_hs400_to_hs200(struct mmc_card *card)
goto out_err;
}
+ return 0;
+
+out_err:
+ pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host),
+ __func__, err);
+ return err;
+}
+
+static int __mmc_hs_to_hs200(struct mmc_card *card)
+{
+ struct mmc_host *host = card->host;
+ bool send_status = true;
+ int err;
+ u8 val;
+
+ if (host->caps & MMC_CAP_WAIT_WHILE_BUSY)
+ send_status = false;
+
/* Switch HS to HS200 */
val = EXT_CSD_TIMING_HS200 |
card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
@@ -1235,6 +1253,26 @@ out_err:
return err;
}
+int mmc_hs400_to_hs200(struct mmc_card *card)
+{
+ int err;
+
+ err = mmc_hs400_to_hs(card);
+ if (err)
+ goto out_err;
+
+ err = __mmc_hs_to_hs200(card);
+ if (err)
+ goto out_err;
+
+ return 0;
+
+out_err:
+ pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host),
+ __func__, err);
+ return err;
+}
+
static void mmc_select_driver_type(struct mmc_card *card)
{
int card_drv_type, drive_strength, drv_type;
--
1.9.1
next prev parent reply other threads:[~2016-04-21 13:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 13:28 [PATCH RFC 0/3] mmc: block: Fix tuning (by avoiding it) for RPMB Adrian Hunter
2016-04-21 13:28 ` [PATCH RFC 1/3] mmc: mmc: Factor out mmc_hs200_to_hs() Adrian Hunter
2016-04-21 13:28 ` Adrian Hunter [this message]
2016-04-21 13:28 ` [PATCH RFC 3/3] mmc: block: Fix tuning (by avoiding it) for RPMB Adrian Hunter
2016-04-28 10:34 ` Ulf Hansson
2016-04-28 11:02 ` Adrian Hunter
2016-04-28 11:46 ` Ulf Hansson
2016-04-28 13:02 ` Adrian Hunter
2016-05-02 8:24 ` Ulf Hansson
2016-05-02 9:31 ` Adrian Hunter
2016-05-02 11:14 ` Ulf Hansson
2016-04-28 7:21 ` [PATCH RFC 0/3] " Adrian Hunter
2016-05-02 21:19 ` Winkler, Tomas
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=1461245314-6282-3-git-send-email-adrian.hunter@intel.com \
--to=adrian.hunter@intel.com \
--cc=linux-mmc@vger.kernel.org \
--cc=tomas.winkler@intel.com \
--cc=ulf.hansson@linaro.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.