Received: by 10.192.165.148 with SMTP id m20csp3119231imm; Mon, 23 Apr 2018 00:28:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/dCr/zfDjRD7Pd709SRfRHCjvSdY1wMu61IMM90V+BSV37FAsS4vWg/UeLBeGOU3FovFvh X-Received: by 2002:a17:902:d882:: with SMTP id b2-v6mr18931571plz.308.1524468489363; Mon, 23 Apr 2018 00:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524468489; cv=none; d=google.com; s=arc-20160816; b=hbWfQ3I7gPe8X/4uGSNenB99O9jqGcQCW/EF0Ajiy0Z5iyILMiFiH09PkKvjb0hFcS q81i0kvE0M2X+yawlBHDyL7eqnqrSvQ2uOmtzy29LxjZ0aIknm7QFuXEUdUgEdpV50z7 oh4+QhEt285r25OSweykhzR03A0Q933LFckoKOQ3TqMXgrjWhgmKjhHkdC1y6tYbFEiV QPCwdnxb8RX8SlDGYFFqGwnra2JYicCqd7UlgtLU/vUgn1h+5/iXBoTmm/M5X7WxWwnB yDpixjjmClMm3bKHVlD/Uq+tnqPs4+z3rzUPLZj+9lqpW86SInn2RvJ5qYXOUCLxyOdG fP9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=Lm+bF5eYVspogI2RsnQEVw8I3dN08e8STJ/VYaVxh5o=; b=PleLa4+D4zRGa+cJPXnE5RaP2CYSJqNXvjMGkyjHC5mPSrvuR8pva+LdrjX0aCjS5P 6WK9W4tfsYoGTPxLWg2qKmsXJwLWFwVKO6QQfZg2kJDO535V4hVAxFKB2p1Bp3D3Ohvh hvsyC2VYwekt2XXd3om3j7zxMvhq++UnL0PME+yNsrBddDHNAVcan20tB7JkaXa4lLiq m9QMoDxNxVF39irziEXbMCHi2cISpOqmB/awWxpGrGy3GWqA2kXQOg5irZCYB0YiJd6I ErPq+wC33CY+ZL0u0Lf0+cmdc9pvAH/QIAnsePIN5if4YAJ0WXP36mYlPgIQcbEntWDE he9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=Gr2cBf0d; 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 r4si373711pgp.632.2018.04.23.00.27.54; Mon, 23 Apr 2018 00:28:09 -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=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=Gr2cBf0d; 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 S1754201AbeDWHXi (ORCPT + 99 others); Mon, 23 Apr 2018 03:23:38 -0400 Received: from mail-bn3nam01on0052.outbound.protection.outlook.com ([104.47.33.52]:28989 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751785AbeDWHXS (ORCPT ); Mon, 23 Apr 2018 03:23:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Lm+bF5eYVspogI2RsnQEVw8I3dN08e8STJ/VYaVxh5o=; b=Gr2cBf0dxxQVDuTrlMfHapoJGTpbx3uAT1eHV1Bz+bhQZnkqZBYTpJZF+fBcpjMjnH6XNQdDvylaQebhUJsHavxvO7lHLAjRpZ4bKXL4xgr3I/p/2uCI5H31rbkKvsrFa4VP5amMBCxR9aR3aa37d+9KN92acgB92TuYRnzdhFU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by BN6PR03MB2625.namprd03.prod.outlook.com (2603:10b6:404:59::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.12; Mon, 23 Apr 2018 07:23:14 +0000 Date: Mon, 23 Apr 2018 15:22:49 +0800 From: Jisheng Zhang To: Andrew Lunn , Florian Fainelli , "David S. Miller" , Bhadram Varka Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jingju Hou Subject: [PATCH v2] net: phy: marvell: clear wol event before setting it Message-ID: <20180423152249.5f1deb65@xhacker.debian> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Originating-IP: [124.74.246.114] X-ClientProxiedBy: OSAPR01CA0063.jpnprd01.prod.outlook.com (2603:1096:604:a::27) To BN6PR03MB2625.namprd03.prod.outlook.com (2603:10b6:404:59::8) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BN6PR03MB2625; X-Microsoft-Exchange-Diagnostics: 1;BN6PR03MB2625;3:Ngsik/gRPp5eK30WMrYtpFVLRNDEpDQi7oWK3iY/qfhOjk3HDd318b5PQiN2ictehN2BVPtnOGVZi8Abx0zyu//ZLIolvrHGMOGooUj4W6Fv+0UYnBn0TTi6MjeFf68bAo3HyqBwm1Fl6CHYOcMO1sSc/cRHnTdgJEFPGiNAU3tQmXOt9Z516AayjdGjtY+7zvEDVuPeXvN56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/6HAaBGbTgXqtdgZHUT2Vr4OPdiwy9ON2tzO6L5tlnYbDorKfkU0hVUIuPNBLNCEH3c95wWi/cujXNRu4cSB915Nu5rUdKoVkmVwjQAlcSWlj3Vts5a0g2Lpv3NCh;4:TWMlYdTV/rrgL6aQ2SLFQZScKcg3/K7SYXC+EX/rlFVZtLbrS5v+jS1ECVPjxjDpNe22wwAPiD+PbSNCZ7Q/GJo8lPY9+mw8Oi6rullHaw8qKxq8wyMASWav75yScLKMl5CEva9DpUBIniiMH5pv/ZQhEzKm3xuQcIaXuzp+iruSQqBlvjFcuURDxJhUym4Lt+tfD3m+HwIs7eAo1PJz2FOWV7X0cis1yW3ShmLEYhluaGEi77IEPoVTTkgh1I4vKMWcf1lNz0lTy2OWqY+uyw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231232)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(6041310)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011);SRVR:BN6PR03MB2625;BCL:0;PCL:0;RULEID:;SRVR:BN6PR03MB2625; X-Forefront-PRVS: 06515DA04B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(376002)(396003)(39850400004)(39380400002)(366004)(346002)(316002)(6666003)(26005)(50466002)(110136005)(50226002)(386003)(6506007)(7696005)(86362001)(52116002)(2906002)(3846002)(66066001)(81166006)(23726003)(1076002)(47776003)(16526019)(55016002)(33896004)(72206003)(8676002)(230700001)(6116002)(8936002)(186003)(7736002)(305945005)(4326008)(39060400002)(9686003)(476003)(5660300001)(25786009)(478600001)(956004)(107886003)(53936002)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR03MB2625;H:xhacker.debian;FPR:;SPF:None;LANG:en;MLV:ovrnspm;PTR:InfoNoRecords; Received-SPF: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN6PR03MB2625;23:eIAr21DSh+Pl2FuwXGWNgtRNCsYLnQWzalLIyUAhg?= =?us-ascii?Q?JteREslTWoGbNyl9/pZBfA+LTRrlSRGTy+ZG2VOiu243dQnmrg/zW6biz+il?= =?us-ascii?Q?acHllLIHLvaz0NbXH/MZuVEFgnp1CqG5TT3Vo/ilyiTFVTHsaC5O8t3n0flc?= =?us-ascii?Q?vejVzZIhdBYW+iJa6pzrW90M/T6Igf2//NjkhDYRkCxRRkQK7V3AAiYiGYsS?= =?us-ascii?Q?ckThknq6eBIukL6QN64GoCbEjWf/Th2Ou+iWlz+l56wRvPslDgJW9aCoOfrH?= =?us-ascii?Q?f4RA2K0Xv2+YpOmFw7vs8aMPBa6S80Kzmm6NpvigExK3gJv6vqEGD63ivMqB?= =?us-ascii?Q?cAs7dWpJP8a4EWFAOmtf40sa3VcoNh+l7mzRn0T99Sd4eIe3dJMav7E45dr6?= =?us-ascii?Q?n8906FkW5sqmLaZtDY3hHzMb4sk9lywR/HcwKKfq0CQH2VBbr/Kz0pDpaPds?= =?us-ascii?Q?N91IuqbEZxDiFEGWUcp7ComrjlggqjkAONbOkDuSrMkVFpSWcdAQWKJexBwc?= =?us-ascii?Q?fwKYzTynDSS23yL/r47RkPn4G4WHHN2gnd02pQ6clwcvJsbLUAl/eyL8rvre?= =?us-ascii?Q?Nm0rmR0vYTLFwt037mdl+rzLLjkrk5frZrs7/NGdwbeN3t7w7Ozt5e20E6lh?= =?us-ascii?Q?G/OMhWqvuJt2SbG+RkFVsjJgKr/rsBMykahpTR6SuPQnBAqD9fixDA8rZqBF?= =?us-ascii?Q?AI/xRcAajPXjlZRfjJ16GF3il6gYfOovhPrBo4/p3ye+TEr7g5f9jFvxjfrc?= =?us-ascii?Q?WvTBXPNCdSGXP3SuJ8Ld0IktbeChMW6AC1GzD1WeEt4kDFarHJh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JIEXX218XCidzBKuz5Ex+HaIDsO5VX/uipULUN2cDbPeA8OEFncpNxNlTAWyEHV9ebtEnZ5VpOI5ka8d67ThUbXba/Thv2AXYVgM0ftT48lXSvaKhZMfhLV+ekl8uETvn4r+WcSHHTePAlBg/cNrdfSQnj7BNblV4g=;24:kiYb+F4qr1dL3Ywhy6Ro0sT8z6cw9JrsJOiqEnNbdiH/WsrSLQOfXmpPKJ1hXozrINMmebemD2i/LMdsgttOrYSt4AxkVG6zGSkk1VdQkdY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN6PR03MB2625;7:HDF8PfZIvsxFoC6vmST04GbFy5f/+gd636fFUFSCcXlPqhfEKYlKchv+4rBMRWxP5dX4LcrXUfgBmQ+rze9sifIelRXiEZUOCNVWvIbOBUqai4mzakCq7l/9De+WfaQG5ZXSomB7YyFeSGwO1jNeFjiLespMbfKg5Oudb/9JB2FyZnUNYeiSaM1fVHeWVrdOp1V7yelFl/DoLlNqyT/iBukXu3g4SEwd58fxEVQyAMTdOpKfZY7dxhD7S43/ixoN X-MS-Office365-Filtering-Correlation-Id: 0849615e-97c6-4a42-0544-08d5a8eb14cc X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2018 07:23:14.0440 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0849615e-97c6-4a42-0544-08d5a8eb14cc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2625 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jingju Hou If WOL event happened once, the LED[2] interrupt pin will not be cleared unless we read the CSISR register. If interrupts are in use, the normal interrupt handling will clear the WOL event. Let's clear the WOL event before enabling it if !phy_interrupt_is_valid(). Signed-off-by: Jingju Hou Signed-off-by: Jisheng Zhang --- Since v1: - reuse MII_M1011_IEVENT, suggested by Bhadram Varka - make read conditional on !phy_interrupt_is_valid(), suggested by Andrew 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..25e2a099b71c 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -1393,6 +1393,15 @@ 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 we reading the interrupt status + * register. If interrupts are in use, the normal interrupt + * handling will clear the WOL event. Clear the WOL event + * before enabling it if !phy_interrupt_is_valid() + */ + if (!phy_interrupt_is_valid(phydev)) + phy_read(phydev, MII_M1011_IEVENT); + /* Enable the WOL interrupt */ err = __phy_modify(phydev, MII_88E1318S_PHY_CSIER, 0, MII_88E1318S_PHY_CSIER_WOL_EIE); -- 2.17.0