From patchwork Tue Jan 19 14:11:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike McCormack X-Patchwork-Id: 43190 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 896BEB7CA1 for ; Wed, 20 Jan 2010 01:15:56 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751947Ab0ASOPu (ORCPT ); Tue, 19 Jan 2010 09:15:50 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751775Ab0ASOPu (ORCPT ); Tue, 19 Jan 2010 09:15:50 -0500 Received: from mail-pw0-f42.google.com ([209.85.160.42]:46341 "EHLO mail-pw0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750943Ab0ASOPt (ORCPT ); Tue, 19 Jan 2010 09:15:49 -0500 Received: by pwj9 with SMTP id 9so2407186pwj.21 for ; Tue, 19 Jan 2010 06:15:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:content-type :content-transfer-encoding; bh=aGmxwnMtWltcyQBblo+jOx40nGvli48WIq8SvzXwMI0=; b=BvBer34LxDTIA2shuv5wFF5ouYE8wiG5hl9Mqh1m8+qyd8u7JMTxr0PVmOy0gMjRKg /Np/DzDhJfPG3G17qD9JyNMLuRUTIhSbyWaa5owqwPjEYoWFA/zayuXdpWQT1dx1kBqr AdwyEwn2RV/J+rqqalG7pYZIn28VdRyfkC5d0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=dpIEyjlSZ20Rs3/dkubNQAoCcpohhMCGn7z1WMKndZDg2DgONAKgW4d3yltB5LYPpa +/SCWx095m4SuVTjdLnh02O/UYDmtL3mCbYBVB+nUBvEHD44jUHoI+LlDBXC7z3zFaRE hN5SQDPH+wCWka23az2vkbNTyPNTHrnbCfgUY= Received: by 10.143.26.42 with SMTP id d42mr5188591wfj.219.1263910548281; Tue, 19 Jan 2010 06:15:48 -0800 (PST) Received: from ?192.168.0.100? ([121.168.21.96]) by mx.google.com with ESMTPS id 22sm5177756pzk.14.2010.01.19.06.15.45 (version=SSLv3 cipher=RC4-MD5); Tue, 19 Jan 2010 06:15:46 -0800 (PST) Message-ID: <4B55BD8E.2040705@ring3k.org> Date: Tue, 19 Jan 2010 23:11:26 +0900 From: Mike McCormack User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) MIME-Version: 1.0 To: Stephen Hemminger CC: netdev@vger.kernel.org Subject: [PATCH] sky2: Enable/disable WOL per hardware device Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Y2_HW_WOL_ON/Y2_HW_WOL_OFF should be set and cleared per chip, not per port. On dual port cards, Y2_HW_WOL_ON should be enabled if either sky2 port has WOL enabled. Found while reviewing code for a WOL regression, though this is probably not the cause of the regression. Signed-off-by: Mike McCormack --- drivers/net/sky2.c | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 4c06020..d86b7e8 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -3238,6 +3238,27 @@ static inline u8 sky2_wol_supported(const struct sky2_hw *hw) return sky2_is_copper(hw) ? (WAKE_PHY | WAKE_MAGIC) : 0; } +static void sky2_hw_set_wol(struct sky2_hw *hw) +{ + int wol = 0; + int i; + + for (i = 0; i < hw->ports; i++) { + struct net_device *dev = hw->dev[i]; + struct sky2_port *sky2 = netdev_priv(dev); + + if (sky2->wol) + wol = 1; + } + + if (hw->chip_id == CHIP_ID_YUKON_EC_U || + hw->chip_id == CHIP_ID_YUKON_EX || + hw->chip_id == CHIP_ID_YUKON_FE_P) + sky2_write32(hw, B0_CTST, wol ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF); + + device_set_wakeup_enable(&hw->pdev->dev, wol); +} + static void sky2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) { const struct sky2_port *sky2 = netdev_priv(dev); @@ -3257,13 +3278,7 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) sky2->wol = wol->wolopts; - if (hw->chip_id == CHIP_ID_YUKON_EC_U || - hw->chip_id == CHIP_ID_YUKON_EX || - hw->chip_id == CHIP_ID_YUKON_FE_P) - sky2_write32(hw, B0_CTST, sky2->wol - ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF); - - device_set_wakeup_enable(&hw->pdev->dev, sky2->wol); + sky2_hw_set_wol(hw); if (!netif_running(dev)) sky2_wol_init(sky2);