From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 2E0C1C47080 for ; Sun, 23 May 2021 22:18:28 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8B7E861152 for ; Sun, 23 May 2021 22:18:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B7E861152 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=posteo.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BEC8482E21; Mon, 24 May 2021 00:18:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=posteo.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=posteo.net header.i=@posteo.net header.b="H4BHBDCg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 42E0B82E2B; Mon, 24 May 2021 00:18:22 +0200 (CEST) Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3B4FD82D6E for ; Mon, 24 May 2021 00:18:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=posteo.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=daniil.stas@posteo.net Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id A0FFA2400FC for ; Mon, 24 May 2021 00:18:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1621808298; bh=u59eENCpviKwX0/Pk49Mu6yQw2dde9drWU05hAA6H0Y=; h=From:To:Cc:Subject:Date:From; b=H4BHBDCgzS1bsiNBV6FXNgqis0LK2lhIUY+DIw9D7B/jDUVHBoW2qz3wOA+pC/C84 730kP7kwmixQ7Wpw+HIx1BFxonp1//UzX8+CXLJTx5UmrA8VJhTMs/St6P327n4HdD 1v4PDkZdXDWsYT/9ZBaQZOy3gyJ2sBe52ZXd71MrpmQA657ZU5Z0RqZNIWRxRKE2jf TxmX2r8h+h0JUebyYc52YMKzQmGC+n7hIV1cZLepnhsTTS906XCib6AOoUCa8kHffj bNVcXTXzeLKcMMrDW13ja71BucDt0ManCW8TX7XzP4Ui7gQROsqnepmuGTkKfpiyZs qJnEm0gPwYqvw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FpF950lZlz9rxP; Mon, 24 May 2021 00:18:17 +0200 (CEST) From: Daniil Stas To: u-boot@lists.denx.de Cc: Daniil Stas , Ramon Fried , Joe Hershberger , Patrick Delaunay , Patrice Chotard Subject: [PATCH] net: dwc_eth_qos: Fix needless phy auto-negotiation restarts Date: Sun, 23 May 2021 22:24:48 +0000 Message-Id: <20210523222449.1495352-1-daniil.stas@posteo.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Disabling clk_ck clock leads to link up status loss in phy, which leads to auto-negotiation restart before each network command execution. This issue is especially big for PXE boot protocol because of auto-negotiation restarts before each configuration filename trial. To avoid this issue don't disable clk_ck clock after it was enabled. Signed-off-by: Daniil Stas Cc: Ramon Fried Cc: Joe Hershberger Cc: Patrick Delaunay Cc: Patrice Chotard --- drivers/net/dwc_eth_qos.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index e8242ca4e1..2f088c758f 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -321,6 +321,7 @@ struct eqos_priv { void *rx_pkt; bool started; bool reg_access_ok; + bool clk_ck_enabled; }; /* @@ -591,12 +592,13 @@ static int eqos_start_clks_stm32(struct udevice *dev) goto err_disable_clk_rx; } - if (clk_valid(&eqos->clk_ck)) { + if (clk_valid(&eqos->clk_ck) && !eqos->clk_ck_enabled) { ret = clk_enable(&eqos->clk_ck); if (ret < 0) { pr_err("clk_enable(clk_ck) failed: %d", ret); goto err_disable_clk_tx; } + eqos->clk_ck_enabled = true; } #endif @@ -648,8 +650,6 @@ static void eqos_stop_clks_stm32(struct udevice *dev) clk_disable(&eqos->clk_tx); clk_disable(&eqos->clk_rx); clk_disable(&eqos->clk_master_bus); - if (clk_valid(&eqos->clk_ck)) - clk_disable(&eqos->clk_ck); #endif debug("%s: OK\n", __func__); -- 2.31.0