Re: [PATCH] net: dwc_eth_qos: Fix needless phy auto-negotiation restarts

2021-06-12 Thread Ramon Fried
On Mon May 24, 2021 at 1:24 AM IDT, Daniil Stas wrote:
> 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(>clk_ck)) {
> + if (clk_valid(>clk_ck) && !eqos->clk_ck_enabled) {
> ret = clk_enable(>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(>clk_tx);
> clk_disable(>clk_rx);
> clk_disable(>clk_master_bus);
> - if (clk_valid(>clk_ck))
> - clk_disable(>clk_ck);
> #endif
>  
> debug("%s: OK\n", __func__);
> --
> 2.31.0

Applied to u-boot-net/master, thanks!

Best regards,
Ramon Fried


Re: [PATCH] net: dwc_eth_qos: Fix needless phy auto-negotiation restarts

2021-06-01 Thread Patrick DELAUNAY

Hi,

On 5/24/21 12:24 AM, Daniil Stas wrote:

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(-)


Reviewed-by: Patrick Delaunay 

Thanks
Patrick



Re: [PATCH] net: dwc_eth_qos: Fix needless phy auto-negotiation restarts

2021-05-25 Thread Ramon Fried
On Mon, May 24, 2021 at 1:18 AM Daniil Stas  wrote:
>
> 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(>clk_ck)) {
> +   if (clk_valid(>clk_ck) && !eqos->clk_ck_enabled) {
> ret = clk_enable(>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(>clk_tx);
> clk_disable(>clk_rx);
> clk_disable(>clk_master_bus);
> -   if (clk_valid(>clk_ck))
> -   clk_disable(>clk_ck);
>  #endif
>
> debug("%s: OK\n", __func__);
> --
> 2.31.0
>
Reviewed-by: Ramon Fried 


Re: [PATCH] net: dwc_eth_qos: Fix needless phy auto-negotiation restarts

2021-05-24 Thread Patrice CHOTARD
Hi Daniil

+Christophe

Thanks
Patrice

On 5/24/21 12:24 AM, Daniil Stas wrote:
> 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(>clk_ck)) {
> + if (clk_valid(>clk_ck) && !eqos->clk_ck_enabled) {
>   ret = clk_enable(>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(>clk_tx);
>   clk_disable(>clk_rx);
>   clk_disable(>clk_master_bus);
> - if (clk_valid(>clk_ck))
> - clk_disable(>clk_ck);
>  #endif
>  
>   debug("%s: OK\n", __func__);
> 


[PATCH] net: dwc_eth_qos: Fix needless phy auto-negotiation restarts

2021-05-23 Thread Daniil Stas
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(>clk_ck)) {
+   if (clk_valid(>clk_ck) && !eqos->clk_ck_enabled) {
ret = clk_enable(>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(>clk_tx);
clk_disable(>clk_rx);
clk_disable(>clk_master_bus);
-   if (clk_valid(>clk_ck))
-   clk_disable(>clk_ck);
 #endif
 
debug("%s: OK\n", __func__);
-- 
2.31.0