netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net: lantiq: Wait for the GPHY firmware to be ready
@ 2020-11-15 16:57 Martin Blumenstingl
  2020-11-15 17:07 ` Hauke Mehrtens
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Martin Blumenstingl @ 2020-11-15 16:57 UTC (permalink / raw)
  To: hauke, netdev
  Cc: andrew, vivien.didelot, f.fainelli, olteanv, davem, kuba,
	linux-kernel, Martin Blumenstingl

A user reports (slightly shortened from the original message):
  libphy: lantiq,xrx200-mdio: probed
  mdio_bus 1e108000.switch-mii: MDIO device at address 17 is missing.
  gswip 1e108000.switch lan: no phy at 2
  gswip 1e108000.switch lan: failed to connect to port 2: -19
  lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy

This is a single-port board using the internal Fast Ethernet PHY. The
user reports that switching to PHY scanning instead of configuring the
PHY within device-tree works around this issue.

The documentation for the standalone variant of the PHY11G (which is
probably very similar to what is used inside the xRX200 SoCs but having
the firmware burnt onto that standalone chip in the factory) states that
the PHY needs 300ms to be ready for MDIO communication after releasing
the reset.

Add a 300ms delay after initializing all GPHYs to ensure that the GPHY
firmware had enough time to initialize and to appear on the MDIO bus.
Unfortunately there is no (known) documentation on what the minimum time
to wait after releasing the reset on an internal PHY so play safe and
take the one for the external variant. Only wait after the last GPHY
firmware is loaded to not slow down the initialization too much (
xRX200 has two GPHYs but newer SoCs have at least three GPHYs).

Fixes: 14fceff4771e51 ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
Changes since v1:
- move the msleep() closer to the actual loop over all GPHY instances
  as suggested by Andrew
- added Andrew's Reviewed-by (thank you!)


 drivers/net/dsa/lantiq_gswip.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
index 74db81dafee3..09701c17f3f6 100644
--- a/drivers/net/dsa/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq_gswip.c
@@ -26,6 +26,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/delay.h>
 #include <linux/etherdevice.h>
 #include <linux/firmware.h>
 #include <linux/if_bridge.h>
@@ -1837,6 +1838,16 @@ static int gswip_gphy_fw_list(struct gswip_priv *priv,
 		i++;
 	}
 
+	/* The standalone PHY11G requires 300ms to be fully
+	 * initialized and ready for any MDIO communication after being
+	 * taken out of reset. For the SoC-internal GPHY variant there
+	 * is no (known) documentation for the minimum time after a
+	 * reset. Use the same value as for the standalone variant as
+	 * some users have reported internal PHYs not being detected
+	 * without any delay.
+	 */
+	msleep(300);
+
 	return 0;
 
 remove_gphy:
-- 
2.29.2


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

* Re: [PATCH v2] net: lantiq: Wait for the GPHY firmware to be ready
  2020-11-15 16:57 [PATCH v2] net: lantiq: Wait for the GPHY firmware to be ready Martin Blumenstingl
@ 2020-11-15 17:07 ` Hauke Mehrtens
  2020-11-16  2:57 ` Florian Fainelli
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2020-11-15 17:07 UTC (permalink / raw)
  To: Martin Blumenstingl, netdev
  Cc: andrew, vivien.didelot, f.fainelli, olteanv, davem, kuba, linux-kernel


[-- Attachment #1.1.1: Type: text/plain, Size: 2974 bytes --]

On 11/15/20 5:57 PM, Martin Blumenstingl wrote:
> A user reports (slightly shortened from the original message):
>    libphy: lantiq,xrx200-mdio: probed
>    mdio_bus 1e108000.switch-mii: MDIO device at address 17 is missing.
>    gswip 1e108000.switch lan: no phy at 2
>    gswip 1e108000.switch lan: failed to connect to port 2: -19
>    lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
> 
> This is a single-port board using the internal Fast Ethernet PHY. The
> user reports that switching to PHY scanning instead of configuring the
> PHY within device-tree works around this issue.
> 
> The documentation for the standalone variant of the PHY11G (which is
> probably very similar to what is used inside the xRX200 SoCs but having
> the firmware burnt onto that standalone chip in the factory) states that
> the PHY needs 300ms to be ready for MDIO communication after releasing
> the reset.
> 
> Add a 300ms delay after initializing all GPHYs to ensure that the GPHY
> firmware had enough time to initialize and to appear on the MDIO bus.
> Unfortunately there is no (known) documentation on what the minimum time
> to wait after releasing the reset on an internal PHY so play safe and
> take the one for the external variant. Only wait after the last GPHY
> firmware is loaded to not slow down the initialization too much (
> xRX200 has two GPHYs but newer SoCs have at least three GPHYs).
> 
> Fixes: 14fceff4771e51 ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Acked-by: Hauke Mehrtens <hauke@hauke-m.de>

> ---
> Changes since v1:
> - move the msleep() closer to the actual loop over all GPHY instances
>    as suggested by Andrew
> - added Andrew's Reviewed-by (thank you!)
> 
> 
>   drivers/net/dsa/lantiq_gswip.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
> index 74db81dafee3..09701c17f3f6 100644
> --- a/drivers/net/dsa/lantiq_gswip.c
> +++ b/drivers/net/dsa/lantiq_gswip.c
> @@ -26,6 +26,7 @@
>    */
>   
>   #include <linux/clk.h>
> +#include <linux/delay.h>
>   #include <linux/etherdevice.h>
>   #include <linux/firmware.h>
>   #include <linux/if_bridge.h>
> @@ -1837,6 +1838,16 @@ static int gswip_gphy_fw_list(struct gswip_priv *priv,
>   		i++;
>   	}
>   
> +	/* The standalone PHY11G requires 300ms to be fully
> +	 * initialized and ready for any MDIO communication after being
> +	 * taken out of reset. For the SoC-internal GPHY variant there
> +	 * is no (known) documentation for the minimum time after a
> +	 * reset. Use the same value as for the standalone variant as
> +	 * some users have reported internal PHYs not being detected
> +	 * without any delay.
> +	 */
> +	msleep(300);
> +
>   	return 0;
>   
>   remove_gphy:
> 


[-- Attachment #1.1.2: OpenPGP_0x93DD20630910B515.asc --]
[-- Type: application/pgp-keys, Size: 10027 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v2] net: lantiq: Wait for the GPHY firmware to be ready
  2020-11-15 16:57 [PATCH v2] net: lantiq: Wait for the GPHY firmware to be ready Martin Blumenstingl
  2020-11-15 17:07 ` Hauke Mehrtens
