* [PATCH 1/1] Workaround for Suspend/Resume issue of AX88772B under ChromeOS
@ 2013-11-20 2:11 freddy-knRN6Y/kmf1NUHwG+Fw1Kw
2013-11-20 5:40 ` David Miller
0 siblings, 1 reply; 9+ messages in thread
From: freddy-knRN6Y/kmf1NUHwG+Fw1Kw @ 2013-11-20 2:11 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
davemloft-fT/PcQaiUtIeIZ0/mPfg9Q, louis-knRN6Y/kmf1NUHwG+Fw1Kw,
allan-knRN6Y/kmf1NUHwG+Fw1Kw, grundler-hpIqsD4AKlfQT0dZR+AlfA,
daniel-knRN6Y/kmf1NUHwG+Fw1Kw, Freddy Xin
From: Freddy Xin <freddy-knRN6Y/kmf1NUHwG+Fw1Kw@public.gmane.org>
This patch adds a workaroud to solve Suspend/Resume issue that AX88772B turns
off its Ethernet PHY power in the case that REMOTE_WAKEUP feature doesn't
be set when system suspend. In this case, the PHY power will not be turned
on again when system resume, so the HW reset must be added in the resume function.
Signed-off-by: Freddy Xin <freddy-knRN6Y/kmf1NUHwG+Fw1Kw@public.gmane.org>
Tested-by: Grant Grundler <grundler-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
drivers/net/usb/asix.h | 1 +
drivers/net/usb/asix_devices.c | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/asix.h b/drivers/net/usb/asix.h
index bdaa12d..0e975aa 100644
--- a/drivers/net/usb/asix.h
+++ b/drivers/net/usb/asix.h
@@ -48,6 +48,7 @@
#define AX_CMD_SET_SW_MII 0x06
#define AX_CMD_READ_MII_REG 0x07
#define AX_CMD_WRITE_MII_REG 0x08
+#define AX_CMD_STATMNGSTS_REG 0x09
#define AX_CMD_SET_HW_MII 0x0a
#define AX_CMD_READ_EEPROM 0x0b
#define AX_CMD_WRITE_EEPROM 0x0c
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 386a3df..3ac9958 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -845,6 +845,20 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
return 0;
}
+static int asix_resume(struct usb_interface *intf)
+{
+ struct usbnet *dev = usb_get_intfdata(intf);
+ u8 chipcode = 0;
+
+ asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode);
+ chipcode &= 0x70;
+
+ if (dev->driver_info->reset && (chipcode == 0x20))
+ dev->driver_info->reset(dev);
+
+ return usbnet_resume(intf);
+}
+
static const struct driver_info ax8817x_info = {
.description = "ASIX AX8817x USB 2.0 Ethernet",
.bind = ax88172_bind,
@@ -1101,7 +1115,7 @@ static struct usb_driver asix_driver = {
.id_table = products,
.probe = usbnet_probe,
.suspend = usbnet_suspend,
- .resume = usbnet_resume,
+ .resume = asix_resume,
.disconnect = usbnet_disconnect,
.supports_autosuspend = 1,
.disable_hub_initiated_lpm = 1,
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 1/1] Workaround for Suspend/Resume issue of AX88772B under ChromeOS
2013-11-20 2:11 [PATCH 1/1] Workaround for Suspend/Resume issue of AX88772B under ChromeOS freddy-knRN6Y/kmf1NUHwG+Fw1Kw
@ 2013-11-20 5:40 ` David Miller
2013-11-20 17:42 ` Grant Grundler
0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2013-11-20 5:40 UTC (permalink / raw)
To: freddy
Cc: netdev, linux-usb, linux-kernel, davemloft, louis, allan,
grundler, daniel
From: freddy@asix.com.tw
Date: Wed, 20 Nov 2013 10:11:36 +0800
> From: Freddy Xin <freddy@asix.com.tw>
>
> This patch adds a workaroud to solve Suspend/Resume issue that AX88772B turns
> off its Ethernet PHY power in the case that REMOTE_WAKEUP feature doesn't
> be set when system suspend. In this case, the PHY power will not be turned
> on again when system resume, so the HW reset must be added in the resume function.
>
> Signed-off-by: Freddy Xin <freddy@asix.com.tw>
> Tested-by: Grant Grundler <grundler@chromium.org>
Like many similar patches I've seen recently, you cannot do this.
Now the the configuration that software things the PHY has is no
longer accurate.
If you absolutely must reset the chip on resume, you have to reprogram
the PHY with whatever settings were existed at the time of the suspend.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] Workaround for Suspend/Resume issue of AX88772B under ChromeOS
2013-11-20 5:40 ` David Miller
@ 2013-11-20 17:42 ` Grant Grundler
2013-11-20 18:54 ` David Miller
0 siblings, 1 reply; 9+ messages in thread
From: Grant Grundler @ 2013-11-20 17:42 UTC (permalink / raw)
To: David Miller
Cc: Freddy Xin, netdev, linux-usb, LKML, davemloft,
ASIX Louis [蘇威陸], Allan Chou, Daniel_ASIX
On Tue, Nov 19, 2013 at 9:40 PM, David Miller <davem@davemloft.net> wrote:
> From: freddy@asix.com.tw
> Date: Wed, 20 Nov 2013 10:11:36 +0800
>
>> From: Freddy Xin <freddy@asix.com.tw>
>>
>> This patch adds a workaroud to solve Suspend/Resume issue that AX88772B turns
>> off its Ethernet PHY power in the case that REMOTE_WAKEUP feature doesn't
>> be set when system suspend. In this case, the PHY power will not be turned
>> on again when system resume, so the HW reset must be added in the resume function.
>>
>> Signed-off-by: Freddy Xin <freddy@asix.com.tw>
>> Tested-by: Grant Grundler <grundler@chromium.org>
>
> Like many similar patches I've seen recently, you cannot do this.
>
> Now the the configuration that software things the PHY has is no
> longer accurate.
Dave,
Sorry - I didn't think of that. I agree the phy settings should be
reprograming in the phy.
The kernel state of the phy is not accurate in any case since the phy
was powered off and left powered off.
While this patch raises a new issue, can you apply this patch anyway
since in most cases (default settings) it improves "the user
experience" for most users?
> If you absolutely must reset the chip on resume, you have to reprogram
> the PHY with whatever settings were existed at the time of the suspend.
AFAICT, the reset is required.
Since you've seen so many of these patches that do NOT reprogram the
phy on reset, would you consider a patch that added "reprogram phy" to
usbnet_resume() code path?
thanks!
grant
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] Workaround for Suspend/Resume issue of AX88772B under ChromeOS
2013-11-20 17:42 ` Grant Grundler
@ 2013-11-20 18:54 ` David Miller
2013-11-20 19:32 ` Grant Grundler
0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2013-11-20 18:54 UTC (permalink / raw)
To: grundler
Cc: freddy, netdev, linux-usb, linux-kernel, davemloft, louis, allan,
daniel
From: Grant Grundler <grundler@google.com>
Date: Wed, 20 Nov 2013 09:42:42 -0800
> While this patch raises a new issue, can you apply this patch anyway
> since in most cases (default settings) it improves "the user
> experience" for most users?
I'm not applying a patch which knowingly is not implemented correctly.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] Workaround for Suspend/Resume issue of AX88772B under ChromeOS
2013-11-20 18:54 ` David Miller
@ 2013-11-20 19:32 ` Grant Grundler
2013-11-21 22:48 ` Grant Grundler
0 siblings, 1 reply; 9+ messages in thread
From: Grant Grundler @ 2013-11-20 19:32 UTC (permalink / raw)
To: David Miller
Cc: Freddy Xin, netdev, linux-usb, LKML, davemloft,
ASIX Louis [蘇威陸], Allan Chou, Daniel_ASIX
On Wed, Nov 20, 2013 at 10:54 AM, David Miller <davem@davemloft.net> wrote:
> From: Grant Grundler <grundler@google.com>
> Date: Wed, 20 Nov 2013 09:42:42 -0800
>
>> While this patch raises a new issue, can you apply this patch anyway
>> since in most cases (default settings) it improves "the user
>> experience" for most users?
>
> I'm not applying a patch which knowingly is not implemented correctly.
Ok - fair enough. I'll figure out what needs to be done to
save/restore phy values.
Seems like this should be part of usbnet_resume code based on whether
the driver provides mdio_write hook (most USBNET drivers do).
thanks,
grant
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] Workaround for Suspend/Resume issue of AX88772B under ChromeOS
2013-11-20 19:32 ` Grant Grundler
@ 2013-11-21 22:48 ` Grant Grundler
2013-11-22 1:58 ` Florian Fainelli
0 siblings, 1 reply; 9+ messages in thread
From: Grant Grundler @ 2013-11-21 22:48 UTC (permalink / raw)
To: David Miller
Cc: Freddy Xin, netdev, linux-usb, LKML, davemloft,
ASIX Louis [蘇威陸], Allan Chou, Daniel_ASIX
On Wed, Nov 20, 2013 at 11:32 AM, Grant Grundler <grundler@google.com> wrote:
> Seems like this should be part of usbnet_resume code based on whether
> the driver provides mdio_write hook (most USBNET drivers do).
Just to be clear: I don't think this is feasible for the now obvious
reason that not all device lose phy stat on resume. :/
Freddy sent me a patch that saves/restores MII_ADVERTISE and MII_BMCR
registers. Testing that now and he'll post if that all works out.
thanks,
grant
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] Workaround for Suspend/Resume issue of AX88772B under ChromeOS
2013-11-21 22:48 ` Grant Grundler
@ 2013-11-22 1:58 ` Florian Fainelli
[not found] ` <CAGVrzcase25NosVHA74OLnviJj7nU_2Rxki_hvi8bOwznDuWGg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2013-11-22 1:58 UTC (permalink / raw)
To: Grant Grundler
Cc: David Miller, Freddy Xin, netdev, linux-usb, LKML, davemloft,
ASIX Louis [蘇威陸], Allan Chou, Daniel_ASIX
2013/11/21 Grant Grundler <grundler@google.com>:
> On Wed, Nov 20, 2013 at 11:32 AM, Grant Grundler <grundler@google.com> wrote:
>> Seems like this should be part of usbnet_resume code based on whether
>> the driver provides mdio_write hook (most USBNET drivers do).
>
> Just to be clear: I don't think this is feasible for the now obvious
> reason that not all device lose phy stat on resume. :/
>
> Freddy sent me a patch that saves/restores MII_ADVERTISE and MII_BMCR
> registers. Testing that now and he'll post if that all works out.
That should be enough to ensure the PHY is put back into a consistent
state. So long as you are suspending/resuming from a configuration
where autoneg was enabled, I would not expect anything bad to happen.
If the link was forced, that is a different story.
One way to make sure this work properly without driver-specific code
is to include that functionality into the PHY library. As far as I can
see it the asix drivers do not use it but implement the old-style
mii_bus interface so that would be a first step.
--
Florian
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-11-22 2:42 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20 2:11 [PATCH 1/1] Workaround for Suspend/Resume issue of AX88772B under ChromeOS freddy-knRN6Y/kmf1NUHwG+Fw1Kw
2013-11-20 5:40 ` David Miller
2013-11-20 17:42 ` Grant Grundler
2013-11-20 18:54 ` David Miller
2013-11-20 19:32 ` Grant Grundler
2013-11-21 22:48 ` Grant Grundler
2013-11-22 1:58 ` Florian Fainelli
[not found] ` <CAGVrzcase25NosVHA74OLnviJj7nU_2Rxki_hvi8bOwznDuWGg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-22 2:26 ` Grant Grundler
2013-11-22 2:42 ` Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox