Received: by 10.192.165.148 with SMTP id m20csp1606310imm; Wed, 25 Apr 2018 22:42:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Q4fCNM12XADqPeaiqAGYAI+CdL76q7QTnThh1tpVVoBWBJ6EWPra8McAChR/Av1VVeZBq X-Received: by 10.99.107.8 with SMTP id g8mr26097335pgc.271.1524721335257; Wed, 25 Apr 2018 22:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524721335; cv=none; d=google.com; s=arc-20160816; b=AXGg4OQEFfcN66cb3jvn10zaC+ap9bOm4sJRyJpuaQVRPOXZzeZxlYjV/AfjMjnX+l tfeyJLxxpVCvGUeEPNRZoMKcYm3M4AQIm+jK8BXLfe1AJLifC4qPsLO6RBC6IpekSVvt 7lJa1sb4+9+pz7ZOz9fDWt7blvyFs6mWivEfoiq56zqcTTae5aYlma0lnzROXNmUOfj6 zv2woLkDXeDwPnLMx66Zp/HBv06y2DCteLxNUiyO1TCpTtcsNI05kw3VVNP79oJjtdIG 7Efbe2i8L5u09upPDMtRFKRZgHmHY7qj++R27mD2V8BYXU0jtmjCzsFvD7uAG7aTN+0p X0VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=mbFmJg/osXKkXwTaSK4VWaMpSADIDUdizbMysDhyoTc=; b=imGob9GZq82QxriUjHjlmhfiODGK9s2Mw+blQeW8diNWUTzwRUC0DLbM29nwuQ6WWx lOFPY++i4eIiReAd0A9b1N3bS6NOsyM18h+tlSwkC4IlXhuC2xGPhwRqJBSSoTDhYeBh R0sr4QhgAwmRegDwTCKzLvxJPkJPObxqHUUfXf5kL2YeyzCqchN6QIQETO+e3+WOzh1G T+fqMjgyl6FdFEEnw+BI0yRGeNP7urn/hkJ4e4AnWBibT9LQgR4PvY7UtoIU0xEl3nBc 3TL/WcStzOOGjkRMI10h8PEMI8JKimR7i6fGyQCsP14Gpkh2sCk4yjkV+cTXxn4nCnnK 2buw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h23si17033450pfn.287.2018.04.25.22.42.00; Wed, 25 Apr 2018 22:42:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752786AbeDZFkc (ORCPT + 99 others); Thu, 26 Apr 2018 01:40:32 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:14354 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbeDZFk1 (ORCPT ); Thu, 26 Apr 2018 01:40:27 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com id ; Wed, 25 Apr 2018 22:40:26 -0700 Received: from HQMAIL104.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Wed, 25 Apr 2018 22:40:25 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Wed, 25 Apr 2018 22:40:25 -0700 Received: from BGMAIL102.nvidia.com (10.25.59.11) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 26 Apr 2018 05:40:25 +0000 Received: from [10.24.193.56] (10.24.193.56) by bgmail102.nvidia.com (10.25.59.11) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 26 Apr 2018 05:40:22 +0000 Subject: Re: [PATCH] net: phy: marvell: clear wol event before setting it To: Andrew Lunn , Jisheng Zhang CC: Florian Fainelli , "David S. Miller" , , , Jingju Hou References: <20180419160232.519d15be@xhacker.debian> <20180419121801.GC17888@lunn.ch> From: Bhadram Varka Message-ID: <4273f766-a017-b336-7d14-a28901d274b9@nvidia.com> Date: Thu, 26 Apr 2018 11:10:21 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180419121801.GC17888@lunn.ch> X-Originating-IP: [10.24.193.56] X-ClientProxiedBy: BGMAIL103.nvidia.com (10.25.59.12) To bgmail102.nvidia.com (10.25.59.11) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 4/19/2018 5:48 PM, Andrew Lunn wrote: > On Thu, Apr 19, 2018 at 04:02:32PM +0800, Jisheng Zhang wrote: >> From: Jingju Hou >> >> If WOL event happened once, the LED[2] interrupt pin will not be >> cleared unless reading the CSISR register. So clear the WOL event >> before enabling it. >> >> Signed-off-by: Jingju Hou >> Signed-off-by: Jisheng Zhang >> --- >> drivers/net/phy/marvell.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c >> index c22e8e383247..b6abe1cbc84b 100644 >> --- a/drivers/net/phy/marvell.c >> +++ b/drivers/net/phy/marvell.c >> @@ -115,6 +115,9 @@ >> /* WOL Event Interrupt Enable */ >> #define MII_88E1318S_PHY_CSIER_WOL_EIE BIT(7) >> >> +/* Copper Specific Interrupt Status Register */ >> +#define MII_88E1318S_PHY_CSISR 0x13 >> + >> /* LED Timer Control Register */ >> #define MII_88E1318S_PHY_LED_TCR 0x12 >> #define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15) >> @@ -1393,6 +1396,12 @@ static int m88e1318_set_wol(struct phy_device *phydev, >> if (err < 0) >> goto error; >> >> + /* If WOL event happened once, the LED[2] interrupt pin >> + * will not be cleared unless reading the CSISR register. >> + * So clear the WOL event first before enabling it. >> + */ >> + phy_read(phydev, MII_88E1318S_PHY_CSISR); >> + > Hi Jisheng > > The problem with this is, you could be clearing a real interrupt, link > down/up etc. If interrupts are in use, i think the normal interrupt > handling will clear the WOL interrupt? So can you make this read > conditional on !phy_interrupt_is_valid()? So this will clear WoL interrupt bit from Copper Interrupt status register. How about clearing WoL status (Page 17, register 17) for every WOL event ? Observed that once WoL event occurred for magic packet then for next magic packet WoL event is not asserted. Need to explicitly clear WOL status so that WOL interrupt will be generated by the HW. Thanks, Bhadram. Thanks, Bhadram