提交 2884e5cc 编写于 作者: A Anton Vorontsov 提交者: David S. Miller

gianfar: Implement proper, per netdevice wakeup management

This patch implements wakeup management for the gianfar driver.

The driver should set wakeup enable if WOL is enabled, so that
phylib won't power off an attached PHY.
Signed-off-by: NAnton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 09640e63
...@@ -463,6 +463,9 @@ static int gfar_probe(struct of_device *ofdev, ...@@ -463,6 +463,9 @@ static int gfar_probe(struct of_device *ofdev,
goto register_fail; goto register_fail;
} }
device_init_wakeup(&dev->dev,
priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
/* fill out IRQ number and name fields */ /* fill out IRQ number and name fields */
len_devname = strlen(dev->name); len_devname = strlen(dev->name);
strncpy(&priv->int_name_tx[0], dev->name, len_devname); strncpy(&priv->int_name_tx[0], dev->name, len_devname);
...@@ -1200,6 +1203,8 @@ static int gfar_enet_open(struct net_device *dev) ...@@ -1200,6 +1203,8 @@ static int gfar_enet_open(struct net_device *dev)
netif_start_queue(dev); netif_start_queue(dev);
device_set_wakeup_enable(&dev->dev, priv->wol_en);
return err; return err;
} }
......
...@@ -600,6 +600,7 @@ static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) ...@@ -600,6 +600,7 @@ static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
spin_lock_irqsave(&priv->bflock, flags); spin_lock_irqsave(&priv->bflock, flags);
priv->wol_en = wol->wolopts & WAKE_MAGIC ? 1 : 0; priv->wol_en = wol->wolopts & WAKE_MAGIC ? 1 : 0;
device_set_wakeup_enable(&dev->dev, priv->wol_en);
spin_unlock_irqrestore(&priv->bflock, flags); spin_unlock_irqrestore(&priv->bflock, flags);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册