RE: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-23 Thread Reizer, Eyal
> 
> Here's a modified version of your patch, does that put wlcore to
> idle with wowlan during suspend for you?
> 

Still no joy.
It suspends/resumes ok but leaves the firmware disabled from entering ELP.
You can see the log below with some prints added to wlcore_runtime_suspend()
And wlcore_runtime_resume().
What you can see is that normally after each transaction, such as scan below,
It ends where the firmware is allowed to enter ELP based on its internal logic.
You can see the print "chip allowed to entered elp" below.

root@am335x-evm:~#
root@am335x-evm:~#
root@am335x-evm:~# iw wlan0 scan | grep SSID
[  106.010879] disabling the FW from enering ELP
[  106.026780] wlcore_runtime_suspend -> enter
[  106.01] allowing chip to entered elp
 [  106.037823] chip allowed to entered elp
...
...
 [  110.110140] disabling the FW from enering ELP
[  110.224902] wlcore_runtime_suspend -> enter
[  110.229208] allowing chip to entered elp
SSID: IOTLP_521
SSID: Reizer
SSID: LinksysADSL
SSID: RT2880_AP
SSID: net4guest
[  110.252460] chip allowed to entered elp
SSID: halekoa75
SSID: externalhotspot84
SSID: cpn84
SSID: WPS_AP_5G
SSID: MarvellAP95
[  110.266707] disabling the FW from enering ELP
[  110.279297] wlcore_runtime_suspend -> enter
SSID:
SSID:
[  110.292041] allowing chip to entered elp
SSID: net4guest
[  110.303485] chip allowed to entered elp
SSID: halekoa75
SSID: externalhotspot84
SSID: cpn84
SSID: net4guest
SSID: halekoa75
SSID: externalhotspot84
SSID: cpn84
root@am335x-evm:~#
root@am335x-evm:~#
root@am335x-evm:~#

This is not the case when suspending.
You can see below that the message " PM: Successfully put all powerdomains to 
target state"
Comes before the call to pm_runtime_suspend() was executed and the firmware
Remained in full active state consuming full power during the whole time the 
system was 
suspended.
The call to pm_runtime_suspend is only seen on resume:

[  124.153960] Restarting tasks ... 
[  124.154702] wlcore_runtime_suspend -> enter

I have also verified that this is not just a print issue by using a firmware 
logger that 
Shows the internal state of the firmware and can see that the call to allow ELP
Actually comes only after resume.
This is what I am trying to chase now. Something is not right here with 
pm_runtime.
Any ideas here?

root@am335x-evm:~#
root@am335x-evm:~# echo mem > /sys/power/state
[  123.72] PM: suspend entry (deep)
[  123.448119] PM: Syncing filesystems ... done.
[  123.467382] Freezing user space processes ... (elapsed 0.002 seconds) done.
[  123.477144] OOM killer disabled.
[  123.480424] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) 
done.
[  123.489880] Suspending console(s) (use no_console_suspend to debug)
[  123.505821] disabling the FW from enering ELP
[  123.861590] pm33xx pm33xx: PM: Successfully put all powerdomains to target 
state
[  123.861590] PM: Wakeup source UART
[  123.886091] net eth0: initializing cpsw version 1.12 (0)
[  123.984353] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver [SMSC 
LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)
[  124.150623] OOM killer enabled.
[  124.153960] Restarting tasks ...
[  124.154702] wlcore_runtime_suspend -> enter
[  124.171414] done.
[  124.190085] allowing chip to entered elp
[  124.199877] chip allowed to entered elp
[  124.208633] PM: suspend exit
root@am335x-evm:~#

Best Regards,
Eyal


Re: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-22 Thread Tony Lindgren
* Tony Lindgren  [180522 15:03]:
> * Reizer, Eyal  [180522 14:07]:
> > > > >
> > > > > OK try replacing the pm_runtime_put_noidle() above with just
> > > > > pm_runtime_put_sync(). The reason why I put noidle there was the
> > > > > wlcore_fw_sleep() call, with that gone put_sync should do the trick.
> > > > >
> > > >
> > > > I have tried that already. Same problem. The last call to:
> > > > ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP)
> > > >
> > > > which allows the firmware to get into ELP state during wowlan suspend is
> > > > only completing after system resume for some unknown reason...
> > > 
> > > Hmm maybe try also adding wl1271_power_off(wl) after put_sync()?
> > > 
> > 
> > No, we don't want to power off the chip in wowlan mode.
> > We power it of only during standard suspend.
> > 
> > The trick is that it stays on during suspend and can be used 
> > As a wakeup source to the host on specific packets received by
> > The firmware over the air.
> 
> Oh right, then in theory pm_runtime_put_sync() should do the
> here.

OK got my beaglebone green wireless to wake from suspend to UART
after doing:

