From patchwork Tue Apr 14 18:30:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King \(Oracle\)" X-Patchwork-Id: 221178 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC488C2BA19 for ; Tue, 14 Apr 2020 18:30:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8ABA620575 for ; Tue, 14 Apr 2020 18:30:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="TuP2v5v0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504005AbgDNSas (ORCPT ); Tue, 14 Apr 2020 14:30:48 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:46038 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503999AbgDNSac (ORCPT ); Tue, 14 Apr 2020 14:30:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hRefF663gYyMM9y5ZQi2t6V9ZOyP1j89f1rq/HtrMLQ=; b=TuP2v5v0q7zCDva4dhjegsxQ6F POoNNYL6sk8/X9Hek5J6aNbNGOPmv98Rtk7KP8Kn6BzoW0fltUzfiJ5vSNED1HLZpR53VIfS0YSA6 wcWaa1HDoA6LtTRa67cmgGk5HlNxbsu6VzZ3QkIagQB9nfnD6VKhQiu9XgYDikx6fxXtkff7V2P6v Pb9WkJ5fGIw+cDN2YaydZdJ1tUaxlEsgu9EUfeA3Jax6o2CBR5Pt6A+wCZKY9d4UOWzw7q/1YxfrA RxH6GhZpLHmtPK4/kCRMEJrh81AOWCWzlDFxNg8XTVFpcqhVGcty2bs6IeLyniWuc9oRLR34TSyU4 DMVA+B7g==; Received: from e0022681537dd.dyn.armlinux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:52796 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jOQKD-0001Px-Su; Tue, 14 Apr 2020 19:30:22 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1jOQKC-0001WS-OW; Tue, 14 Apr 2020 19:30:20 +0100 In-Reply-To: <20200414182935.GY25745@shell.armlinux.org.uk> References: <20200414182935.GY25745@shell.armlinux.org.uk> From: Russell King To: Andrew Lunn , Florian Fainelli , Heiner Kallweit Cc: Matteo Croce , "David S. Miller" , netdev@vger.kernel.org Subject: [PATCH net 2/2] net: marvell10g: soft-reset the PHY when coming out of low power MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 14 Apr 2020 19:30:20 +0100 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Soft-reset the PHY when coming out of low power mode, which seems to be necessary with firmware versions 0.3.3.0 and 0.3.10.0. This depends on ("net: marvell10g: report firmware version") Fixes: c9cc1c815d36 ("net: phy: marvell10g: place in powersave mode at probe") Reported-by: Matteo Croce Tested-by: Matteo Croce Signed-off-by: Russell King --- drivers/net/phy/marvell10g.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index ee60417cdc55..5865b563cc94 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -75,7 +75,8 @@ enum { /* Vendor2 MMD registers */ MV_V2_PORT_CTRL = 0xf001, - MV_V2_PORT_CTRL_PWRDOWN = 0x0800, + MV_V2_PORT_CTRL_SWRST = BIT(15), + MV_V2_PORT_CTRL_PWRDOWN = BIT(11), MV_V2_TEMP_CTRL = 0xf08a, MV_V2_TEMP_CTRL_MASK = 0xc000, MV_V2_TEMP_CTRL_SAMPLE = 0x0000, @@ -239,8 +240,19 @@ static int mv3310_power_down(struct phy_device *phydev) static int mv3310_power_up(struct phy_device *phydev) { - return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL, - MV_V2_PORT_CTRL_PWRDOWN); + struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); + int ret; + + ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL, + MV_V2_PORT_CTRL_PWRDOWN); + + if (priv->firmware_ver < 0x00030000) + return ret; + + ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL, + MV_V2_PORT_CTRL_SWRST); + + return ret; } static int mv3310_reset(struct phy_device *phydev, u32 unit)