From: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
To: Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Kalle Valo <kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
Adrian Hunter
<adrian.hunter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Arend van Spriel
<arend.vanspriel-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Cc: brcm80211-dev-list.pdl-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Double Lo <double.lo-+wT8y+m8/X5BDgjK7y7TUQ@public.gmane.org>,
briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Naveen Gupta
<naveen.gupta-+wT8y+m8/X5BDgjK7y7TUQ@public.gmane.org>,
Madhan Mohan R
<madhanmohan.r-+wT8y+m8/X5BDgjK7y7TUQ@public.gmane.org>,
mka-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
Wright Feng <wright.feng-+wT8y+m8/X5BDgjK7y7TUQ@public.gmane.org>,
Chi-Hsien Lin
<chi-hsien.lin-+wT8y+m8/X5BDgjK7y7TUQ@public.gmane.org>,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
brcm80211-dev-list-+wT8y+m8/X5BDgjK7y7TUQ@public.gmane.org,
Douglas Anderson
<dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
Avri Altman <avri.altman-Sjgp3cTcYWE@public.gmane.org>
Subject: [PATCH v4 4/5] mmc: core: Add sdio_retune_hold_now() and sdio_retune_release()
Date: Thu, 13 Jun 2019 16:41:52 -0700 [thread overview]
Message-ID: <20190613234153.59309-5-dianders@chromium.org> (raw)
In-Reply-To: <20190613234153.59309-1-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
We want SDIO drivers to be able to temporarily stop retuning when the
driver knows that the SDIO card is not in a state where retuning will
work (maybe because the card is asleep). We'll move the relevant
functions to a place where drivers can call them.
Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
Changes in v4:
- Moved retune hold/release to SDIO API (Adrian).
Changes in v3:
- ("mmc: core: Export mmc_retune_hold_now() mmc_retune_release()") new for v3.
Changes in v2: None
drivers/mmc/core/sdio_io.c | 40 +++++++++++++++++++++++++++++++++++
include/linux/mmc/sdio_func.h | 3 +++
2 files changed, 43 insertions(+)
diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
index f822a9630b0e..1b6fe737bd72 100644
--- a/drivers/mmc/core/sdio_io.c
+++ b/drivers/mmc/core/sdio_io.c
@@ -15,6 +15,7 @@
#include "sdio_ops.h"
#include "core.h"
#include "card.h"
+#include "host.h"
/**
* sdio_claim_host - exclusively claim a bus for a certain SDIO function
@@ -770,3 +771,42 @@ void sdio_retune_crc_enable(struct sdio_func *func)
func->card->host->retune_crc_disable = false;
}
EXPORT_SYMBOL_GPL(sdio_retune_crc_enable);
+
+/**
+ * sdio_retune_hold_now - start deferring retuning requests till release
+ * @func: SDIO function attached to host
+ *
+ * This function can be called if it's currently a bad time to do
+ * a retune of the SDIO card. Retune requests made during this time
+ * will be held and we'll actually do the retune sometime after the
+ * release.
+ *
+ * This function could be useful if an SDIO card is in a power state
+ * where it can respond to a small subset of commands that doesn't
+ * include the retuning command. Care should be taken when using
+ * this function since (presumably) the retuning request we might be
+ * deferring was made for a good reason.
+ *
+ * This function should be called while the host is claimed.
+ */
+void sdio_retune_hold_now(struct sdio_func *func)
+{
+ mmc_retune_hold_now(func->card->host);
+}
+EXPORT_SYMBOL_GPL(sdio_retune_hold_now);
+
+/**
+ * sdio_retune_release - signal that it's OK to retune now
+ * @func: SDIO function attached to host
+ *
+ * This is the complement to sdio_retune_hold_now(). Calling this
+ * function won't make a retune happen right away but will allow
+ * them to be scheduled normally.
+ *
+ * This function should be called while the host is claimed.
+ */
+void sdio_retune_release(struct sdio_func *func)
+{
+ mmc_retune_release(func->card->host);
+}
+EXPORT_SYMBOL_GPL(sdio_retune_release);
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index 4820e6d09dac..5a177f7a83c3 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -170,4 +170,7 @@ extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags);
extern void sdio_retune_crc_disable(struct sdio_func *func);
extern void sdio_retune_crc_enable(struct sdio_func *func);
+extern void sdio_retune_hold_now(struct sdio_func *func);
+extern void sdio_retune_release(struct sdio_func *func);
+
#endif /* LINUX_MMC_SDIO_FUNC_H */
--
2.22.0.rc2.383.gf4fbbf30c2-goog
next prev parent reply other threads:[~2019-06-13 23:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 23:41 [PATCH v4 0/5] brcmfmac: sdio: Deal better w/ transmission errors related to idle Douglas Anderson
2019-06-13 23:41 ` [PATCH v4 2/5] mmc: core: API to temporarily disable retuning for SDIO CRC errors Douglas Anderson
[not found] ` <20190613234153.59309-3-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2019-06-14 12:04 ` Ulf Hansson
[not found] ` <CAPDyKFrgXGf_9=H7G40fiUQj=da5WWRys_oim2azgL4FEOeUVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-14 16:41 ` Doug Anderson
2019-06-17 7:53 ` Ulf Hansson
2019-06-17 8:30 ` Adrian Hunter
[not found] ` <20190613234153.59309-1-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2019-06-13 23:41 ` [PATCH v4 1/5] Revert "brcmfmac: disable command decode in sdio_aos" Douglas Anderson
2019-06-13 23:41 ` [PATCH v4 3/5] brcmfmac: sdio: Disable auto-tuning around commands expected to fail Douglas Anderson
2019-06-17 8:33 ` Adrian Hunter
[not found] ` <20190613234153.59309-4-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2019-06-17 10:35 ` Arend Van Spriel
2019-06-13 23:41 ` Douglas Anderson [this message]
2019-06-14 12:09 ` [PATCH v4 4/5] mmc: core: Add sdio_retune_hold_now() and sdio_retune_release() Ulf Hansson
2019-06-14 16:38 ` Doug Anderson
2019-06-14 17:17 ` Arend Van Spriel
2019-06-17 8:46 ` Adrian Hunter
2019-06-17 8:34 ` Adrian Hunter
2019-06-13 23:41 ` [PATCH v4 5/5] brcmfmac: sdio: Don't tune while the card is off Douglas Anderson
2019-06-17 8:28 ` Adrian Hunter
2019-06-17 10:52 ` Arend Van Spriel
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=20190613234153.59309-5-dianders@chromium.org \
--to=dianders-f7+t8e8rja9g9huczpvpmw@public.gmane.org \
--cc=adrian.hunter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=arend.vanspriel-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=avri.altman-Sjgp3cTcYWE@public.gmane.org \
--cc=brcm80211-dev-list-+wT8y+m8/X5BDgjK7y7TUQ@public.gmane.org \
--cc=brcm80211-dev-list.pdl-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=chi-hsien.lin-+wT8y+m8/X5BDgjK7y7TUQ@public.gmane.org \
--cc=double.lo-+wT8y+m8/X5BDgjK7y7TUQ@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=madhanmohan.r-+wT8y+m8/X5BDgjK7y7TUQ@public.gmane.org \
--cc=mka-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=naveen.gupta-+wT8y+m8/X5BDgjK7y7TUQ@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=wright.feng-+wT8y+m8/X5BDgjK7y7TUQ@public.gmane.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