aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ucc_geth_ethtool.c
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2009-08-27 03:35:57 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-31 00:51:47 -0400
commit2394905f67aeec5f9452f2881cbeb2b42009de0e (patch)
tree799de0b229027408b0f894cb9f50e36f4707f3d7 /drivers/net/ucc_geth_ethtool.c
parentbf5aec2e79418adb42f1457152b427fd3d6316d9 (diff)
ucc_geth: Implement suspend/resume and Wake-On-LAN support
This patch implements suspend/resume and WOL support for UCC Ethernet driver. We support two wake up events: wake on PHY/link changes and wake on magic packet. In some CPUs (like MPC8569) QE shuts down during sleep, so magic packet detection is unusable, and also on resume we should fully reinitialize UCC structures. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ucc_geth_ethtool.c')
-rw-r--r--drivers/net/ucc_geth_ethtool.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index 304128fa6058..7075f26e97da 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -359,6 +359,44 @@ uec_get_drvinfo(struct net_device *netdev,
359 drvinfo->regdump_len = uec_get_regs_len(netdev); 359 drvinfo->regdump_len = uec_get_regs_len(netdev);
360} 360}
361 361
362#ifdef CONFIG_PM
363
364static void uec_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
365{
366 struct ucc_geth_private *ugeth = netdev_priv(netdev);
367 struct phy_device *phydev = ugeth->phydev;
368
369 if (phydev && phydev->irq)
370 wol->supported |= WAKE_PHY;
371 if (qe_alive_during_sleep())
372 wol->supported |= WAKE_MAGIC;
373
374 wol->wolopts = ugeth->wol_en;
375}
376
377static int uec_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
378{
379 struct ucc_geth_private *ugeth = netdev_priv(netdev);
380 struct phy_device *phydev = ugeth->phydev;
381
382 if (wol->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
383 return -EINVAL;
384 else if (wol->wolopts & WAKE_PHY && (!phydev || !phydev->irq))
385 return -EINVAL;
386 else if (wol->wolopts & WAKE_MAGIC && !qe_alive_during_sleep())
387 return -EINVAL;
388
389 ugeth->wol_en = wol->wolopts;
390 device_set_wakeup_enable(&netdev->dev, ugeth->wol_en);
391
392 return 0;
393}
394
395#else
396#define uec_get_wol NULL
397#define uec_set_wol NULL
398#endif /* CONFIG_PM */
399
362static const struct ethtool_ops uec_ethtool_ops = { 400static const struct ethtool_ops uec_ethtool_ops = {
363 .get_settings = uec_get_settings, 401 .get_settings = uec_get_settings,
364 .set_settings = uec_set_settings, 402 .set_settings = uec_set_settings,
@@ -377,6 +415,8 @@ static const struct ethtool_ops uec_ethtool_ops = {
377 .get_sset_count = uec_get_sset_count, 415 .get_sset_count = uec_get_sset_count,
378 .get_strings = uec_get_strings, 416 .get_strings = uec_get_strings,
379 .get_ethtool_stats = uec_get_ethtool_stats, 417 .get_ethtool_stats = uec_get_ethtool_stats,
418 .get_wol = uec_get_wol,
419 .set_wol = uec_set_wol,
380}; 420};
381 421
382void uec_set_ethtool_ops(struct net_device *netdev) 422void uec_set_ethtool_ops(struct net_device *netdev)