sdio: Prevent re-tuning conflicting with custom sleep
Subsystems (2)
cover sdio: Prevent re-tuning conflicting with custom sleep
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.
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/brcm80211/brcmfmac/sdio.c | 6 ++++++ include/linux/mmc/sdio_func.h | 3 +++ 5 files changed, 29 insertions(+)
Regards
Adrian
PATCH 1/2 mmc: core: Add functions for SDIO to hold re-tuning
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.
--- 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(+)
drivers/mmc/core/host.c +6 -0
@@ -330,6 +330,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)
drivers/mmc/core/host.h +1 -0
@@ -18,6 +18,7 @@ void mmc_unregister_host_class(void);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);
drivers/mmc/core/sdio_io.c +13 -0
@@ -15,6 +15,7 @@#include <linux/mmc/sdio.h> #include <linux/mmc/sdio_func.h> +#include "host.h" #include "sdio_ops.h" /**
@@ -720,3 +721,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);
include/linux/mmc/sdio_func.h +3 -0
@@ -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 */
Signature · 1 line
1.9.1
PATCH 2/2 brcmfmac: Prevent re-tuning conflicting with 'wake-up'
In reply to Adrian HunterIf 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.
--- drivers/net/wireless/brcm80211/brcmfmac/sdio.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/brcm80211/brcmfmac/sdio.c +6 -0
@@ -773,11 +773,17 @@ brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on)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
Signature · 1 line
1.9.1
Quoted 12 lines · Adrian Hunter
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()andsdio_retune_release(). They are used in the 2nd patch to prevent re-tuning for the 'wake-up' command.Adrian Hunter (2):
mmc: core: Add functions for SDIO to hold re-tuning
brcmfmac: Prevent re-tuning conflicting with 'wake-up'
Quoted 6 lines
drivers/mmc/core/host.c | 6 ++++++ drivers/mmc/core/host.h | 1 + drivers/mmc/core/sdio_io.c | 13 +++++++++++++ drivers/net/wireless/brcm80211/brcmfmac/sdio.c | 6 ++++++ include/linux/mmc/sdio_func.h | 3 +++ 5 files changed, 29 insertions(+)
Hi
These patches still apply and are still needed.
Can they be applied?
Regards
Adrian
Quoted 20 lines · Adrian Hunter
Quoted 12 lines · Adrian Hunter
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()andsdio_retune_release(). They are used in the 2nd patch to prevent re-tuning for the 'wake-up' command.Adrian Hunter (2):
mmc: core: Add functions for SDIO to hold re-tuning
brcmfmac: Prevent re-tuning conflicting with 'wake-up'Quoted 6 lines
drivers/mmc/core/host.c | 6 ++++++ drivers/mmc/core/host.h | 1 + drivers/mmc/core/sdio_io.c | 13 +++++++++++++ drivers/net/wireless/brcm80211/brcmfmac/sdio.c | 6 ++++++ include/linux/mmc/sdio_func.h | 3 +++ 5 files changed, 29 insertions(+)
Quoted 5 lines
Hi
These patches still apply and are still needed.
Can they be applied?
I need to have yet another round of thinking about this, I will get back to as soon as I can.
Kind regards
Uffe
Quoted 21 lines · Ulf Hansson
Quoted 20 lines · Adrian Hunter
Quoted 18 lines · Adrian Hunter
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()andsdio_retune_release(). They are used in the 2nd patch to prevent re-tuning for the 'wake-up' command.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/brcm80211/brcmfmac/sdio.c | 6 ++++++ include/linux/mmc/sdio_func.h | 3 +++ 5 files changed, 29 insertions(+)
Quoted 8 lines
Quoted 5 lines
Hi
These patches still apply and are still needed.
Can they be applied?I need to have yet another round of thinking about this, I will get back to as soon as I can.
I see drivers/net/wireless/brcm80211/brcmfmac/sdio.c has moved but otherwise these still apply. Any chance to look at this?