aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2013-03-11 09:56:44 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-12 11:40:53 -0400
commit42e836eb4527fb635cb799a701fe4c9fe741c03a (patch)
tree45045b51aa37a09b3ba0f45e17e38e659473fbcb
parent9b717a8d245075ffb8e95a2dfb4ee97ce4747457 (diff)
phy: add set_wol/get_wol functions
This allows ethernet drivers (such as the mv643xx_eth) to support Wake on LAN on platforms where PHY registers have to be configured for Wake on LAN (e.g. the Marvell Kirkwood based qnap TS-119P II). Signed-off-by: Michael Stapelberg <michael@stapelberg.de> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/phy.c16
-rw-r--r--include/linux/phy.h10
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index ef9ea9248223..298b4c201733 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1188,3 +1188,19 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data)
1188 return 0; 1188 return 0;
1189} 1189}
1190EXPORT_SYMBOL(phy_ethtool_set_eee); 1190EXPORT_SYMBOL(phy_ethtool_set_eee);
1191
1192int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
1193{
1194 if (phydev->drv->set_wol)
1195 return phydev->drv->set_wol(phydev, wol);
1196
1197 return -EOPNOTSUPP;
1198}
1199EXPORT_SYMBOL(phy_ethtool_set_wol);
1200
1201void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
1202{
1203 if (phydev->drv->get_wol)
1204 phydev->drv->get_wol(phydev, wol);
1205}
1206EXPORT_SYMBOL(phy_ethtool_get_wol);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 33999adbf8c8..9e11039dd7a3 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -455,6 +455,14 @@ struct phy_driver {
455 */ 455 */
456 void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type); 456 void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type);
457 457
458 /* Some devices (e.g. qnap TS-119P II) require PHY register changes to
459 * enable Wake on LAN, so set_wol is provided to be called in the
460 * ethernet driver's set_wol function. */
461 int (*set_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol);
462
463 /* See set_wol, but for checking whether Wake on LAN is enabled. */
464 void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol);
465
458 struct device_driver driver; 466 struct device_driver driver;
459}; 467};
460#define to_phy_driver(d) container_of(d, struct phy_driver, driver) 468#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
@@ -560,6 +568,8 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable);
560int phy_get_eee_err(struct phy_device *phydev); 568int phy_get_eee_err(struct phy_device *phydev);
561int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data); 569int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data);
562int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data); 570int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data);
571int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol);
572void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol);
563 573
564int __init mdio_bus_init(void); 574int __init mdio_bus_init(void);
565void mdio_bus_exit(void); 575void mdio_bus_exit(void);