@ 2020-11-16  2:57 ` Florian Fainelli
  2020-11-16 14:38 ` Andrew Lunn
  2020-11-16 21:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2020-11-16  2:57 UTC (permalink / raw)
  To: Martin Blumenstingl, hauke, netdev
  Cc: andrew, vivien.didelot, olteanv, davem, kuba, linux-kernel



On 11/15/2020 8:57 AM, Martin Blumenstingl wrote:
> A user reports (slightly shortened from the original message):
>   libphy: lantiq,xrx200-mdio: probed
>   mdio_bus 1e108000.switch-mii: MDIO device at address 17 is missing.
>   gswip 1e108000.switch lan: no phy at 2
>   gswip 1e108000.switch lan: failed to connect to port 2: -19
>   lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
> 
> This is a single-port board using the internal Fast Ethernet PHY. The
> user reports that switching to PHY scanning instead of configuring the
> PHY within device-tree works around this issue.
> 
> The documentation for the standalone variant of the PHY11G (which is
> probably very similar to what is used inside the xRX200 SoCs but having
> the firmware burnt onto that standalone chip in the factory) states that
> the PHY needs 300ms to be ready for MDIO communication after releasing
> the reset.
> 
> Add a 300ms delay after initializing all GPHYs to ensure that the GPHY
> firmware had enough time to initialize and to appear on the MDIO bus.
> Unfortunately there is no (known) documentation on what the minimum time
> to wait after releasing the reset on an internal PHY so play safe and
> take the one for the external variant. Only wait after the last GPHY
> firmware is loaded to not slow down the initialization too much (
> xRX200 has two GPHYs but newer SoCs have at least three GPHYs).
> 
> Fixes: 14fceff4771e51 ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH v2] net: lantiq: Wait for the GPHY firmware to be ready
  2020-11-15 16:57 [PATCH v2] net: lantiq: Wait for the GPHY firmware to be ready Martin Blumenstingl
  2020-11-15 17:07 ` Hauke Mehrtens
  2020-11-16  2:57 ` Florian Fainelli
