Received: by 10.192.165.156 with SMTP id m28csp644389imm; Thu, 19 Apr 2018 05:19:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+GnJFQ2kTNld2t6bExRbK+27/KA/jQ3daBzNjYTg3rQlw5lPW2QqwXS9u5umymloij46/U X-Received: by 10.98.89.209 with SMTP id k78mr5681048pfj.54.1524140376768; Thu, 19 Apr 2018 05:19:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524140376; cv=none; d=google.com; s=arc-20160816; b=oySvuekkuGCkw+OWOWdOTtNP+Hffr1+ltkhtedVzVEs1ahXH1APVZjqS/1TWz1Tnbk hs3ytLs1EXreu9QLmSFfBcPB3wbalLHt15BJv1SpFeFTOIuSOHk6s7d1etiAPn7r1XOG AxRTq0sRFdSfQW263cz2N73Fv7G6cn5OQVIEuDmLNfhHaA4JhpTvWa4bp83/M4UfsB45 rmtzl2y4eTfUnTuUQs9Nva87UYWQpjOFFkch95cxkf0fsvE2Ct69zsOk5uWhIrTUB5CK 6jtfIVqJkZsCIPGWz5a8LCbWjTRXMqCjaQzUCxm00yxhO04rupUoC7gnBfGTvA5HQbOH jIZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=aAZpoy/tDjlmdvvM5AxncMcx6NqcXgZPja55tv6Ykt4=; b=NCYBUJXanMVihkEcEG2EFBQo8dRm7JCj4Pu5eQlqrH+6x5g9k0EPeZ1BPbvfiI4xE4 A94eY1cjEsFWB/fTdLi/duWGPwmRpolOm7EPdC7l0tab7pfEPko6coxU/evY7+lUMej+ z3VaJ0BBfkrHgyopsaWuvTc7Qs5/g5+xulIV73vC89yn9YaERLQh5oCwYQJR871SdD5U Pg+KB3mV8u6d+yi57t6LivvjFoMtV/P5TzduvyRqnkQPZk7ud3RtlxvIrQ4Cr99+tbLg B+MzZGGTNf1OKhw2+Ejrj42PBM1mmyfg5tmro18ee2x34tJ/dqdhVttu9WNcldQTSuTK v4sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=oayg8goB; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12si3058131pff.119.2018.04.19.05.19.20; Thu, 19 Apr 2018 05:19:36 -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; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=oayg8goB; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752391AbeDSMSH (ORCPT + 99 others); Thu, 19 Apr 2018 08:18:07 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:33712 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750974AbeDSMSG (ORCPT ); Thu, 19 Apr 2018 08:18:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=aAZpoy/tDjlmdvvM5AxncMcx6NqcXgZPja55tv6Ykt4=; b=oayg8goBUPXvy210kBqIMERCeEObrItCnep9hnT5hSsy58QdWAYElldw2KhjUIb6h1y05bqIgVtiToJocjIBwKkXUMYrcsK/KxK/tHMYK70QhCgCvtF2vAaqlZf5eL0Xydt7OvbwtQ0xY1Th4U2M4jQVCLnELyWlD/mUQ0NiD3k=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1f98Vl-0006zM-O1; Thu, 19 Apr 2018 14:18:01 +0200 Date: Thu, 19 Apr 2018 14:18:01 +0200 From: Andrew Lunn To: Jisheng Zhang Cc: Florian Fainelli , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jingju Hou Subject: Re: [PATCH] net: phy: marvell: clear wol event before setting it Message-ID: <20180419121801.GC17888@lunn.ch> References: <20180419160232.519d15be@xhacker.debian> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180419160232.519d15be@xhacker.debian> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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()? Andrew