# echo N > /sys/module/printk/parameters/console_suspend

No idea why that is needed.. Not needed on beaglebone black here.

Here's a modified version of your patch, does that put wlcore to
idle with wowlan during suspend for you?

Regards,

Tony

8< --
diff --git a/drivers/net/wireless/ti/wlcore/main.c 
b/drivers/net/wireless/ti/wlcore/main.c
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -998,24 +998,6 @@ static int wlcore_fw_wakeup(struct wl1271 *wl)
return wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_WAKE_UP);
 }
 
-static int wlcore_fw_sleep(struct wl1271 *wl)
-{
-   int ret;
-
-   mutex_lock(&wl->mutex);
-   ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP);
-   if (ret < 0) {
-   wl12xx_queue_recovery_work(wl);
-   goto out;
-   }
-   set_bit(WL1271_FLAG_IN_ELP, &wl->flags);
-out:
-   mutex_unlock(&wl->mutex);
-   mdelay(WL1271_SUSPEND_SLEEP);
-
-   return 0;
-}
-
 static int wl1271_setup(struct wl1271 *wl)
 {
wl->raw_fw_status = kzalloc(wl->fw_status_len, GFP_KERNEL);
@@ -1738,6 +1720,7 @@ static int __maybe_unused wl1271_op_suspend(struct 
ieee80211_hw *hw,
 {
struct wl1271 *wl = hw->priv;
struct wl12xx_vif *wlvif;
+   unsigned long flags;
int ret;
 
wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow);
@@ -1785,7 +1768,6 @@ static int __maybe_unused wl1271_op_suspend(struct 
ieee80211_hw *hw,
goto out_sleep;
 
 out_sleep:
-   pm_runtime_put_noidle(wl->dev);
mutex_unlock(&wl->mutex);
 
if (ret < 0) {
@@ -1795,20 +1777,6 @@ static int __maybe_unused wl1271_op_suspend(struct 
ieee80211_hw *hw,
 
/* flush any remaining work */
wl1271_debug(DEBUG_MAC80211, "flushing remaining works");
-
-   /*
-* disable and re-enable interrupts in order to flush
-* the threaded_irq
-*/
-   wlcore_disable_interrupts(wl);
-
-   /*
-* set suspended flag to avoid triggering a new threaded_irq
-* work. no need for spinlock as interrupts are disabled.
-*/
-   set_bit(WL1271_FLAG_SUSPENDED, &wl->flags);
-
-   wlcore_enable_interrupts(wl);
flush_work(&wl->tx_work);
 
/*
@@ -1817,14 +1785,16 @@ static int __maybe_unused wl1271_op_suspend(struct 
ieee80211_hw *hw,
 */
cancel_delayed_work(&wl->tx_watchdog_work);
 
+
/*
-* Use an immediate call for allowing the firmware to go into power
-* save during suspend.
-* Using a workque for this last write was only hapenning on resume
-* leaving the firmware with power save disabled during suspend,
-* while consuming full power during wowlan suspend.
+* set suspended flag to avoid triggering a new threaded_irq
+* work.
 */
-   wlcore_fw_sleep(wl);
+   spin_lock_irqsave(&wl->wl_lock, flags);
+   set_bit(WL1271_FLAG_SUSPENDED, &wl->flags);
+   spin_unlock_irqrestore(&wl->wl_lock, flags);
+
+   pm_runtime_put_sync(wl->dev);
 
return 0;
 }
-- 
2.17.0


Re: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-22 Thread Tony Lindgren
* Reizer, Eyal  [180522 14:07]:
> > > >
> > > > OK try replacing the pm_runtime_put_noidle() above with just
> > > > pm_runtime_put_sync(). The reason why I put noidle there was the
> > > > wlcore_fw_sleep() call, with that gone put_sync should do the trick.
> > > >
> > >
> > > I have tried that already. Same problem. The last call to:
> > > ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP)
> > >
> > > which allows the firmware to get into ELP state during wowlan suspend is
> > > only completing after system resume for some unknown reason...
> > 
> > Hmm maybe try also adding wl1271_power_off(wl) after put_sync()?
> > 
> 
> No, we don't want to power off the chip in wowlan mode.
> We power it of only during standard suspend.
> 
> The trick is that it stays on during suspend and can be used 
> As a wakeup source to the host on specific packets received by
> The firmware over the air.

Oh right, then in theory pm_runtime_put_sync() should do the
here.

Regards,

Tony


RE: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-22 Thread Reizer, Eyal
> > >
> > > OK try replacing the pm_runtime_put_noidle() above with just
> > > pm_runtime_put_sync(). The reason why I put noidle there was the
> > > wlcore_fw_sleep() call, with that gone put_sync should do the trick.
> > >
> >
> > I have tried that already. Same problem. The last call to:
> > ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP)
> >
> > which allows the firmware to get into ELP state during wowlan suspend is
> > only completing after system resume for some unknown reason...
> 
> Hmm maybe try also adding wl1271_power_off(wl) after put_sync()?
> 

No, we don't want to power off the chip in wowlan mode.
We power it of only during standard suspend.

The trick is that it stays on during suspend and can be used 
As a wakeup source to the host on specific packets received by
The firmware over the air.

BR,
Eyal


Re: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-22 Thread Tony Lindgren
* Reizer, Eyal  [180522 13:50]:
> > 
> > OK try replacing the pm_runtime_put_noidle() above with just
> > pm_runtime_put_sync(). The reason why I put noidle there was the
> > wlcore_fw_sleep() call, with that gone put_sync should do the trick.
> > 
> 
> I have tried that already. Same problem. The last call to:
> ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP)
> 
> which allows the firmware to get into ELP state during wowlan suspend is 
> only completing after system resume for some unknown reason...

Hmm maybe try also adding wl1271_power_off(wl) after put_sync()?

Regards,

Tony


Re: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-22 Thread Tony Lindgren
* Reizer, Eyal  [180522 06:42]:
> It still crash.
> The crash is different now.
> It also complains about:
> [   60.544224] Unbalanced enable for IRQ 65
> Need down/up of the interface to recover after it.

Oh OK so no need for this patch and interrupts are already
enabled at that point. Sounds like you found the real reason
with the patch you posted.

Regards,

Tony


RE: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-22 Thread Reizer, Eyal
> 
> * Reizer, Eyal  [180522 13:28]:
> > Actually the below patch removing the call to wlcore_fw_sleep() avoids this
> error.
> > The downside is that the wl8 firmware remains fully active during supend, so
> we
> > Would need to find the root cause why the last call allowing the wilink8
> firmware
> > To go into ELP mode during suspend is only completing on resume and not
> during
> > Suspend enter.
> >
> > diff --git a/drivers/net/wireless/ti/wlcore/main.c
> > b/drivers/net/wireless/ti/wlcore/main.c
> > index 4c297aa..8df1ae6 100644
> > --- a/drivers/net/wireless/ti/wlcore/main.c
> > +++ b/drivers/net/wireless/ti/wlcore/main.c
> > @@ -1789,7 +1789,6 @@ static int wl1271_op_suspend(struct
> ieee80211_hw *hw,
> > goto out_sleep;
> >
> >  out_sleep:
> > -   pm_runtime_put_noidle(wl->dev);
> > mutex_unlock(&wl->mutex);
> >
> > if (ret < 0) {
> > @@ -1821,15 +1820,7 @@ static int wl1271_op_suspend(struct
> ieee80211_hw *hw,
> >  */
> > cancel_delayed_work(&wl->tx_watchdog_work);
> >
> > -   /*
> > -* Use an immediate call for allowing the firmware to go into power
> > -* save during suspend.
> > -* Using a workque for this last write was only hapenning on resume
> > -* leaving the firmware with power save disabled during suspend,
> > -* while consuming full power during wowlan suspend.
> > -*/
> > -   wlcore_fw_sleep(wl);
> > -
> > +   pm_runtime_put_noidle(wl->dev);
> > return 0;
> >  }
> 
> OK try replacing the pm_runtime_put_noidle() above with just
> pm_runtime_put_sync(). The reason why I put noidle there was the
> wlcore_fw_sleep() call, with that gone put_sync should do the trick.
> 

I have tried that already. Same problem. The last call to:
ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP)

which allows the firmware to get into ELP state during wowlan suspend is 
only completing after system resume for some unknown reason...

Best Regards,
Eyal


Re: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-22 Thread Tony Lindgren
* Kalle Valo  [180522 08:05]:
> Tony Lindgren  writes:
> 
> > * Reizer, Eyal  [180521 07:31]:
> >> > Here's a series of patches to add runtime PM support for wlcore. It does 
> >> > not
> >> > yet implement autosuspend support, but let's get this tested first as the
> >> > autosuspend can mask enable/disable issues easily.
> >> 
> >> Testing on BBB+WL1837 cape, scan, recovery, down/up and basic traffic 
> >> seems ok now.
> >> Of course we need to test some more.
> >
> > Thanks for testing. Yes let's do more testing, no rush with these.
> > Hopefully they'll be ready for v4.19 merge window though.
> 
> So I can drop the patchset now and you will resend once it's ready?

Yes thanks I will send at least one more version of this series.

Regards,

Tony



Re: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-22 Thread Tony Lindgren
* Reizer, Eyal  [180522 13:28]:
> Actually the below patch removing the call to wlcore_fw_sleep() avoids this 
> error.
> The downside is that the wl8 firmware remains fully active during supend, so 
> we
> Would need to find the root cause why the last call allowing the wilink8 
> firmware 
> To go into ELP mode during suspend is only completing on resume and not during
> Suspend enter.
> 
> diff --git a/drivers/net/wireless/ti/wlcore/main.c
> b/drivers/net/wireless/ti/wlcore/main.c
> index 4c297aa..8df1ae6 100644
> --- a/drivers/net/wireless/ti/wlcore/main.c
> +++ b/drivers/net/wireless/ti/wlcore/main.c
> @@ -1789,7 +1789,6 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
> goto out_sleep;
> 
>  out_sleep:
> -   pm_runtime_put_noidle(wl->dev);
> mutex_unlock(&wl->mutex);
> 
> if (ret < 0) {
> @@ -1821,15 +1820,7 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
>  */
> cancel_delayed_work(&wl->tx_watchdog_work);
> 
> -   /*
> -* Use an immediate call for allowing the firmware to go into power
> -* save during suspend.
> -* Using a workque for this last write was only hapenning on resume
> -* leaving the firmware with power save disabled during suspend,
> -* while consuming full power during wowlan suspend.
> -*/
> -   wlcore_fw_sleep(wl);
> -
> +   pm_runtime_put_noidle(wl->dev);
> return 0;
>  }

OK try replacing the pm_runtime_put_noidle() above with just
pm_runtime_put_sync(). The reason why I put noidle there was the
wlcore_fw_sleep() call, with that gone put_sync should do the trick.

Regards,

Tony


RE: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-22 Thread Reizer, Eyal
> >
> > 8< 
> > diff --git a/drivers/net/wireless/ti/wlcore/main.c
> > b/drivers/net/wireless/ti/wlcore/main.c
> > --- a/drivers/net/wireless/ti/wlcore/main.c
> > +++ b/drivers/net/wireless/ti/wlcore/main.c
> > @@ -1867,8 +1867,6 @@ static int __maybe_unused
> > wl1271_op_resume(struct ieee80211_hw *hw)
> > if (ret)
> > wl12xx_queue_recovery_work(wl);
> > }
> > -
> > -   wlcore_enable_interrupts(wl);
> > }
> >
> > if (pending_recovery) {
> > @@ -1877,6 +1875,8 @@ static int __maybe_unused
> > wl1271_op_resume(struct ieee80211_hw *hw)
> > goto out_sleep;
> > }
> >
> > +   wlcore_enable_interrupts(wl);
> > +
> > ret = pm_runtime_get_sync(wl->dev);
> > if (ret < 0) {
> > pm_runtime_put_noidle(wl->dev);
> 
> It still crash.
> The crash is different now.
> It also complains about:
> [   60.544224] Unbalanced enable for IRQ 65
> Need down/up of the interface to recover after it.
> Log below:
> 

Actually the below patch removing the call to wlcore_fw_sleep() avoids this 
error.
The downside is that the wl8 firmware remains fully active during supend, so we
Would need to find the root cause why the last call allowing the wilink8 
firmware 
To go into ELP mode during suspend is only completing on resume and not during
Suspend enter.

diff --git a/drivers/net/wireless/ti/wlcore/main.c
b/drivers/net/wireless/ti/wlcore/main.c
index 4c297aa..8df1ae6 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -1789,7 +1789,6 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
goto out_sleep;

 out_sleep:
-   pm_runtime_put_noidle(wl->dev);
mutex_unlock(&wl->mutex);

if (ret < 0) {
@@ -1821,15 +1820,7 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
 */
cancel_delayed_work(&wl->tx_watchdog_work);

-   /*
-* Use an immediate call for allowing the firmware to go into power
-* save during suspend.
-* Using a workque for this last write was only hapenning on resume
-* leaving the firmware with power save disabled during suspend,
-* while consuming full power during wowlan suspend.
-*/
-   wlcore_fw_sleep(wl);
-
+   pm_runtime_put_noidle(wl->dev);
return 0;
 }

With this wowlan seems to work ok and suspend/resume is not crashing when 
enabling wowlan. See below:

root@am335x-evm:/usr/share/wl18xx#
root@am335x-evm:/usr/share/wl18xx#
root@am335x-evm:/usr/share/wl18xx#
root@am335x-evm:/usr/share/wl18xx# iw phy0 wowlan enable any
root@am335x-evm:/usr/share/wl18xx#
root@am335x-evm:/usr/share/wl18xx# echo mem > /sys/power/state
[   63.794805] PM: suspend entry (deep)
[   63.798455] PM: Syncing filesystems ... done.
[   65.779673] Freezing user space processes ... (elapsed 0.001 seconds) done.
[   65.788878] OOM killer disabled.
[   65.792117] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) 
done.
[   65.801196] Suspending console(s) (use no_console_suspend to debug)
[   65.952459] pm33xx pm33xx: PM: Successfully put all powerdomains to target 
state
[   65.952459] PM: Wakeup source GPIO0
[   65.977028] net eth0: initializing cpsw version 1.12 (0)
[   66.074419] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver [SMSC 
LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)
[   66.236312] OOM killer enabled.
[   66.239604] Restarting tasks ... done.
[   66.282501] PM: suspend exit
root@am335x-evm:/usr/share/wl18xx#

