Received: by 10.213.65.68 with SMTP id h4csp867424imn; Fri, 6 Apr 2018 10:13:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx49rL1un4YlUh9+gYVCuOSG+abp2PNgjLGQinc6NxySJi/hAaC7P0PcVYNILPXYyoXhFKZ82 X-Received: by 2002:a17:902:143:: with SMTP id 61-v6mr28509144plb.345.1523034816585; Fri, 06 Apr 2018 10:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523034816; cv=none; d=google.com; s=arc-20160816; b=jPtPHXHkyLPzg3OUKLSatPjsPV+FOWaESByf3Ea1YOiVSTz/Jl7oyBHJgyoUazyxiP YMqCt4BV7SaC2kyLJXZ/h6XHhS4vXedPv4ZQuqvUFTZpxdFike9l3tuhu73uVEswUqGo /ew9nF22o6H2A8GoaXzjDYmwuyaV4gCSlZxb+b8T6Om3jgCjjSHsIKjOpUESj07ap8nb cUuxu0Z/yyAP8QhD8S41zLBrGsIdyS6YuuL2ZP3vXW5OTyyenRztdsdbhjuJJ5Qac4qt cX8y2nPrqRCVBW0+7ek8BrqTZOFKJuLVQshOum3VE/HK7QGwk/QBlFZrPCnq9X0wzV0t q7+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=QS1oJmHo9Qgld8zI10FP8xn2C07FnAmfWoyYCPlC0U0=; b=NYozJxL7MIycyyevZVjc9pvk9YwG5z4OY6LUxRoKhvnkbDl5FWPRQIzJtm5d80KBth cbr9sDPDS1ErQamTMtLobFOqZwK1vymEGEiVPhBe6Xy+KUUQjf5xmXLDjjWqS8PUGC5l Au38fH5c/wL7kv2vY/RKtJkpYfQQe5LfzaCysxhkH/gHJkx6WEy0otSBlVUD/j1Zk12N Q3Qji+2PFsLoguk4nVzK/y7M9QWc5Qd3AKYX7L6NbfXfR1CmFkn4XoNfYcot619bCm9p 0GitY5lp0pMDrj3eMMGfDYagM0Dfay/NloSEH2vSWnSAY5d8PJv8SyOFa7N1W3ybYxq6 rDdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=h7cUC4Yg; 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 x143si7387488pgx.157.2018.04.06.10.12.59; Fri, 06 Apr 2018 10:13:36 -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=h7cUC4Yg; 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 S1751900AbeDFRIy (ORCPT + 99 others); Fri, 6 Apr 2018 13:08:54 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:39235 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751412AbeDFRIx (ORCPT ); Fri, 6 Apr 2018 13:08:53 -0400 Received: by mail-lf0-f67.google.com with SMTP id p142-v6so1511641lfd.6; Fri, 06 Apr 2018 10:08:52 -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:in-reply-to:references; bh=QS1oJmHo9Qgld8zI10FP8xn2C07FnAmfWoyYCPlC0U0=; b=h7cUC4YghKurRq+FE5uR7l0w0XWTpbbBT8B373voD+ND/4WMFJXJxiKFoGbDxTbzyG 5by94x8mzGhW3q/ZjxI2tZ/+T9+wwSN+YPmzwC5kXhmLs34nzHY5z8lW8mS8LMEO7gEL 0VQoGNre3oM1NrXgLtTKQdrvuei6GIhrhp1Rorhzs1rfjMlqlfeR1n0M0RjvQsaaNnR9 Vxj+posl14/LWKZHYDK4bzK+2UO1T46MlqOxfBTPNI5jKa6f242sbV5s91ZEa/81X36R 31UZWHIehUpNrrCIZB2K9yKXdHzaEeLdu2MuoHb4/HqAUZcNfS7P8KH3hgSIij3+fhtI 6PQQ== 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 :in-reply-to:references; bh=QS1oJmHo9Qgld8zI10FP8xn2C07FnAmfWoyYCPlC0U0=; b=TzIhe0i1Pb9RThRXbYucdeXnhJ+l6LUQiurR/QNK6SXVQvS0TS+6w6pYF2lO4P4UmS SyqCDQv4z/LFwBXQVRsqq/C24QMvcpDEK4k7KPDqcwtDYuIFGx3KFxUVsVCC4r818Uag lveZoebf5t4YGV11NAKuEgZFrMuNAMSSU8nZQTT1EI+qEwZb8KGN+bJUEJajVcduv20V a+Y6U5XUvl5XW6/QWMK1DGZ07IWsryFBSSSdVpzrUpLm7LaUNx9IK5Ga7Zc+GEHLUYvh Wxrx2Ukkcu1hQjHwVq/x4lWU4qFhOkHiPrXNGQ51S7T6oJ877Dm8mM03qkUQoiAKFmAc 5Z8Q== X-Gm-Message-State: ALQs6tCcCfomMNu//908rJdQXxyb7q9LBvMOohP55qHiHdhqsBQZ80VI vAkS94YdMXZNQCjIWyQjjY94nLMQ X-Received: by 2002:a19:3bc6:: with SMTP id d67-v6mr16858033lfl.100.1523034531071; Fri, 06 Apr 2018 10:08:51 -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 d127-v6sm177380lfe.64.2018.04.06.10.08.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Apr 2018 10:08:50 -0700 (PDT) From: Esben Haabendal To: netdev@vger.kernel.org Cc: andrew@lunn.ch, richardcochran@gmail.com, f.fainelli@gmail.com, linux-kernel@vger.kernel.org, Esben Haabendal Subject: [PATCH v2] dp83640: Ensure against premature access to PHY registers after reset Date: Fri, 6 Apr 2018 19:08:44 +0200 Message-Id: <20180406170844.4248-1-esben.haabendal@gmail.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180406140540.13511-1-esben.haabendal@gmail.com> References: <20180406140540.13511-1-esben.haabendal@gmail.com> 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 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 654f42d00092..a6c87793d899 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c @@ -1207,6 +1207,23 @@ 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(10); /* Taking udelay inaccuracy into account */ + + return 0; +} + static int dp83640_config_init(struct phy_device *phydev) { struct dp83640_private *dp83640 = phydev->priv; @@ -1501,6 +1518,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