Received: by 10.192.165.148 with SMTP id m20csp3777719imm; Mon, 30 Apr 2018 06:18:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp4/h6fiMFS1hzjcmlotwG/XSmuNeiL+GzW4uk4faUGdZsejc5pgmxrJmQVU2pCeMq+jwKF X-Received: by 2002:a17:902:6a89:: with SMTP id n9-v6mr2776511plk.41.1525094312927; Mon, 30 Apr 2018 06:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525094312; cv=none; d=google.com; s=arc-20160816; b=TxcqS9dpBcjKarOdG/pjgAwkaYrENcq/lF+yigyzkA3oEzizmJ31+jnFwmetY7rHzO 2JWQkpzd067+tGMbNr1mkKQAyh4gdMeZ+FUgj1KPq3Qi3lTWMXBdxugO2HUjYeOauFoo yBqyCq7cuINlethSczCrUfhVO003FYAOB/ljGrpWMFlSwgQIkoewIW5X0aFIBVM9jE0d ++sN0iKBTMa2JINN5Xnhy18eSrtWKXhhQZb+C383HMc7FQipoGedSYCgruI2vpd8tv4P pPSr6nXwa/Cgst75rtPNVKLbcJUsARgnb+Lx05xkgu7LfcwJV/M99Xm6h89J+mDhRyXR KrBQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=13W50eub+5/G/N5NkcuAeRmqNjnTY79wbAAS5ghylIs=; b=lNKWXVxwddFvwsQT150SZuidRW4zeecrE8e9mS7VVylcThXyViL0zgyY5vensj62F0 Rq2sYENkE+rrA78T5zG3FO3lu/xwW0pn+eqhnMkLIdjM9Cg+qEPBmHZfjy2PkVQ4z7UV ihAldRDO2wM1/PhYQ3vnlpXvnvXZ47LYuRxOE/rUesFjnbbDRYeQXG2B9gz9JISLI7We PNAZ5ZWwe2JpBUU7Ugj0V1HaItJ4gGiX+UOAAtmSGSeyRVjB2TIhwe6aMvWFagwJVI4t r5+KE9Pp97oZvl4yZIhSljt+3EGoKeBwM8ahcsi5licqWzFemS+ogxzepoofUwAs3TS2 2F4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=GZpRskC8; 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 m13-v6si6114513pgp.482.2018.04.30.06.18.18; Mon, 30 Apr 2018 06:18:32 -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=GZpRskC8; 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 S1753909AbeD3NRk (ORCPT + 99 others); Mon, 30 Apr 2018 09:17:40 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:44940 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753795AbeD3NRj (ORCPT ); Mon, 30 Apr 2018 09:17:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=13W50eub+5/G/N5NkcuAeRmqNjnTY79wbAAS5ghylIs=; b=GZpRskC8aLFRjE0wGJx++vhWtP/wyIpywGts5jyrzCderWH+hkYINOEq93IgXcyo0CGDPSlANSxteCPE8ZrQUNfKO4ELaOd7aIZTv/UEqvwJtTxxUcWS/oKfQknM6Y09Vux4+n4zAXSCljZFG0XLeQc8QHIS7/JmvObs9jWAuUE=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1fD8gM-0004B6-7s; Mon, 30 Apr 2018 15:17:30 +0200 Date: Mon, 30 Apr 2018 15:17:30 +0200 From: Andrew Lunn To: Jisheng Zhang Cc: Bhadram Varka , 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: <20180430131730.GE10066@lunn.ch> References: <20180419160232.519d15be@xhacker.debian> <20180419121801.GC17888@lunn.ch> <4273f766-a017-b336-7d14-a28901d274b9@nvidia.com> <20180426141508.6660a633@xhacker.debian> <73e21c83-f78a-8b22-a421-f179ef6adef1@nvidia.com> <20180427152555.5e8efb9c@xhacker.debian> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180427152555.5e8efb9c@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 > > diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c > > index ed8a67d..5d3d138 100644 > > --- a/drivers/net/phy/marvell.c > > +++ b/drivers/net/phy/marvell.c > > @@ -55,6 +55,7 @@ > > > > ?#define MII_M1011_IEVENT?????????????? 0x13 > > ?#define MII_M1011_IEVENT_CLEAR???????? 0x0000 > > +#define MII_M1011_IEVENT_WOL_EVENT???? BIT(7) > > > > ?#define MII_M1011_IMASK??????????????????????? 0x12 > > - #define MII_M1011_IMASK_INIT?????????? 0x6400 > > + #define MII_M1011_IMASK_INIT?????????? 0x6480 > > > > @@ -195,13 +196,40 @@ struct marvell_priv { > > ??????? bool copper; > > ?}; > > > > +static int marvell_clear_wol_status(struct phy_device *phydev) > > +{ > > +?????? int err, temp, oldpage; > > + > > +?????? oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE); > > +?????? if (oldpage < 0) > > +?????????????? return oldpage; > > + > > +?????? err = phy_write(phydev, MII_MARVELL_PHY_PAGE, > > +??????????????????????? MII_88E1318S_PHY_WOL_PAGE); > > +?????? if (err < 0) > > +?????????????? return err; > > + > > +?????? /* > > +??????? * Clear WOL status so that for next WOL event > > +??????? * interrupt will be generated by HW > > +??????? */ > > +?????? temp = phy_read(phydev, MII_88E1318S_PHY_WOL_CTRL); > > +?????? temp |= MII_88E1318S_PHY_WOL_CTRL_CLEAR_WOL_STATUS; > > +?????? err = phy_write(phydev, MII_88E1318S_PHY_WOL_CTRL, temp); > > is it better to reuse __phy_write()? phy_modify_paged() would be the best function to use. Andrew