BR,
Eyal



Re: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-22 Thread Kalle Valo
Tony Lindgren  writes:

> * Reizer, Eyal  [180521 07:31]:
>> > Here's a series of patches to add runtime PM support for wlcore. It does 
>> > not
>> > yet implement autosuspend support, but let's get this tested first as the
>> > autosuspend can mask enable/disable issues easily.
>> 
>> Testing on BBB+WL1837 cape, scan, recovery, down/up and basic traffic seems 
>> ok now.
>> Of course we need to test some more.
>
> Thanks for testing. Yes let's do more testing, no rush with these.
> Hopefully they'll be ready for v4.19 merge window though.

So I can drop the patchset now and you will resend once it's ready?

-- 
Kalle Valo


RE: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-21 Thread Reizer, Eyal
> >
> > This warning is because wlcore is wlcore is still in ELP. This is
> > somehow possible even though we call pm_runtime_get_sync() in
> > wl1271_op_resume(). Anyways, I'll try to reproduce it here.
> 
> Sorry I can't somehow get my beagleboard to wake-up from suspend,
> I'm almost certain that worked the last time I tried.
> 
> Anyways, maybe the following patch fixes this if you care to
> test again.
> 
> Regards,
> 
> Tony
> 
> 8< 
> diff --git a/drivers/net/wireless/ti/wlcore/main.c
> b/drivers/net/wireless/ti/wlcore/main.c
> --- a/drivers/net/wireless/ti/wlcore/main.c
> +++ b/drivers/net/wireless/ti/wlcore/main.c
> @@ -1867,8 +1867,6 @@ static int __maybe_unused
> wl1271_op_resume(struct ieee80211_hw *hw)
>   if (ret)
>   wl12xx_queue_recovery_work(wl);
>   }
> -
> - wlcore_enable_interrupts(wl);
>   }
> 
>   if (pending_recovery) {
> @@ -1877,6 +1875,8 @@ static int __maybe_unused
> wl1271_op_resume(struct ieee80211_hw *hw)
>   goto out_sleep;
>   }
> 
> + wlcore_enable_interrupts(wl);
> +
>   ret = pm_runtime_get_sync(wl->dev);
>   if (ret < 0) {
>   pm_runtime_put_noidle(wl->dev);

It still crash.
The crash is different now.
It also complains about:
[   60.544224] Unbalanced enable for IRQ 65
Need down/up of the interface to recover after it.
Log below:

root@am335x-evm:~#
root@am335x-evm:~#
root@am335x-evm:~# echo mem > /sys/power/state
[   42.994534] PM: suspend entry (deep)
[   42.998182] PM: Syncing filesystems ... done.
[   43.946134] Freezing user space processes ... (elapsed 0.002 seconds) done.
[   43.957020] OOM killer disabled.
[   43.960449] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) 
done.
[   43.971227] Suspending console(s) (use no_console_suspend to debug)
[   44.093784] wlcore: down
[   44.181597] pm33xx pm33xx: PM: Successfully put all powerdomains to target 
state
[   44.181597] PM: Wakeup source UART
[   44.206334] net eth0: initializing cpsw version 1.12 (0)
[   44.304417] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver [SMSC 
LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)
[   44.650784] wlcore: PHY firmware version: Rev 8.2.0.0.242
[   44.746182] wlcore: firmware booted (Rev 8.9.0.0.78)
[   44.929226] OOM killer enabled.
[   44.932602] Restarting tasks ... done.
[   44.961136] PM: suspend exit
root@am335x-evm:~# iw phy0 wowlan enable any
root@am335x-evm:~#
root@am335x-evm:~#
root@am335x-evm:~#
root@am335x-evm:~#
root@am335x-evm:~# echo mem > /sys/power/state
[   60.114495] PM: suspend entry (deep)
[   60.118146] PM: Syncing filesystems ... done.
[   60.139243] Freezing user space processes ... (elapsed 0.001 seconds) done.
[   60.148483] OOM killer disabled.
[   60.151723] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) 
done.
[   60.160874] Suspending console(s) (use no_console_suspend to debug)
[   60.411089] pm33xx pm33xx: PM: Successfully put all powerdomains to target 
state
[   60.411089] PM: Wakeup source UART
[   60.435069] net eth0: initializing cpsw version 1.12 (0)
[   60.534303] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver [SMSC 
LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)
[   60.544143] [ cut here ]
[   60.544213] WARNING: CPU: 0 PID: 730 at kernel/irq/manage.c:525 
__enable_irq+0x4c/0x6c
[   60.544224] Unbalanced enable for IRQ 65
[   60.544232] Modules linked in: usb_f_acm u_serial arc4 pru_rproc pruss_intc 
wl18xx usb_f_ecm wlcore musb_dsps mac80211 musb_hdrc cfg80211 pruss phy_am335x 
usbcore phy_generic phy_am335x_control xfrm_user xfrm4_tunnel ipcomp 
xfrm_ipcomp esp4 ah4 af_key xfrm_algo g_multi usb_f_mass_storage usb_f_rndis 
u_ether libcomposite udc_core usb_common bluetooth ecdh_generic 
snd_soc_simple_card snd_soc_simple_card_utils wkup_m3_rproc pm33xx wkup_m3_ipc 
remoteproc omap_aes_driver crypto_engine omap_crypto omap_sham ti_emif_sram 
pruss_soc_bus wlcore_sdio rtc_omap musb_am335x omap_wdt sch_fq_codel
[   60.544574] CPU: 0 PID: 730 Comm: kworker/u2:11 Not tainted 
4.14.40-01413-g36a61bea-dirty #105
[   60.544584] Hardware name: Generic AM33XX (Flattened Device Tree)
[   60.544624] Workqueue: events_unbound async_run_entry_fn
[   60.544639] Backtrace:
[   60.544698] [] (dump_backtrace) from [] 
(show_stack+0x18/0x1c)
[   60.544722]  r6: r5:c0a95d64 r4:db363d78 r3:c0d53158
[   60.544758] [] (show_stack) from [] 
(dump_stack+0x20/0x28)
[   60.544794] [] (dump_stack) from [] (__warn+0xdc/0x104)
[   60.544821] [] (__warn) from [] 
(warn_slowpath_fmt+0x40/0x48)
[   60.544848]  r10:c0d5310c r8: r7:db5a6d38 r6: r5:0041 
r4:
[   60.544874] [] (warn_slowpath_fmt) from [] 
(__enable_irq+0x4c/0x6c)
[   60.544889]  r3:0041 r2:c0a95ec4
[   60.544898]  r4:db278000
[   60.544922] [] (__enable_irq) from [] 
(enable_irq+0x3c/0x74)
[   60.545265] [] (enable_irq) f

