]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: dwc_eth_qos: Fix needless phy auto-negotiation restarts
authorDaniil Stas <daniil.stas@posteo.net>
Sun, 23 May 2021 22:24:48 +0000 (22:24 +0000)
committerRamon Fried <rfried.dev@gmail.com>
Fri, 18 Jun 2021 08:29:17 +0000 (11:29 +0300)
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 <daniil.stas@posteo.net>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
drivers/net/dwc_eth_qos.c

index e8242ca4e1b223a7f4de716e9902d449a70e1878..2f088c758f04ca01f97eeb67e107bafb0016ecf7 100644 (file)
@@ -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__);