linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] sdio: Prevent re-tuning conflicting with custom sleep
@ 2015-04-28 14:45 Adrian Hunter
  2015-04-28 14:45 ` [PATCH 1/2] mmc: core: Add functions for SDIO to hold re-tuning Adrian Hunter
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Adrian Hunter @ 2015-04-28 14:45 UTC (permalink / raw)
  To: Ulf Hansson, Arend van Spriel; +Cc: linux-mmc

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] mmc: core: Add functions for SDIO to hold re-tuning
  2015-04-28 14:45 [PATCH 0/2] sdio: Prevent re-tuning conflicting with custom sleep Adrian Hunter
@ 2015-04-28 14:45 ` Adrian Hunter
  2015-04-28 14:45 ` [PATCH 2/2] brcmfmac: Prevent re-tuning conflicting with 'wake-up' Adrian Hunter
  2015-11-26 12:58 ` [PATCH 0/2] sdio: Prevent re-tuning conflicting with custom sleep Adrian Hunter
  2 siblings, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2015-04-28 14:45 UTC (permalink / raw)
  To: Ulf Hansson, Arend van Spriel; +Cc: linux-mmc

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 86c495b..63479fa 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -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)
diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h
index 992bf53..5e9a129 100644
--- a/drivers/mmc/core/host.h
+++ b/drivers/mmc/core/host.h
@@ -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);
 
diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
index 78cb4d5..01bce0c 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"
 
 /**
@@ -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);
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index aab032a..50d667b 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] 6+ messages in thread

* [PATCH 2/2] brcmfmac: Prevent re-tuning conflicting with 'wake-up'
  2015-04-28 14:45 [PATCH 0/2] sdio: Prevent re-tuning conflicting with custom sleep Adrian Hunter
  2015-04-28 14:45 ` [PATCH 1/2] mmc: core: Add functions for SDIO to hold re-tuning Adrian Hunter
@ 2015-04-28 14:45 ` Adrian Hunter
  2015-11-26 12:58 ` [PATCH 0/2] sdio: Prevent re-tuning conflicting with custom sleep Adrian Hunter
  2 siblings, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2015-04-28 14:45 UTC (permalink / raw)
  To: Ulf Hansson, Arend van Spriel; +Cc: linux-mmc

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/brcm80211/brcmfmac/sdio.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
index ab0c898..2ce81fb 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
@@ -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
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] sdio: Prevent re-tuning conflicting with custom sleep
  2015-04-28 14:45 [PATCH 0/2] sdio: Prevent re-tuning conflicting with custom sleep Adrian Hunter
  2015-04-28 14:45 ` [PATCH 1/2] mmc: core: Add functions for SDIO to hold re-tuning Adrian Hunter
  2015-04-28 14:45 ` [PATCH 2/2] brcmfmac: Prevent re-tuning conflicting with 'wake-up' Adrian Hunter
@ 2015-11-26 12:58 ` Adrian Hunter
  2015-11-27 14:06   ` Ulf Hansson
  2 siblings, 1 reply; 6+ messages in thread
From: Adrian Hunter @ 2015-11-26 12:58 UTC (permalink / raw)
  To: Ulf Hansson, Arend van Spriel; +Cc: linux-mmc

On 28/04/15 17:45, Adrian Hunter wrote:
> 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(+)

Hi

These patches still apply and are still needed.
Can they be applied?

Regards
Adrian


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] sdio: Prevent re-tuning conflicting with custom sleep
  2015-11-26 12:58 ` [PATCH 0/2] sdio: Prevent re-tuning conflicting with custom sleep Adrian Hunter
@ 2015-11-27 14:06   ` Ulf Hansson
  2016-01-19  9:51     ` Adrian Hunter
  0 siblings, 1 reply; 6+ messages in thread
From: Ulf Hansson @ 2015-11-27 14:06 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: Arend van Spriel, linux-mmc

On 26 November 2015 at 13:58, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 28/04/15 17:45, Adrian Hunter wrote:
>> 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(+)
>
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] sdio: Prevent re-tuning conflicting with custom sleep
  2015-11-27 14:06   ` Ulf Hansson
@ 2016-01-19  9:51     ` Adrian Hunter
  0 siblings, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2016-01-19  9:51 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arend van Spriel, linux-mmc

On 27/11/15 16:06, Ulf Hansson wrote:
> On 26 November 2015 at 13:58, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> On 28/04/15 17:45, Adrian Hunter wrote:
>>> 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(+)
>>
>> 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?


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-01-19  9:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-28 14:45 [PATCH 0/2] sdio: Prevent re-tuning conflicting with custom sleep Adrian Hunter
2015-04-28 14:45 ` [PATCH 1/2] mmc: core: Add functions for SDIO to hold re-tuning Adrian Hunter
2015-04-28 14:45 ` [PATCH 2/2] brcmfmac: Prevent re-tuning conflicting with 'wake-up' Adrian Hunter
2015-11-26 12:58 ` [PATCH 0/2] sdio: Prevent re-tuning conflicting with custom sleep Adrian Hunter
2015-11-27 14:06   ` Ulf Hansson
2016-01-19  9:51     ` Adrian Hunter

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).