From patchwork Tue Oct 27 13:49:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 311912 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=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 369E3C6369E for ; Tue, 27 Oct 2020 17:46:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D320122400 for ; Tue, 27 Oct 2020 17:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603820788; bh=icR0u3f/LKjxxSFL29ZkQPAijUpINKsZ/b7eanDvc6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ARteMlbGQFntYTuoz3Ii5s1QsVI62ZAWg0bZa0ZIyZPtLnhhmn2nuXhhgFjgnGEeD 5pergo6CnkblT8GdAJFueALkslUPx3qpB/XNNbA7w51ZiV5eo12vT5dbMxu6Dbi2LF 3ZhlNyh3WqL9cEix7Gl379vBKQE6S9rxVh6f95JU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759995AbgJ0Oat (ORCPT ); Tue, 27 Oct 2020 10:30:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:55552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2901896AbgJ0O27 (ORCPT ); Tue, 27 Oct 2020 10:28:59 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 D416322202; Tue, 27 Oct 2020 14:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808939; bh=icR0u3f/LKjxxSFL29ZkQPAijUpINKsZ/b7eanDvc6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=atMKfBFKfS9NioIW3d6YGR1pseUG3O95ArxYr82r6D/VWU3lgXAjqR93sm3SoYAwB rslOtKfHlmispRYurfgz4QQXGh/XMnQNIZhTmXXdGJsrbRMSvl4C0ZYOjJfGc0y4O9 mghwmLxCK9+i92r9pAySeMuz0BMyyvZ7Gge4RzVA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Lunn , Richard Leitner , Marek Vasut , Christoph Niedermaier , "David S. Miller" , NXP Linux Team , Shawn Guo , Jakub Kicinski Subject: [PATCH 5.4 006/408] net: fec: Fix PHY init after phy_reset_after_clk_enable() Date: Tue, 27 Oct 2020 14:49:04 +0100 Message-Id: <20201027135455.337503286@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marek Vasut [ Upstream commit 0da1ccbbefb662915228bc17e1c7d4ad28b3ddab ] The phy_reset_after_clk_enable() does a PHY reset, which means the PHY loses its register settings. The fec_enet_mii_probe() starts the PHY and does the necessary calls to configure the PHY via PHY framework, and loads the correct register settings into the PHY. Therefore, fec_enet_mii_probe() should be called only after the PHY has been reset, not before as it is now. Fixes: 1b0a83ac04e3 ("net: fec: add phy_reset_after_clk_enable() support") Reviewed-by: Andrew Lunn Tested-by: Richard Leitner Signed-off-by: Marek Vasut Cc: Christoph Niedermaier Cc: David S. Miller Cc: NXP Linux Team Cc: Shawn Guo Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/freescale/fec_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3003,17 +3003,17 @@ fec_enet_open(struct net_device *ndev) /* Init MAC prior to mii bus probe */ fec_restart(ndev); - /* Probe and connect to PHY when open the interface */ - ret = fec_enet_mii_probe(ndev); - if (ret) - goto err_enet_mii_probe; - /* Call phy_reset_after_clk_enable() again if it failed during * phy_reset_after_clk_enable() before because the PHY wasn't probed. */ if (reset_again) fec_enet_phy_reset_after_clk_enable(ndev); + /* Probe and connect to PHY when open the interface */ + ret = fec_enet_mii_probe(ndev); + if (ret) + goto err_enet_mii_probe; + if (fep->quirks & FEC_QUIRK_ERR006687) imx6q_cpuidle_fec_irqs_used();