Re: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-21 Thread Tony Lindgren
* Tony Lindgren  [180521 16:40]:
> * Reizer, Eyal  [180521 07:31]:
> > > Here's a series of patches to add runtime PM support for wlcore. It does 
> > > not
> > > yet implement autosuspend support, but let's get this tested first as the
> > > autosuspend can mask enable/disable issues easily.
> > 
> > Testing on BBB+WL1837 cape, scan, recovery, down/up and basic traffic seems 
> > ok now.
> > Of course we need to test some more.
> 
> Thanks for testing. Yes let's do more testing, no rush with these.
> Hopefully they'll be ready for v4.19 merge window though.
> 
> > Standard suspend/resume seems to work ok as well.
> > Ennabling wowlan and suspending is  crashing on resume. See below.
> > 
> > root@am335x-evm:/usr/share/wl18xx# iw phy0 wowlan enable any dme
> > root@am335x-evm:/usr/share/wl18xx#
> > root@am335x-evm:/usr/share/wl18xx# echo mem > /sys/power/state
> > [  541.567039] PM: suspend entry (deep)
> > [  541.570688] PM: Syncing filesystems ... done.
> > [  541.594277] Freezing user space processes ... (elapsed 0.001 seconds) 
> > done.
> > [  541.603160] OOM killer disabled.
> > [  541.606738] Freezing remaining freezable tasks ... (elapsed 0.001 
> > seconds) done.
> > [  541.615984] Suspending console(s) (use no_console_suspend to debug)
> > [  542.895091] pm33xx pm33xx: PM: Successfully put all powerdomains to 
> > target state
> > [  542.895091] PM: Wakeup source UART
> > [  542.919791] net eth0: initializing cpsw version 1.12 (0)
> > [  543.017880] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver 
> > [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)
> > [  543.027646] [ cut here ]
> > [  543.028023] WARNING: CPU: 0 PID: 932 at 
> > drivers/net/wireless/ti/wlcore/cmd.c:76 
> > wlcore_cmd_send_failsafe+0x498/0x4f8 [wlcore]
> 
> This warning is because wlcore is wlcore is still in ELP. This is
> somehow possible even though we call pm_runtime_get_sync() in
> wl1271_op_resume(). Anyways, I'll try to reproduce it here.

