From: Hauke Mehrtens <hauke@hauke-m.de>
To: backports@vger.kernel.org
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Subject: [PATCH 08/18] header: Add sdio_retune*() functions
Date: Mon, 1 Jul 2019 23:49:03 +0200 [thread overview]
Message-ID: <20190701214914.8066-9-hauke@hauke-m.de> (raw)
In-Reply-To: <20190701214914.8066-1-hauke@hauke-m.de>
The brcmfmac driver now uses new sdio_retune*() functions. They are
added with kernel 5.2-rc6 and are backported to kernel 4.19.56 and
5.1.15
sdio_retune_hold_now() and sdio_retune_release() should work like in the
upstream kernel, the implementation of mmc_retune_release() and
mmc_retune_hold() was copied to backports into these functions. On
kernel < 4.3 backporting this is not so easy, so just use an empty
implementation there.
It is not possible to backport sdio_retune_crc_disable() and
sdio_retune_crc_enable() because they need an additional member in a
structure, just add an empty implementation.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
.../backport-include/linux/mmc/sdio_func.h | 76 +++++++++++++++++++
1 file changed, 76 insertions(+)
diff --git a/backport/backport-include/linux/mmc/sdio_func.h b/backport/backport-include/linux/mmc/sdio_func.h
index 2d3e92b6..0a67f992 100644
--- a/backport/backport-include/linux/mmc/sdio_func.h
+++ b/backport/backport-include/linux/mmc/sdio_func.h
@@ -7,4 +7,80 @@
#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
#endif
+#if LINUX_VERSION_IS_LESS(5,2,0) && \
+ !LINUX_VERSION_IN_RANGE(5,1,15, 5,2,0) && \
+ !LINUX_VERSION_IN_RANGE(4,19,56, 4,20,0)
+
+#include <linux/mmc/card.h>
+#include <linux/mmc/host.h>
+
+/**
+ * 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.
+ */
+#define sdio_retune_hold_now LINUX_BACKPORT(sdio_retune_hold_now)
+#if LINUX_VERSION_IS_LESS(4,3,0)
+static inline void sdio_retune_hold_now(struct sdio_func *func)
+{
+}
+#else
+static inline void sdio_retune_hold_now(struct sdio_func *func)
+{
+ struct mmc_host *host = func->card->host;
+
+ host->retune_now = 0;
+ host->hold_retune += 1;
+}
+#endif /* < 4.3 */
+
+/**
+ * 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.
+ */
+#define sdio_retune_release LINUX_BACKPORT(sdio_retune_release)
+#if LINUX_VERSION_IS_LESS(4,3,0)
+static inline void sdio_retune_release(struct sdio_func *func)
+{
+}
+#else
+static inline void sdio_retune_release(struct sdio_func *func)
+{
+ struct mmc_host *host = func->card->host;
+
+ if (host->hold_retune)
+ host->hold_retune -= 1;
+ else
+ WARN_ON(1);
+}
+#endif
+
+#define sdio_retune_crc_disable LINUX_BACKPORT(sdio_retune_crc_disable)
+static inline void sdio_retune_crc_disable(struct sdio_func *func)
+{
+}
+#define sdio_retune_crc_enable LINUX_BACKPORT(sdio_retune_crc_enable)
+static inline void sdio_retune_crc_enable(struct sdio_func *func)
+{
+}
+#endif /* < 5.2 */
+
#endif /* __BACKPORT_MMC_SDIO_FUNC_H */
--
2.20.1
--
To unsubscribe from this list: send the line "unsubscribe backports" in
next prev parent reply other threads:[~2019-07-01 21:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
2019-07-01 21:48 ` [PATCH 01/18] patches: update select queue patches Hauke Mehrtens
2019-07-01 21:48 ` [PATCH 02/18] backport: rcupdate: add rcu_head_init and rcu_head_after_call_rcu Hauke Mehrtens
2019-07-01 21:48 ` [PATCH 03/18] backport: check for failure when allocating ops in genetlink Hauke Mehrtens
2019-07-01 21:48 ` [PATCH 04/18] backport-include: add empty lockdep_map structure in lockdep.h Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 05/18] patches: Make patches apply on top of kernel 5.2-rc6 Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 06/18] backport: Extend netlink parsing with strict validation Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 07/18] header: Add backport-include/net/ipv6_stubs.h Hauke Mehrtens
2019-07-01 21:49 ` Hauke Mehrtens [this message]
2019-07-01 21:49 ` [PATCH 09/18] header: Add HRTIMER_MODE_{ABS,REL}_SOFT Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 10/18] patch: Remove usage of DMI_PRODUCT_SKU Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 11/18] header: Make napi_complete_done() return bool Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 12/18] header: add hrtimer_forward() and ns_to_ktime() Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 13/18] dependencies: Add MT7615E dependency Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 14/18] patches: rtw88: Add missing include on kernel 3.18 Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 14/18] " Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 15/18] header: Remove include/net/inet_frag.h Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 16/18] defconfig: update wifi defconfig Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 17/18] header: fix of_get_mac_address() Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 18/18] header: add support for GCC7 and GCC8 Hauke Mehrtens
2019-07-02 7:44 ` Johannes Berg
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=20190701214914.8066-9-hauke@hauke-m.de \
--to=hauke@hauke-m.de \
--cc=backports@vger.kernel.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).