Received: by 10.213.65.68 with SMTP id h4csp673763imn; Fri, 6 Apr 2018 07:07:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx48wjJvY0RoVpDjArNf0+u3gds9vbjZrvanI8nDHq2ymNLXEHx9y8PCQS1MBlENJDzfcuGrX X-Received: by 10.101.102.69 with SMTP id z5mr17831164pgv.438.1523023641079; Fri, 06 Apr 2018 07:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523023641; cv=none; d=google.com; s=arc-20160816; b=oaUQNXO69lkqQnPNwPW1NAbN+xo497nIeaLQ13y58FIVK+YGGRsGrgFmcD6BggfU4P aHsZKjU2WZICg60ddp9IWbwloyJ5qPIj4/+BH4ZO9ET8k8K/mwY5/pd6O1nIggXMo5Ib 9o3iS7SQZDV9lp4wKD88rgNhJocgJmkd/otZdqbWimu2A1sUzaM+3mwg1fjB0wDCtZq/ d/AcvUjf8Ey95b13mwn4Bw33lW9L8dm2OZ7+5o/1Tvr8+LDcUw84l9/OsrWMPdCN46n0 Nl7SiUMT809Q8MWJCf8Aho8vm80BjZnWD6el16jDXf2HvoPiO25oX3qRbYMw/bc/PzZa yoKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=eFdamrnT7OmgXq87s4VrZGsv78n7Amtx6ilxFrUtzpk=; b=PoM0aKql6SqR7v5bCQfTsK22uSOIxt+vjNvQI3dulcsiPtze68nt0+E/JPIfhxP4UV R9ZUoj4cLCS1jeQzyp15lBsZh5BddS2TnTmpF1i2JalrLtTzkFB4xPX9Dz6hrY9EM9mA KbDwEHzFu87BFqjV8OPsYoSIVQecMIcs/HC7RO4Rpw6/q+M8euUH2eTlXQJCeJJlwVe/ FlfisrMJVfgjzYYkRtEm38A89S8+P474N57yfxF0wgBlaun97a1EGQ7AizzQpY4MGd+N s5XiUNITB9qWg+WyveoL08pAwOhwKw4ccRow8Q0zrBBXV3nPPXbmAvWkNLVM+f6dI6L6 1JLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=HUXkUAag; 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 j25si7245829pgn.654.2018.04.06.07.07.07; Fri, 06 Apr 2018 07:07:21 -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=HUXkUAag; 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 S1756583AbeDFOFw (ORCPT + 99 others); Fri, 6 Apr 2018 10:05:52 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:41776 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752565AbeDFOFs (ORCPT ); Fri, 6 Apr 2018 10:05:48 -0400 Received: by mail-lf0-f67.google.com with SMTP id o102-v6so726777lfg.8; Fri, 06 Apr 2018 07:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=eFdamrnT7OmgXq87s4VrZGsv78n7Amtx6ilxFrUtzpk=; b=HUXkUAagTKGbxB8TsQxeKnMWMxhYsMOHcNPyoIejKTtQEEPUMerw7Xc9tOZQL6C18b WfxN3fEzyPflxqjvPOa1uK584O1K3wArEy9T9/GkeBsNbCDpD/fWAnOLTiV8X5lAWfmt j02RFXHusoiDbv2bRbk6x0CQTPPcnIyZl6uktnDziEYTFzb3+XwQtHBCSjBhBYfcYIaa BwpqwzRvgDN8ddngn+uBu8kCe0kUvtrKrqOEHy4DCrnCo1a3w3yZDofJ7FplDKvSlAKq cl4nLhL8PSylmb4q7Sz8MSLuKUnXCY+IemafXk0tfVhdcOMIAGr+vieM2KAq03qdlNOG crhQ== 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:date:message-id; bh=eFdamrnT7OmgXq87s4VrZGsv78n7Amtx6ilxFrUtzpk=; b=emRYXmKAsr3TTE6aAFHuSui2/gJ/VUaKb/AJGqUQZO2pa9fISGjaQCA8wU3drGv8aE HqVmSdEpBJkhxZhQLdRGf8bYm30ruyPrBz7Ir1JYQSSbr41CCN46WqPpBFsle3fuAYM4 a8u99AUcoiJAimH56Xp4Mp+EVh3FpeSV/UDYhnIGFkiM3ZkBM778DQvZkF06p3yKGMAB slzq3Vqz1U/eyfCWUwgS4Z2XkbuZGdDF48tLRfWA3FGec3owDf8MGjo5eWpDJdT2UsOr P8wAvYNc3ouRHj5Y6vwk29R+345tszFB78nGB91qexI9NKB8gqWRRqXevyBlGQKGBof2 ACbA== X-Gm-Message-State: ALQs6tA85fmKqEu3FlHfgsJAMiYpgyAlLp4qbE5PRrZYkf8nOJLiJjX4 MKm0e58DD2Lp4ALjUpNkRpAbw+1B X-Received: by 2002:a19:381c:: with SMTP id f28-v6mr15941477lfa.15.1523023546286; Fri, 06 Apr 2018 07:05:46 -0700 (PDT) Received: from localhost ([87.54.42.112]) by smtp.gmail.com with ESMTPSA id j11-v6sm2072974lfd.87.2018.04.06.07.05.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Apr 2018 07:05:45 -0700 (PDT) From: Esben Haabendal To: netdev@vger.kernel.org Cc: Esben Haabendal , Richard Cochran , Andrew Lunn , Florian Fainelli , linux-kernel@vger.kernel.org Subject: [PATCH] dp83640: Ensure against premature access to PHY registers after reset Date: Fri, 6 Apr 2018 16:05:40 +0200 Message-Id: <20180406140540.13511-1-esben.haabendal@gmail.com> X-Mailer: git-send-email 2.16.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); + + return 0; +} + static int dp83640_config_init(struct phy_device *phydev) { struct dp83640_private *dp83640 = phydev->priv; @@ -1501,6 +1517,7 @@ static struct phy_driver dp83640_driver = { .flags = PHY_HAS_INTERRUPT, .probe = dp83640_probe, .remove = dp83640_remove, + .soft_reset = dp83640_soft_reset, .config_init = dp83640_config_init, .ack_interrupt = dp83640_ack_interrupt, .config_intr = dp83640_config_intr, -- 2.16.3