mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v1] net: designware: eqos: fix link speed configuration for speed < 1000
@ 2022-04-13 12:37 Oleksij Rempel
  2022-04-13 13:54 ` Ahmad Fatoum
  0 siblings, 1 reply; 3+ messages in thread
From: Oleksij Rempel @ 2022-04-13 12:37 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

Put phy_device_connect() after MAC/DMA reset, otherwise link speed
configuration will be zeroed by the MAC/DMA reset. By an accident zero
configuration equal to the speed 1000, so it was still working for many users.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/designware_eqos.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/designware_eqos.c b/drivers/net/designware_eqos.c
index 6b372e4274..d93cccd634 100644
--- a/drivers/net/designware_eqos.c
+++ b/drivers/net/designware_eqos.c
@@ -390,11 +390,6 @@ static int eqos_start(struct eth_device *edev)
 	int ret;
 	int i;
 
-	ret = phy_device_connect(edev, &eqos->miibus, eqos->phy_addr,
-				 eqos->ops->adjust_link, 0, eqos->interface);
-	if (ret)
-		return ret;
-
 	setbits_le32(&eqos->dma_regs->mode, EQOS_DMA_MODE_SWR);
 
 	ret = readl_poll_timeout(&eqos->dma_regs->mode, mode_set,
@@ -405,6 +400,11 @@ static int eqos_start(struct eth_device *edev)
 		return ret;
 	}
 
+	ret = phy_device_connect(edev, &eqos->miibus, eqos->phy_addr,
+				 eqos->ops->adjust_link, 0, eqos->interface);
+	if (ret)
+		return ret;
+
 	/* Reset above clears MAC address */
 	eqos_set_ethaddr(edev, eqos->macaddr);
 
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] net: designware: eqos: fix link speed configuration for speed < 1000
  2022-04-13 12:37 [PATCH v1] net: designware: eqos: fix link speed configuration for speed < 1000 Oleksij Rempel
@ 2022-04-13 13:54 ` Ahmad Fatoum
  2022-04-14  4:48   ` Oleksij Rempel
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2022-04-13 13:54 UTC (permalink / raw)
  To: Oleksij Rempel, barebox, Lucas Stach

Hello Oleksij,

On 13.04.22 14:37, Oleksij Rempel wrote:
> Put phy_device_connect() after MAC/DMA reset, otherwise link speed
> configuration will be zeroed by the MAC/DMA reset. By an accident zero
> configuration equal to the speed 1000, so it was still working for many users.

This hunk used to be farther down, but Lucas moved it in
7c5c6561f0ca ("net: designware: eqos: attach PHY earlier").

I suspect your patch might break his hardware configuration.

Cheers,
Ahmad

> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  drivers/net/designware_eqos.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/designware_eqos.c b/drivers/net/designware_eqos.c
> index 6b372e4274..d93cccd634 100644
> --- a/drivers/net/designware_eqos.c
> +++ b/drivers/net/designware_eqos.c
> @@ -390,11 +390,6 @@ static int eqos_start(struct eth_device *edev)
>  	int ret;
>  	int i;
>  
> -	ret = phy_device_connect(edev, &eqos->miibus, eqos->phy_addr,
> -				 eqos->ops->adjust_link, 0, eqos->interface);
> -	if (ret)
> -		return ret;
> -
>  	setbits_le32(&eqos->dma_regs->mode, EQOS_DMA_MODE_SWR);
>  
>  	ret = readl_poll_timeout(&eqos->dma_regs->mode, mode_set,
> @@ -405,6 +400,11 @@ static int eqos_start(struct eth_device *edev)
>  		return ret;
>  	}
>  
> +	ret = phy_device_connect(edev, &eqos->miibus, eqos->phy_addr,
> +				 eqos->ops->adjust_link, 0, eqos->interface);
> +	if (ret)
> +		return ret;
> +
>  	/* Reset above clears MAC address */
>  	eqos_set_ethaddr(edev, eqos->macaddr);
>  


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] net: designware: eqos: fix link speed configuration for speed < 1000
  2022-04-13 13:54 ` Ahmad Fatoum
@ 2022-04-14  4:48   ` Oleksij Rempel
  0 siblings, 0 replies; 3+ messages in thread
From: Oleksij Rempel @ 2022-04-14  4:48 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Lucas Stach

On Wed, Apr 13, 2022 at 03:54:54PM +0200, Ahmad Fatoum wrote:
> Hello Oleksij,
> 
> On 13.04.22 14:37, Oleksij Rempel wrote:
> > Put phy_device_connect() after MAC/DMA reset, otherwise link speed
> > configuration will be zeroed by the MAC/DMA reset. By an accident zero
> > configuration equal to the speed 1000, so it was still working for many users.
> 
> This hunk used to be farther down, but Lucas moved it in
> 7c5c6561f0ca ("net: designware: eqos: attach PHY earlier").
> 
> I suspect your patch might break his hardware configuration.

Hm, interesting. I'll send a new version.

> Cheers,
> Ahmad
> 
> > 
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > ---
> >  drivers/net/designware_eqos.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/net/designware_eqos.c b/drivers/net/designware_eqos.c
> > index 6b372e4274..d93cccd634 100644
> > --- a/drivers/net/designware_eqos.c
> > +++ b/drivers/net/designware_eqos.c
> > @@ -390,11 +390,6 @@ static int eqos_start(struct eth_device *edev)
> >  	int ret;
> >  	int i;
> >  
> > -	ret = phy_device_connect(edev, &eqos->miibus, eqos->phy_addr,
> > -				 eqos->ops->adjust_link, 0, eqos->interface);
> > -	if (ret)
> > -		return ret;
> > -
> >  	setbits_le32(&eqos->dma_regs->mode, EQOS_DMA_MODE_SWR);
> >  
> >  	ret = readl_poll_timeout(&eqos->dma_regs->mode, mode_set,
> > @@ -405,6 +400,11 @@ static int eqos_start(struct eth_device *edev)
> >  		return ret;
> >  	}
> >  
> > +	ret = phy_device_connect(edev, &eqos->miibus, eqos->phy_addr,
> > +				 eqos->ops->adjust_link, 0, eqos->interface);
> > +	if (ret)
> > +		return ret;
> > +
> >  	/* Reset above clears MAC address */
> >  	eqos_set_ethaddr(edev, eqos->macaddr);
> >  
> 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-14  4:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13 12:37 [PATCH v1] net: designware: eqos: fix link speed configuration for speed < 1000 Oleksij Rempel
2022-04-13 13:54 ` Ahmad Fatoum
2022-04-14  4:48   ` Oleksij Rempel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox