Received: by 10.213.65.68 with SMTP id h4csp683333imn; Fri, 6 Apr 2018 07:15:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx48rdA4txeqjtd4bcPTmsgQLBiD66YU2xmHTlEuUFZUJAspvQOknncvDXAziWAisbgE0fy/z X-Received: by 2002:a17:902:b117:: with SMTP id q23-v6mr27677504plr.193.1523024133562; Fri, 06 Apr 2018 07:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523024133; cv=none; d=google.com; s=arc-20160816; b=ah+fUFPtRm+FryBXWZIizjVOZHonOvdNyup0o5BJ2e3+Ub/XUOI/RaLE28VfGfFiZJ i2zq0eYnGZhJJzb37c+K+RvlUQMCoh6XKtUgIFChLLxRM519XOdsSUafPVi8JeX2NZtd /Ub2kO9Gtlt5MVZ2wj3amvvcFIPNnNa2fGqX3gD/98yUP5xKbjcuKHz0dvJJUYITxhuR Z2vjP/s7K3lZN+8FDrRBrxSdI1B/iRi0iEu35bCQgUU4kqUlYAgNCZOaxI7JS/pnXYqs e+rZGArSTQuuQ7eGxd3c+9CDU9t4CyXzwHI4SzqTqWDf1zoJ0NuVz19dObDfbmsMIUV5 k9RQ== 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=4yCh4XKBNqHJ74JLaiXYX2jo453NcZstdQlZ/noYPXE=; b=JXkE+NtTfEJZP3rzxYi9MrkPAe+n1CluCKqhLrnS15XDnXRIF9RhJ90pHt8wpp+jg+ Zp0ZssFFEe+Cj5ICapqH2l+yxMOKDwdqpusaLHC9mhO6axgJSoShGAoYptPLOSKVjdMf y878ffjhtPqmII/bbEaXEXt6wi8RiyYTNj4b40Cjir0TD0B+o3rJzclfEuOuPq986ZG0 mP8Y7VTANSBQjjfgCZQv0q30jKXmQqDPs+ZjK0CwF/vQJUK48sdUekf4MBiPARm2eqeq kqIQdOcBPzMBy4U1+KZVIKLdeAMNv+nuROYxDi/lRNWrshorKHoVA46Rtj8KrKXT+gEs slPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=5l18W9dh; 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 l20si7801563pff.297.2018.04.06.07.15.19; Fri, 06 Apr 2018 07:15:33 -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=5l18W9dh; 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 S1752959AbeDFOOP (ORCPT + 99 others); Fri, 6 Apr 2018 10:14:15 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:52381 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753308AbeDFOON (ORCPT ); Fri, 6 Apr 2018 10:14:13 -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=4yCh4XKBNqHJ74JLaiXYX2jo453NcZstdQlZ/noYPXE=; b=5l18W9dhUi6QhWlOw6FDRconV/vX8sQMR45iBVTDPF4UwczBP3vR12o4alryGcF/fKCIW/JXTkQf0kO2x0ZAheZp1dZMd7CCI+CaMcqs4fP6Mwj7IlQWZ23IygIV5U3vE+grvHNZANLj5/yqH6WcQ+lGwT04C7tj1oxIu98B1/U=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1f4S82-0008Np-2B; Fri, 06 Apr 2018 16:14:10 +0200 Date: Fri, 6 Apr 2018 16:14:10 +0200 From: Andrew Lunn To: Esben Haabendal Cc: netdev@vger.kernel.org, Esben Haabendal , Richard Cochran , Florian Fainelli , linux-kernel@vger.kernel.org Subject: Re: [PATCH] dp83640: Ensure against premature access to PHY registers after reset Message-ID: <20180406141410.GI17495@lunn.ch> References: <20180406140540.13511-1-esben.haabendal@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180406140540.13511-1-esben.haabendal@gmail.com> 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 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. Andrew