* [PATCH V2 0/2] sdio: Prevent re-tuning conflicting with custom sleep
@ 2016-12-08 9:56 Adrian Hunter
2016-12-08 9:56 ` [PATCH V2 1/2] mmc: core: Add functions for SDIO to hold re-tuning Adrian Hunter
2016-12-08 9:56 ` [PATCH V2 2/2] brcmfmac: Prevent re-tuning conflicting with 'wake-up' Adrian Hunter
0 siblings, 2 replies; 3+ messages in thread
From: Adrian Hunter @ 2016-12-08 9:56 UTC (permalink / raw
To: Ulf Hansson; +Cc: linux-mmc, Arend van Spriel
Hi
Here are 2 patches that allow brcmfmac to awake from a
custom sleep state that conflicts with re-tuning.
The first patch adds sdio_retune_hold_now() and
sdio_retune_release(). They are used in the 2nd patch
to prevent re-tuning for the 'wake-up' command.
These patches were last posted here:
https://marc.info/?l=linux-mmc&m=143023247221784
Changes in V2:
brcmfmac: Prevent re-tuning conflicting with 'wake-up'
Apply to file moved from:
drivers/net/wireless/brcm80211/brcmfmac/sdio.c
to:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
Adrian Hunter (2):
mmc: core: Add functions for SDIO to hold re-tuning
brcmfmac: Prevent re-tuning conflicting with 'wake-up'
drivers/mmc/core/host.c | 6 ++++++
drivers/mmc/core/host.h | 1 +
drivers/mmc/core/sdio_io.c | 13 +++++++++++++
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 6 ++++++
include/linux/mmc/sdio_func.h | 3 +++
5 files changed, 29 insertions(+)
Regards
Adrian
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH V2 1/2] mmc: core: Add functions for SDIO to hold re-tuning
2016-12-08 9:56 [PATCH V2 0/2] sdio: Prevent re-tuning conflicting with custom sleep Adrian Hunter
@ 2016-12-08 9:56 ` Adrian Hunter
2016-12-08 9:56 ` [PATCH V2 2/2] brcmfmac: Prevent re-tuning conflicting with 'wake-up' Adrian Hunter
1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2016-12-08 9:56 UTC (permalink / raw
To: Ulf Hansson; +Cc: linux-mmc, Arend van Spriel
Add sdio_retune_hold_now() and sdio_retune_release()
in order to allow SDIO function drivers to prevent
re-tuning in cases where it conflicts with the
device state.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/core/host.c | 6 ++++++
drivers/mmc/core/host.h | 1 +
drivers/mmc/core/sdio_io.c | 13 +++++++++++++
include/linux/mmc/sdio_func.h | 3 +++
4 files changed, 23 insertions(+)
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 98f25ffb4258..6c0f33c70b4a 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -113,6 +113,12 @@ void mmc_retune_hold(struct mmc_host *host)
host->hold_retune += 1;
}
+void mmc_retune_hold_now(struct mmc_host *host)
+{
+ host->retune_now = 0;
+ host->hold_retune += 1;
+}
+
void mmc_retune_release(struct mmc_host *host)
{
if (host->hold_retune)
diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h
index 992bf5397633..5e9a1293091b 100644
--- a/drivers/mmc/core/host.h
+++ b/drivers/mmc/core/host.h
@@ -18,6 +18,7 @@
void mmc_retune_enable(struct mmc_host *host);
void mmc_retune_disable(struct mmc_host *host);
void mmc_retune_hold(struct mmc_host *host);
+void mmc_retune_hold_now(struct mmc_host *host);
void mmc_retune_release(struct mmc_host *host);
int mmc_retune(struct mmc_host *host);
diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
index 406e5f037e32..a840d8c76a24 100644
--- a/drivers/mmc/core/sdio_io.c
+++ b/drivers/mmc/core/sdio_io.c
@@ -15,6 +15,7 @@
#include <linux/mmc/sdio.h>
#include <linux/mmc/sdio_func.h>
+#include "host.h"
#include "sdio_ops.h"
/**
@@ -735,3 +736,15 @@ int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags)
return 0;
}
EXPORT_SYMBOL_GPL(sdio_set_host_pm_flags);
+
+void sdio_retune_hold_now(struct sdio_func *func)
+{
+ mmc_retune_hold_now(func->card->host);
+}
+EXPORT_SYMBOL_GPL(sdio_retune_hold_now);
+
+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 aab032a6ae61..50d667b76a08 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -159,4 +159,7 @@ extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b,
extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func);
extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags);
+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 */
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH V2 2/2] brcmfmac: Prevent re-tuning conflicting with 'wake-up'
2016-12-08 9:56 [PATCH V2 0/2] sdio: Prevent re-tuning conflicting with custom sleep Adrian Hunter
2016-12-08 9:56 ` [PATCH V2 1/2] mmc: core: Add functions for SDIO to hold re-tuning Adrian Hunter
@ 2016-12-08 9:56 ` Adrian Hunter
1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2016-12-08 9:56 UTC (permalink / raw
To: Ulf Hansson; +Cc: linux-mmc, Arend van Spriel
If the device is in a custom sleep state, then re-tuning
will fail. Add calls to sdio_retune_hold_now() and
sdio_retune_release() to prevent re-tuning before the
wake-up command. In the case re-tuning was needed, the
wake-up command might return an error, but the wake-up
is expected still to have happened, and the error is
anyway ignored.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index b892dac70f4b..a69abbb0923a 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -684,11 +684,17 @@ static int w_sdreg32(struct brcmf_sdio *bus, u32 regval, u32 reg_offset)
brcmf_dbg(TRACE, "Enter: on=%d\n", on);
wr_val = (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT);
+
+ /* Cannot re-tune if device is asleep */
+ if (on)
+ sdio_retune_hold_now(bus->sdiodev->func[1]);
+
/* 1st KSO write goes to AOS wake up core if device is asleep */
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
wr_val, &err);
if (on) {
+ sdio_retune_release(bus->sdiodev->func[1]);
/* device WAKEUP through KSO:
* write bit 0 & read back until
* both bits 0 (kso bit) & 1 (dev on status) are set
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-12-08 10:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-08 9:56 [PATCH V2 0/2] sdio: Prevent re-tuning conflicting with custom sleep Adrian Hunter
2016-12-08 9:56 ` [PATCH V2 1/2] mmc: core: Add functions for SDIO to hold re-tuning Adrian Hunter
2016-12-08 9:56 ` [PATCH V2 2/2] brcmfmac: Prevent re-tuning conflicting with 'wake-up' Adrian Hunter
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.