Sorry I can't somehow get my beagleboard to wake-up from suspend,
I'm almost certain that worked the last time I tried.

Anyways, maybe the following patch fixes this if you care to
test again.

Regards,

Tony

8< 
diff --git a/drivers/net/wireless/ti/wlcore/main.c 
b/drivers/net/wireless/ti/wlcore/main.c
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -1867,8 +1867,6 @@ static int __maybe_unused wl1271_op_resume(struct 
ieee80211_hw *hw)
if (ret)
wl12xx_queue_recovery_work(wl);
}
-
-   wlcore_enable_interrupts(wl);
}
 
if (pending_recovery) {
@@ -1877,6 +1875,8 @@ static int __maybe_unused wl1271_op_resume(struct 
ieee80211_hw *hw)
goto out_sleep;
}
 
+   wlcore_enable_interrupts(wl);
+
ret = pm_runtime_get_sync(wl->dev);
if (ret < 0) {
pm_runtime_put_noidle(wl->dev);


Re: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-21 Thread Tony Lindgren
* Reizer, Eyal  [180521 07:31]:
> > Here's a series of patches to add runtime PM support for wlcore. It does not
> > yet implement autosuspend support, but let's get this tested first as the
> > autosuspend can mask enable/disable issues easily.
> 
> Testing on BBB+WL1837 cape, scan, recovery, down/up and basic traffic seems 
> ok now.
> Of course we need to test some more.

Thanks for testing. Yes let's do more testing, no rush with these.
Hopefully they'll be ready for v4.19 merge window though.

> Standard suspend/resume seems to work ok as well.
> Ennabling wowlan and suspending is  crashing on resume. See below.
> 
> root@am335x-evm:/usr/share/wl18xx# iw phy0 wowlan enable any dme
> root@am335x-evm:/usr/share/wl18xx#
> root@am335x-evm:/usr/share/wl18xx# echo mem > /sys/power/state
> [  541.567039] PM: suspend entry (deep)
> [  541.570688] PM: Syncing filesystems ... done.
> [  541.594277] Freezing user space processes ... (elapsed 0.001 seconds) done.
> [  541.603160] OOM killer disabled.
> [  541.606738] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) 
> done.
> [  541.615984] Suspending console(s) (use no_console_suspend to debug)
> [  542.895091] pm33xx pm33xx: PM: Successfully put all powerdomains to target 
> state
> [  542.895091] PM: Wakeup source UART
> [  542.919791] net eth0: initializing cpsw version 1.12 (0)
> [  543.017880] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver 
> [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)
> [  543.027646] [ cut here ]
> [  543.028023] WARNING: CPU: 0 PID: 932 at 
> drivers/net/wireless/ti/wlcore/cmd.c:76 wlcore_cmd_send_failsafe+0x498/0x4f8 
> [wlcore]

