Received: by 10.213.65.68 with SMTP id h4csp748803imn; Fri, 6 Apr 2018 08:15:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+/Pt2hnTeWin3J1FTsB4SYfjDRuH86cJmKXnMHYCrZae9At+4iXcC4G8HKgYBCo8OqUNrH X-Received: by 10.98.76.68 with SMTP id z65mr20947251pfa.181.1523027705310; Fri, 06 Apr 2018 08:15:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523027705; cv=none; d=google.com; s=arc-20160816; b=cypExvTPZ8XXj7C8Xx8gHHgbAyZ8doadgztByRkkCgX/kZljbesQLiN5TkzyUEHpWB zkmbYxGpYVJuFwvQBLhl47g1mK5XCb1HvpbN70QPPOA5q1jllqkoNmAWwOTUiWK7n7Uo CCXxbg4Zlox/IZOPkMUyQqIkGBiqrHdXf13aea5oDhKAjk9W3DMBL/26EMO0Nyn3ruTG fRsLQx0DoG7u2FscHTzLc2++cnklPZsUeWhId5V1dTOegiV666ifyAWnT3LanICLFFmD gALn/xPbGcZGyjVxaH0QAObVhdAki5V4+juSetuZa8dmhK5hXOFxXng/LflMCMhDN4PI BDFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date :arc-authentication-results; bh=uoz+sFBWc9d60dzB7CT5GSl8gv7HJigzWsGmI3Mhvr0=; b=LPbzgB8x4B7QaNSdyd7Qvhbot1MAnaxnYukpiFdtWUmN4zIsqhCWIqXYZM9LnxSqTf C5qu/QxY1ruwXPxkOPJNoG7gKdlB6dkeIeEMEWF3lZjLOMNR+gDrTBwsGiNlyvMMTon8 4AcnIZJsoeJxZ8YDshLFC1yH7vboYut/JrLTqAEXZo7sTWZuZ3K8/2TdZe7CtY6hqDqJ U1uyrVaQSLXsexudPXjXXdxtzIYT2CH7fR2EOM9gVEe6Zxu7n1k084xVQh9ORS5++L74 B9dyYfyOi9O9lSpHZ/ufe6tN4tgsc4nEzI6yeuja4W5ybMrymvNj3dhQY8MGMHfHYxOe 8Csg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7-v6si8380500pll.132.2018.04.06.08.14.51; Fri, 06 Apr 2018 08:15:05 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752203AbeDFPNl (ORCPT + 99 others); Fri, 6 Apr 2018 11:13:41 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:43424 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751344AbeDFPNj (ORCPT ); Fri, 6 Apr 2018 11:13:39 -0400 Received: from localhost (67.110.78.66.ptr.us.xo.net [67.110.78.66]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 9E96A13D174BE; Fri, 6 Apr 2018 08:13:38 -0700 (PDT) Date: Fri, 06 Apr 2018 11:13:37 -0400 (EDT) Message-Id: <20180406.111337.1908168293065420432.davem@davemloft.net> To: andrew@lunn.ch Cc: esben.haabendal@gmail.com, netdev@vger.kernel.org, eha@deif.com, richardcochran@gmail.com, f.fainelli@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dp83640: Ensure against premature access to PHY registers after reset From: David Miller In-Reply-To: <20180406141410.GI17495@lunn.ch> References: <20180406140540.13511-1-esben.haabendal@gmail.com> <20180406141410.GI17495@lunn.ch> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 06 Apr 2018 08:13:39 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrew Lunn Date: Fri, 6 Apr 2018 16:14:10 +0200 > On Fri, Apr 06, 2018 at 04:05:40PM +0200, Esben Haabendal wrote: >> From: Esben Haabendal >> >> Signed-off-by: Esben Haabendal >> --- >> drivers/net/phy/dp83640.c | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> >> diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c >> index 654f42d00092..48403170096a 100644 >> --- a/drivers/net/phy/dp83640.c >> +++ b/drivers/net/phy/dp83640.c >> @@ -1207,6 +1207,22 @@ static void dp83640_remove(struct phy_device *phydev) >> kfree(dp83640); >> } >> >> +static int dp83640_soft_reset(struct phy_device *phydev) >> +{ >> + int ret; >> + >> + ret = genphy_soft_reset(phydev); >> + if (ret < 0) >> + return ret; >> + >> + /* From DP83640 datasheet: "Software driver code must wait 3 us >> + * following a software reset before allowing further serial MII >> + * operations with the DP83640." */ >> + udelay(3); > > Hi Esben > > The accuracy of udelay() is not guaranteed. So you probably want to be > a bit pessimistic, and use 10. Agreed.