From patchwork Wed Jan 28 20:38:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 20695 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 6EBA2DE142 for ; Thu, 29 Jan 2009 07:39:32 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from buildserver.ru.mvista.com (unknown [85.21.88.6]) by ozlabs.org (Postfix) with ESMTP id 3EB26DDFAF for ; Thu, 29 Jan 2009 07:38:56 +1100 (EST) Received: from localhost (unknown [10.150.0.9]) by buildserver.ru.mvista.com (Postfix) with ESMTP id 52F04881F; Thu, 29 Jan 2009 01:38:57 +0400 (SAMT) Date: Wed, 28 Jan 2009 23:38:54 +0300 From: Anton Vorontsov To: Jeff Garzik Subject: [PATCH -next 1/2] gianfar: Implement proper, per netdevice wakeup management Message-ID: <20090128203854.GA14693@oksana.dev.rtsoft.ru> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Cc: linuxppc-dev@ozlabs.org, Giuseppe Cavallaro , Andy Fleming , David Miller , netdev@vger.kernel.org X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org 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: Anton Vorontsov --- drivers/net/gianfar.c | 5 +++++ drivers/net/gianfar_ethtool.c | 1 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 3f7eab4..3a8359e 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -463,6 +463,9 @@ static int gfar_probe(struct of_device *ofdev, goto register_fail; } + device_init_wakeup(&dev->dev, + priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET); + /* fill out IRQ number and name fields */ len_devname = strlen(dev->name); strncpy(&priv->int_name_tx[0], dev->name, len_devname); @@ -1200,6 +1203,8 @@ static int gfar_enet_open(struct net_device *dev) netif_start_queue(dev); + device_set_wakeup_enable(&dev->dev, priv->wol_en); + return err; } diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index 59b3b5d..dbf06e9 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c @@ -600,6 +600,7 @@ static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) spin_lock_irqsave(&priv->bflock, flags); priv->wol_en = wol->wolopts & WAKE_MAGIC ? 1 : 0; + device_set_wakeup_enable(&dev->dev, priv->wol_en); spin_unlock_irqrestore(&priv->bflock, flags); return 0;