linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: add suspend_halted module param
@ 2014-02-23 16:58 Sebastian Hesselbarth
  2014-02-24 18:20 ` Florian Fainelli
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Sebastian Hesselbarth @ 2014-02-23 16:58 UTC (permalink / raw)
  To: linux-arm-kernel

commit 1211ce53077164e0d34641d0ca5fb4d4a7574498
  ("net: phy: resume/suspend PHYs on attach/detach")
introduced a feature to suspend PHYs when entering halted state.

Unfortunately, not all bootloaders properly power-up PHYs on reset
and fail to access ethernet because the PHY is still powered down.

Therefore, we add a boolean module parameter suspend_halted with
default value of true. Disabling that parameter prevents PHYs from
being suspended when entering halted state.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Reported-by: Andrew Lunn <andrew@lunn.ch>
---
Andrew, can you please re-test if disabling the feature does work on
your board? I tried a bunch of mine, but none failed to power-up the
PHY in u-boot.

Cc: David Miller <davem@davemloft.net>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: netdev at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
---
 drivers/net/phy/phy_device.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 4b03e63639b7..671eea0eb5db 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -40,6 +40,10 @@ MODULE_DESCRIPTION("PHY library");
 MODULE_AUTHOR("Andy Fleming");
 MODULE_LICENSE("GPL");
 
+static bool suspend_halted = true;
+module_param(suspend_halted, bool, 0644);
+MODULE_PARM_DESC(suspend_halted, "Suspend PHYs when entering halted state.");
+
 void phy_device_free(struct phy_device *phydev)
 {
 	put_device(&phydev->dev);
@@ -685,6 +689,12 @@ int phy_suspend(struct phy_device *phydev)
 	struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver);
 	struct ethtool_wolinfo wol;
 
+	/* Some bootloaders do not power-up PHYs properly after reset,
+	 * allow to disable the suspend halted PHYs feature.
+	 */
+	if (!suspend_halted)
+		return -ENOSYS;
+
 	/* If the device has WOL enabled, we cannot suspend the PHY */
 	wol.cmd = ETHTOOL_GWOL;
 	phy_ethtool_get_wol(phydev, &wol);
-- 
1.8.5.3

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

end of thread, other threads:[~2014-03-10 16:56 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-23 16:58 [PATCH] net: phy: add suspend_halted module param Sebastian Hesselbarth
2014-02-24 18:20 ` Florian Fainelli
2014-02-24 23:05   ` David Miller
2014-02-24 23:34     ` Sebastian Hesselbarth
2014-02-24 19:15 ` Andrew Lunn
2014-02-24 19:37   ` Florian Fainelli
2014-02-24 19:39     ` Andrew Lunn
2014-02-25 22:38   ` Sebastian Hesselbarth
2014-02-26 18:21     ` Andrew Lunn
2014-02-26 18:30       ` Florian Fainelli
2014-02-26 19:10         ` Andrew Lunn
2014-02-26 19:35           ` Florian Fainelli
2014-02-26 20:22             ` Andrew Lunn
2014-03-07 11:34 ` [PATCH] net: phy: Add sysfs attribute to prevent PHY suspend Sebastian Hesselbarth
2014-03-08  1:09   ` Florian Fainelli
2014-03-09 23:12   ` David Miller
2014-03-09 23:25     ` Sebastian Hesselbarth
2014-03-10  0:30       ` David Miller
2014-03-10  0:37         ` Sebastian Hesselbarth
2014-03-10  0:41           ` David Miller
2014-03-10  0:53             ` Sebastian Hesselbarth
2014-03-10  3:40               ` David Miller
2014-03-10 10:28                 ` Sebastian Hesselbarth
2014-03-10 14:25               ` One Thousand Gnomes
2014-03-10 16:56                 ` Florian Fainelli

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