]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
phy: add set_wol/get_wol functions
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 11 Mar 2013 13:56:44 +0000 (13:56 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Mar 2013 15:40:53 +0000 (11:40 -0400)
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>
drivers/net/phy/phy.c
include/linux/phy.h

index ef9ea924822349217f536ad41d124a791aecd2fb..298b4c201733cb5c0e43490d3cc9b6363d39f534 100644 (file)
@@ -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);
index 33999adbf8c85e91f16651c5d2dfd64ff2b58439..9e11039dd7a3b89c40a19d10ebb3c382aed5dd7e 100644 (file)
@@ -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);