From d901c7b2f3adf229fcff35e3f1c7b5a66bd1e0f1 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 11 Mar 2013 13:56:44 +0000 Subject: [PATCH] --- yaml --- r: 368233 b: refs/heads/master c: 42e836eb4527fb635cb799a701fe4c9fe741c03a h: refs/heads/master i: 368231: b3767f809af94387e067c980e95df299ef5d0d45 v: v3 --- [refs] | 2 +- trunk/drivers/net/phy/phy.c | 16 ++++++++++++++++ trunk/include/linux/phy.h | 10 ++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index a33d4868ad17..937c3de79946 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9b717a8d245075ffb8e95a2dfb4ee97ce4747457 +refs/heads/master: 42e836eb4527fb635cb799a701fe4c9fe741c03a diff --git a/trunk/drivers/net/phy/phy.c b/trunk/drivers/net/phy/phy.c index ef9ea9248223..298b4c201733 100644 --- a/trunk/drivers/net/phy/phy.c +++ b/trunk/drivers/net/phy/phy.c @@ -1188,3 +1188,19 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data) return 0; } EXPORT_SYMBOL(phy_ethtool_set_eee); + +int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) +{ + if (phydev->drv->set_wol) + return phydev->drv->set_wol(phydev, wol); + + return -EOPNOTSUPP; +} +EXPORT_SYMBOL(phy_ethtool_set_wol); + +void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) +{ + if (phydev->drv->get_wol) + phydev->drv->get_wol(phydev, wol); +} +EXPORT_SYMBOL(phy_ethtool_get_wol); diff --git a/trunk/include/linux/phy.h b/trunk/include/linux/phy.h index 33999adbf8c8..9e11039dd7a3 100644 --- a/trunk/include/linux/phy.h +++ b/trunk/include/linux/phy.h @@ -455,6 +455,14 @@ struct phy_driver { */ void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type); + /* Some devices (e.g. qnap TS-119P II) require PHY register changes to + * enable Wake on LAN, so set_wol is provided to be called in the + * ethernet driver's set_wol function. */ + int (*set_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); + + /* See set_wol, but for checking whether Wake on LAN is enabled. */ + void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); + struct device_driver driver; }; #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); int phy_get_eee_err(struct phy_device *phydev); int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data); int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data); +int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol); +void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol); int __init mdio_bus_init(void); void mdio_bus_exit(void);