@ 2020-11-16 14:38 ` Andrew Lunn
  2020-11-16 21:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2020-11-16 14:38 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: hauke, netdev, vivien.didelot, f.fainelli, olteanv, davem, kuba,
	linux-kernel

On Sun, Nov 15, 2020 at 05:57:57PM +0100, Martin Blumenstingl wrote:
> A user reports (slightly shortened from the original message):
>   libphy: lantiq,xrx200-mdio: probed
>   mdio_bus 1e108000.switch-mii: MDIO device at address 17 is missing.
>   gswip 1e108000.switch lan: no phy at 2
>   gswip 1e108000.switch lan: failed to connect to port 2: -19
>   lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
> 
> This is a single-port board using the internal Fast Ethernet PHY. The
> user reports that switching to PHY scanning instead of configuring the
> PHY within device-tree works around this issue.
> 
> The documentation for the standalone variant of the PHY11G (which is
> probably very similar to what is used inside the xRX200 SoCs but having
> the firmware burnt onto that standalone chip in the factory) states that
> the PHY needs 300ms to be ready for MDIO communication after releasing
> the reset.
> 
> Add a 300ms delay after initializing all GPHYs to ensure that the GPHY
> firmware had enough time to initialize and to appear on the MDIO bus.
> Unfortunately there is no (known) documentation on what the minimum time
> to wait after releasing the reset on an internal PHY so play safe and
> take the one for the external variant. Only wait after the last GPHY
> firmware is loaded to not slow down the initialization too much (
> xRX200 has two GPHYs but newer SoCs have at least three GPHYs).
> 
> Fixes: 14fceff4771e51 ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH v2] net: lantiq: Wait for the GPHY firmware to be ready
  2020-11-15 16:57 [PATCH v2] net: lantiq: Wait for the GPHY firmware to be ready Martin Blumenstingl
                   ` (2 preceding siblings ...)
  2020-11-16 14:38 ` Andrew Lunn
@ 2020-11-16 21:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-11-16 21:50 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: hauke, netdev, andrew, vivien.didelot, f.fainelli, olteanv,
	davem, kuba, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Sun, 15 Nov 2020 17:57:57 +0100 you wrote:
> A user reports (slightly shortened from the original message):
>   libphy: lantiq,xrx200-mdio: probed
>   mdio_bus 1e108000.switch-mii: MDIO device at address 17 is missing.
>   gswip 1e108000.switch lan: no phy at 2
>   gswip 1e108000.switch lan: failed to connect to port 2: -19
>   lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
> 
> [...]

Here is the summary with links:
  - [v2] net: lantiq: Wait for the GPHY firmware to be ready
    https://git.kernel.org/netdev/net/c/2a1828e378c1

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2020-11-16 21:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-15 16:57 [PATCH v2] net: lantiq: Wait for the GPHY firmware to be ready Martin Blumenstingl
2020-11-15 17:07 ` Hauke Mehrtens
2020-11-16  2:57 ` Florian Fainelli
2020-11-16 14:38 ` Andrew Lunn
2020-11-16 21:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).