This warning is because wlcore is wlcore is still in ELP. This is
somehow possible even though we call pm_runtime_get_sync() in
wl1271_op_resume(). Anyways, I'll try to reproduce it here.

Regards,

Tony



RE: [EXTERNAL] [PATCHv2 0/5] Runtime PM support for wlcore

2018-05-21 Thread Reizer, Eyal
Hi Tony,

> 
> Hi all,
> 
> Here's a series of patches to add runtime PM support for wlcore. It does not
> yet implement autosuspend support, but let's get this tested first as the
> autosuspend can mask enable/disable issues easily.
> 
> Regards,
> 
> Tony
> 
> Changes since v1:
> 
> - Fix issues reported by Eyal for recovery
> 

Testing on BBB+WL1837 cape, scan, recovery, down/up and basic traffic seems ok 
now.
Of course we need to test some more.
Standard suspend/resume seems to work ok as well.
Ennabling wowlan and suspending is  crashing on resume. See below.

root@am335x-evm:/usr/share/wl18xx# iw phy0 wowlan enable any 
root@am335x-evm:/usr/share/wl18xx#
root@am335x-evm:/usr/share/wl18xx# echo mem > /sys/power/state
[  541.567039] PM: suspend entry (deep)
[  541.570688] PM: Syncing filesystems ... done.
[  541.594277] Freezing user space processes ... (elapsed 0.001 seconds) done.
[  541.603160] OOM killer disabled.
[  541.606738] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) 
done.
[  541.615984] Suspending console(s) (use no_console_suspend to debug)
[  542.895091] pm33xx pm33xx: PM: Successfully put all powerdomains to target 
state
[  542.895091] PM: Wakeup source UART
[  542.919791] net eth0: initializing cpsw version 1.12 (0)
[  543.017880] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver [SMSC 
LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)
[  543.027646] [ cut here ]
[  543.028023] WARNING: CPU: 0 PID: 932 at 
drivers/net/wireless/ti/wlcore/cmd.c:76 wlcore_cmd_send_failsafe+0x498/0x4f8 
[wlcore]
[  543.028033] Modules linked in: ctr aes_arm_bs crypto_simd cryptd ccm arc4 
pru_rproc pruss_intc wl18xx usb_f_acm u_serial wlcore mac80211 cfg80211 pruss 
usb_f_ecm musb_dsps musb_hdrc usbcore phy_am335x phy_generic phy_am335x_control 
xfrm_user xfrm4_tunnel ipcomp xfrm_ipcomp esp4 ah4 af_key xfrm_algo g_multi 
usb_f_mass_storage usb_f_rndis u_ether libcomposite udc_core usb_common 
bluetooth ecdh_generic snd_soc_simple_card snd_soc_simple_card_utils pm33xx 
wkup_m3_ipc wkup_m3_rproc remoteproc omap_aes_driver crypto_engine omap_crypto 
omap_sham ti_emif_sram pruss_soc_bus wlcore_sdio rtc_omap musb_am335x omap_wdt 
sch_fq_codel
[  543.028408] CPU: 0 PID: 932 Comm: kworker/u2:9 Not tainted 
4.14.40-01413-g36a61bea-dirty #104
[  543.028418] Hardware name: Generic AM33XX (Flattened Device Tree)
[  543.028466] Workqueue: events_unbound async_run_entry_fn
[  543.028480] Backtrace:
[  543.028541] [] (dump_backtrace) from [] 
(show_stack+0x18/0x1c)
[  543.028565]  r6: r5:bf3a759c r4: r3:c0d53158
[  543.028602] [] (show_stack) from [] 
(dump_stack+0x20/0x28)
[  543.028637] [] (dump_stack) from [] (__warn+0xdc/0x104)
[  543.028665] [] (__warn) from [] 
(warn_slowpath_null+0x28/0x30)
[  543.028691]  r10:c0d5310c r8: r7: r6:d6be5080 r5:000c 
r4:db59ed00
[  543.028896] [] (warn_slowpath_null) from [] 
(wlcore_cmd_send_failsafe+0x498/0x4f8 [wlcore])
[  543.029232] [] (wlcore_cmd_send_failsafe [wlcore]) from 
[] (wlcore_cmd_configure_failsafe+0x60/0xd8 [wlcore])
[  543.029259]  r10:c0d5310c r9:db59e258 r8: r7: r6:0024 
r5:db59ed00
[  543.029269]  r4:d6be5080
[  543.029597] [] (wlcore_cmd_configure_failsafe [wlcore]) from 
[] (wl1271_cmd_configure+0x1c/0x28 [wlcore])
[  543.029614]  r6:db59ed00 r5:0001 r4:d6be5080
[  543.029943] [] (wl1271_cmd_configure [wlcore]) from [] 
(wl1271_acx_default_rx_filter_enable+0x60/0xac [wlcore])
[  543.030272] [] (wl1271_acx_default_rx_filter_enable [wlcore]) from 
[] (wl1271_configure_wowlan+0x148/0x3c4 [wlcore])
[  543.030292]  r7:db59ed38 r6:db59ee20 r5: r4:dc705bc8
[  543.030616] [] (wl1271_configure_wowlan [wlcore]) from 
[] (wl1271_op_resume+0x310/0x344 [wlcore])
[  543.030643]  r10:c0d5310c r9:db59e258 r8: r7:db59ed38 r6:db59ee20 
r5:db59ed00
[  543.030652]  r4:dc705bc8
[  543.031484] [] (wl1271_op_resume [wlcore]) from [] 
(ieee80211_reconfig+0x418/0xc0c [mac80211])
[  543.031509]  r8: r7:db59e28c r6:bf2c75e8 r5: r4:db59e420
[  543.032290] [] (ieee80211_reconfig [mac80211]) from [] 
(ieee80211_resume+0x58/0x70 [mac80211])
[  543.032318]  r10:c0d5310c r9:db59e258 r8: r7:db59e28c r6:bf2c75e8 
r5:
[  543.032327]  r4:db59e420
[  543.033150] [] (ieee80211_resume [mac80211]) from [] 
(wiphy_resume+0x54/0x64 [cfg80211])
[  543.033165]  r4:db59e258 r3:bf32fd44
[  543.033448] [] (wiphy_resume [cfg80211]) from [] 
(dpm_run_callback+0x40/0xcc)
[  543.033462]  r4: r3:
[  543.033489] [] (dpm_run_callback) from [] 
(device_resume+0xbc/0x234)
[  543.033515]  r10: r9:dc005000 r8: r6:0010 r5:0001 
r4:db59e258
[  543.033542] [] (device_resume) from [] 
(async_resume+0x20/0x4c)
[  543.033567]  r8: r7:dc004100 r6:c0d4fde0 r5:c0d89b30 r4:db59e258 
r3:
[  543.033600] [] (async_resume) from [] 
(async_run_entry_fn+0x44/0x140)
[  543.033614]  r5:d6be5480 r4:d6be5490
[