mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] phy: call adjust_link in attach if using fixed-link
@ 2018-10-15 15:00 Clément Leger
  2018-10-16  6:56 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Clément Leger @ 2018-10-15 15:00 UTC (permalink / raw)
  To: Barebox List

Normally, phy_update_status is in charge of reporting a change in link
status when phy is updated. When using fixed-link, speed and duplex are
initialized directly after registering the phy and there is no driver.
Hence when phy_update_status is called, the check for new values fails
and returns directly. Since update_link call is mandatory for some
network devices to work, call it directly when using fixed link in
phy_device_attach to force update of link.

Signed-off-by: Clement Leger <clement.leger@kalray.eu>
---
 drivers/net/phy/phy.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 42dcad906..63f249fcf 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -398,6 +398,10 @@ static int phy_device_attach(struct phy_device *phy, struct eth_device *edev,
 
 	phy->adjust_link = adjust_link;
 
+	/* If the phy is a fixed-link, then call adjust_link directly */
+	if (!phy->bus && adjust_link)
+		adjust_link(edev);
+
 	return 0;
 }
 
-- 
2.15.0.276.g89ea799

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

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

* Re: [PATCH] phy: call adjust_link in attach if using fixed-link
  2018-10-15 15:00 [PATCH] phy: call adjust_link in attach if using fixed-link Clément Leger
@ 2018-10-16  6:56 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2018-10-16  6:56 UTC (permalink / raw)
  To: Clément Leger; +Cc: Barebox List

On Mon, Oct 15, 2018 at 05:00:04PM +0200, Clément Leger wrote:
> Normally, phy_update_status is in charge of reporting a change in link
> status when phy is updated. When using fixed-link, speed and duplex are
> initialized directly after registering the phy and there is no driver.
> Hence when phy_update_status is called, the check for new values fails
> and returns directly. Since update_link call is mandatory for some
> network devices to work, call it directly when using fixed link in
> phy_device_attach to force update of link.
> 
> Signed-off-by: Clement Leger <clement.leger@kalray.eu>
> ---
>  drivers/net/phy/phy.c | 4 ++++
>  1 file changed, 4 insertions(+)

Indeed, sounds logical. Applied, thanks

Sascha

> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 42dcad906..63f249fcf 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -398,6 +398,10 @@ static int phy_device_attach(struct phy_device *phy, struct eth_device *edev,
>  
>  	phy->adjust_link = adjust_link;
>  
> +	/* If the phy is a fixed-link, then call adjust_link directly */
> +	if (!phy->bus && adjust_link)
> +		adjust_link(edev);
> +
>  	return 0;
>  }
>  
> -- 
> 2.15.0.276.g89ea799
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 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] 2+ messages in thread

end of thread, other threads:[~2018-10-16  6:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 15:00 [PATCH] phy: call adjust_link in attach if using fixed-link Clément Leger
2018-10-16  6:56 ` Sascha Hauer

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