Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2510541imm; Mon, 28 May 2018 09:26:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoODafDX5MuD2FzlJlOj23mTXvQKPx0BTlFlZxdtC3YdFGhPrF0PwRSWGbYBWTx4UetwT9C X-Received: by 2002:a17:902:164:: with SMTP id 91-v6mr14401249plb.134.1527524796744; Mon, 28 May 2018 09:26:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527524796; cv=none; d=google.com; s=arc-20160816; b=b5abvE+Ygaz3hqnsB2IV0+OhxEAfBhI1E3Zjqr1MebPxshz1MV8BdrL5k1N0tbLjRW fu6acvhesyL2eyM4JKWwScdQ/C+xc3aLYGKUo1cEnrNT2xt01or9v7LjZQl5gK6vKR8h t3Ec8n1u1gozD3MhYodjAKQwinFOddzgOj3Tr0QtKogshK8wK0uuUTgwKDW0LpGNdnay dgaTdKO08o14yeKxeX5GmT8KDKd3/v+iUa7H1Yx3zTGHVerKedwUi2hUdvTTK/JfBWWV XzRxj1D0HCLq/W3c1IraGfrdtQYjOWWdR2v3OzcagDY2NMREP3RRaXMrtkKJ0uk//y2l +Upg== 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:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=YyZ9aOBy3xEPn8ar5OCwAgBF+6zT9UOQnJLuuTKseSA=; b=BdFgc1Sc4zZ9C9y42uDFU5FOF+U3+Eq9kphHH/M18t2USf/7ixD5OFjsqTUv2F+ovf 343bLqSNICaTg6jHFWEdoiOMwnNbDGb+2W7KYqxPb1LX/bLvKVpC6CEnCDDOV6ey6wry 9tmLcbRdc2vqiR5+XAGPBMk4cXGTL/fDFIec3aXDTT2RUk65/wxP8ZMMu6gBuHIy2ffW 8mlqbF5vVtKf6FHVTlDwpITIXKcvDheL1bGGYikEHMakcVWK/oFweUA1K4FXGcelBv+O duRHg4Na3f/T6MXtM2bhvyPsITonEykGmldebA3pllJeeM7zt15ZfdHVLOW7unQn1JcM G9qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ctmdv6a5; 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 w1-v6si14340646ply.425.2018.05.28.09.26.22; Mon, 28 May 2018 09:26: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=pass header.i=@kernel.org header.s=default header.b=ctmdv6a5; 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 S1425348AbeE1QZx (ORCPT + 99 others); Mon, 28 May 2018 12:25:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:58932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933824AbeE1KKn (ORCPT ); Mon, 28 May 2018 06:10:43 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D3285208AD; Mon, 28 May 2018 10:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502243; bh=qSgwjUMchPBrp0auazLFCMhsdo2Kt2AITk6bsV4lw5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ctmdv6a5nA3QzH2RZuU8g7qGNy1QAIICc7X12F3hpk3/W+KsbJ5WdRKSsGxU1ghtP 3pU9MTPkNolCe0XkVmmXtZTS8X3cdI4aGSSN9jvIXZLdM3Fhxjfzv5ftUAP9uNVsG7 POUOrwu36jwTpuJy8peWDNpSpA7wwehCsqg3+5cY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Esben Haabendal , Andrew Lunn , "David S. Miller" , Sasha Levin Subject: [PATCH 3.18 115/185] dp83640: Ensure against premature access to PHY registers after reset Date: Mon, 28 May 2018 12:02:36 +0200 Message-Id: <20180528100101.671047677@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100050.700971285@linuxfoundation.org> References: <20180528100050.700971285@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Esben Haabendal [ Upstream commit 76327a35caabd1a932e83d6a42b967aa08584e5d ] The datasheet specifies a 3uS pause after performing a software reset. The default implementation of genphy_soft_reset() does not provide this, so implement soft_reset with the needed pause. Signed-off-by: Esben Haabendal Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/dp83640.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c @@ -1173,6 +1173,23 @@ static void dp83640_remove(struct phy_de 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; @@ -1470,6 +1487,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, .config_aneg = genphy_config_aneg, .read_status = genphy_read_status,