From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752017AbbG3PPz (ORCPT ); Thu, 30 Jul 2015 11:15:55 -0400 Received: from skprod2.natinst.com ([130.164.80.23]:45015 "EHLO ni.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751753AbbG3PPw (ORCPT ); Thu, 30 Jul 2015 11:15:52 -0400 From: Nathan Sullivan To: f.fainelli@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nathan Sullivan Subject: [PATCH v2] net/phy: micrel: Reenable interrupts during resume Date: Thu, 30 Jul 2015 10:15:48 -0500 Message-Id: <1438269348-8725-1-git-send-email-nathan.sullivan@ni.com> X-Mailer: git-send-email 1.7.10.4 X-MIMETrack: Itemize by SMTP Server on US-AUS-MGWOut1/AUS/H/NIC(Release 8.5.3FP6 HF1218|December 12, 2014) at 07/30/2015 10:15:51 AM, Serialize by Router on US-AUS-MGWOut1/AUS/H/NIC(Release 8.5.3FP6 HF1218|December 12, 2014) at 07/30/2015 10:15:51 AM, Serialize complete at 07/30/2015 10:15:51 AM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2015-07-30_08:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ksz9031 has a behavior where it will clear the interrupt enable bits when leaving power down. To work around this, make sure the interrupt bits are in the state they are expected to be when resuming. Signed-off-by: Nathan Sullivan --- Changes for V2: Actually make sure it compiles this time. --- drivers/net/phy/micrel.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 499185e..9774582 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -447,6 +447,22 @@ static int ksz9031_center_flp_timing(struct phy_device *phydev) return genphy_restart_aneg(phydev); } +static int ksz9031_resume(struct phy_device *phydev) +{ + int result; + + result = genphy_resume(phydev); + + if (result) + return result; + + /* This phy will reset interrupt enables when leaving power down */ + if (PHY_INTERRUPT_ENABLED & phydev->interrupts) + result = kszphy_config_intr(phydev); + + return result; +} + static int ksz9031_config_init(struct phy_device *phydev) { const struct device *dev = &phydev->dev; @@ -776,7 +792,7 @@ static struct phy_driver ksphy_driver[] = { .ack_interrupt = kszphy_ack_interrupt, .config_intr = kszphy_config_intr, .suspend = genphy_suspend, - .resume = genphy_resume, + .resume = ksz9031_resume, .driver = { .owner = THIS_MODULE, }, }, { .phy_id = PHY_ID_KSZ8873MLL, -- 1.7.10.4