Received: by 10.213.65.68 with SMTP id h4csp865237imn; Fri, 6 Apr 2018 10:11:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/jCV6p/yEhdx+B/tx/xdT56oKSpyiG5wb21h25VrV01/bjudWYyYhbYrY/48/KerWo4HZ/ X-Received: by 10.99.135.67 with SMTP id i64mr18281366pge.346.1523034684345; Fri, 06 Apr 2018 10:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523034684; cv=none; d=google.com; s=arc-20160816; b=eyMIPR4GmxdHAEXC6F2BHxheJguG1+VNXiI2IcqjasDwXc/jlUSOJ5+vwkKuw116z1 CDUNlMeSNDA5jmYOt/fb5qO9GY96kyNLx1A16Wi94Lu49TeyYE2hohDTPyag69roEVkx 3yMQ0QqzSwx2JSChmiGnVfV2k4qdpJ53ysW0Cgyij4S38m8HYEh/tm5qEGj/KQe4yJJ/ yrdVBdlEpuZiYgdw1oJrHXNMi8QMzs0ePvNDUOVrNAtH9K/Y6VKqNXLsjPuRdkV3D/OT 9YHSH/QhvlQyYl8Y8pr5kGCON010dXpTd9q3pWITEe2xDKDklSr4Kcy8Q1f6M+3ke999 hl2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=p+pBGgNbDy9PGwpUV4zXZTMrxojchErqCpFRURsZZUs=; b=E9Uxuc/VygjKC1YvYYfH8uTAnFlUgtR5E5a136gBtrn9vlthGNXYOTI3KLi2QD0lIJ z0qENP9XixAzC7k1AKvIQrVH66fxJQTzvegRQ+PB1ws7Sg3H79L/f7PuDGBgNrlXzydV 8QxButtILBtthR4F4SNfiv40ND6GuiLKCxZNPd0Kh7xCaoNRCflo89hSL0OUactQvjz1 7ZD3H7DFlKo1qsmYGgBWotd9jH45rHhxJnbSB4xerPgE82xWfNLcFUq93rZhvQ7xtDmM EO3za3Y5ehFMpaqvdN/HH99Hy5+lmk5Xmfm87v3ULXs+MQdcAIpcwGU7TLAKWcW2XULO NSyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=eGfZSvCg; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u9si7317432pgc.790.2018.04.06.10.10.47; Fri, 06 Apr 2018 10:11:24 -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=fail header.i=@gmail.com header.s=20161025 header.b=eGfZSvCg; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752191AbeDFRHE (ORCPT + 99 others); Fri, 6 Apr 2018 13:07:04 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:44472 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543AbeDFRHC (ORCPT ); Fri, 6 Apr 2018 13:07:02 -0400 Received: by mail-lf0-f65.google.com with SMTP id g203-v6so1502464lfg.11; Fri, 06 Apr 2018 10:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=p+pBGgNbDy9PGwpUV4zXZTMrxojchErqCpFRURsZZUs=; b=eGfZSvCgHjPv4JANHPukS6SW5N66qD9i3qQx49yz+t+3bDkxzdQDPbZZzxYoq3a6c3 brU/IFrgQH1re3hLBdi4XbluqqI5V/1zQJmVYy+DGMkoRaQ4bi3e4Ni2cIvAZJOhuJG1 YtTBTCPE8mnZxGvWSzOIk6oEDYcynpDmokKy0urPaOLTDtZtsORVeSyb46RbX8htlBc/ w28YYuC4ssSQvxeQtWZ93Vy4Rq7Nh3spN/RAMS/bVa7zkur+ynZnXz5rEypHXXijVbX9 KxQ2RaZR/Sa/XgeB75aVVmZTvq6BFZtHjRTC5wLDkIn1T7CWjRVzOpxRvmPVTDIgUPvM Nzuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=p+pBGgNbDy9PGwpUV4zXZTMrxojchErqCpFRURsZZUs=; b=YXyQfPiDysxjq7Q4CfOqdy1glxRDoSYKcIBepNJbQeen62hwljGxLMC7WSG/fNQJqV 3htu5tALHMNiA4cRDWBfIgS9pKZ9TV5nPSpFqAVv1LDI28GyD+Q5OmcEnlJ/ud31drOp maTyt7/YELIk9b34dJ0cMUZKj6wViuzwpopxBUMqUK/p/Sn8rDqISY/ATXeMlXQ8Jnfi ezVG34LpkEhhhI/nmhB7PMhNe2UbJIOAeZsCijjAaDLMm76xJ/76gxU082kE5EIpUsnD o5c9dcn6VYgVLe4s6MEDWviJtOBAn7o9tMQeESYtjxRyxtU94MDZSv0NJFTRoV0VcfqM EAuA== X-Gm-Message-State: ALQs6tArtFTzO9PgLM6EetIOaJgolcijOyWLnOHe/eZyCOdzYVppLOcj eT/Qa9pcTrFjULJuTSc5fVY= X-Received: by 2002:a19:5750:: with SMTP id l77-v6mr17428859lfb.10.1523034421298; Fri, 06 Apr 2018 10:07:01 -0700 (PDT) Received: from localhost (87-57-30-174-static.dk.customer.tdc.net. [87.57.30.174]) by smtp.gmail.com with ESMTPSA id f21sm1866694ljk.23.2018.04.06.10.07.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Apr 2018 10:07:00 -0700 (PDT) From: Esben Haabendal To: David Miller Cc: andrew@lunn.ch, netdev@vger.kernel.org, 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 References: <20180406140540.13511-1-esben.haabendal@gmail.com> <20180406141410.GI17495@lunn.ch> <20180406.111337.1908168293065420432.davem@davemloft.net> Date: Fri, 06 Apr 2018 19:06:59 +0200 In-Reply-To: <20180406.111337.1908168293065420432.davem@davemloft.net> (David Miller's message of "Fri, 06 Apr 2018 11:13:37 -0400 (EDT)") Message-ID: <8760541cy4.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org David Miller writes: > 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. Ok, will do. /Esben