linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: lantiq_gswip: Let GSWIP automatically set the xMII clock
@ 2021-03-24 19:36 Martin Blumenstingl
  2021-03-25 18:09 ` Florian Fainelli
  2021-03-26  0:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Blumenstingl @ 2021-03-24 19:36 UTC (permalink / raw)
  To: hauke, netdev
  Cc: linux-kernel, andrew, vivien.didelot, f.fainelli, olteanv, davem,
	kuba, Martin Blumenstingl

The xMII interface clock depends on the PHY interface (MII, RMII, RGMII)
as well as the current link speed. Explicitly configure the GSWIP to
automatically select the appropriate xMII interface clock.

This fixes an issue seen by some users where ports using an external
RMII or RGMII PHY were deaf (no RX or TX traffic could be seen). Most
likely this is due to an "invalid" xMII clock being selected either by
the bootloader or hardware-defaults.

Fixes: 14fceff4771e51 ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
It would be great to have this fix backported to Linux 5.4 and 5.10 to
get rid of one more blocker which prevents OpenWrt from switching to
this new in-tree driver.


 drivers/net/dsa/lantiq_gswip.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
index 52e865a3912c..809dfa3be6bb 100644
--- a/drivers/net/dsa/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq_gswip.c
@@ -799,10 +799,15 @@ static int gswip_setup(struct dsa_switch *ds)
 	/* Configure the MDIO Clock 2.5 MHz */
 	gswip_mdio_mask(priv, 0xff, 0x09, GSWIP_MDIO_MDC_CFG1);
 
-	/* Disable the xMII link */
-	for (i = 0; i < priv->hw_info->max_ports; i++)
+	for (i = 0; i < priv->hw_info->max_ports; i++) {
+		/* Disable the xMII link */
 		gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, i);
 
+		/* Automatically select the xMII interface clock */
+		gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_RATE_MASK,
+				   GSWIP_MII_CFG_RATE_AUTO, i);
+	}
+
 	/* enable special tag insertion on cpu port */
 	gswip_switch_mask(priv, 0, GSWIP_FDMA_PCTRL_STEN,
 			  GSWIP_FDMA_PCTRLp(cpu_port));
-- 
2.31.0


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

* Re: [PATCH net] net: dsa: lantiq_gswip: Let GSWIP automatically set the xMII clock
  2021-03-24 19:36 [PATCH net] net: dsa: lantiq_gswip: Let GSWIP automatically set the xMII clock Martin Blumenstingl
@ 2021-03-25 18:09 ` Florian Fainelli
  2021-03-25 18:31   ` Martin Blumenstingl
  2021-03-26  0:30 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2021-03-25 18:09 UTC (permalink / raw)
  To: Martin Blumenstingl, hauke, netdev
  Cc: linux-kernel, andrew, vivien.didelot, olteanv, davem, kuba



On 3/24/2021 12:36 PM, Martin Blumenstingl wrote:
> The xMII interface clock depends on the PHY interface (MII, RMII, RGMII)
> as well as the current link speed. Explicitly configure the GSWIP to
> automatically select the appropriate xMII interface clock.
> 
> This fixes an issue seen by some users where ports using an external
> RMII or RGMII PHY were deaf (no RX or TX traffic could be seen). Most
> likely this is due to an "invalid" xMII clock being selected either by
> the bootloader or hardware-defaults.
> 
> Fixes: 14fceff4771e51 ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

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

> ---
> It would be great to have this fix backported to Linux 5.4 and 5.10 to
> get rid of one more blocker which prevents OpenWrt from switching to
> this new in-tree driver.

Given there is a Fixes: tag this should land at some point in the stable
tree auto-selection. Stable fixes for networking patches follows a
slightly different path:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/netdev-FAQ.rst#n145

> 
> 
>  drivers/net/dsa/lantiq_gswip.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
> index 52e865a3912c..809dfa3be6bb 100644
> --- a/drivers/net/dsa/lantiq_gswip.c
> +++ b/drivers/net/dsa/lantiq_gswip.c
> @@ -799,10 +799,15 @@ static int gswip_setup(struct dsa_switch *ds)
>  	/* Configure the MDIO Clock 2.5 MHz */
>  	gswip_mdio_mask(priv, 0xff, 0x09, GSWIP_MDIO_MDC_CFG1);
>  
> -	/* Disable the xMII link */
> -	for (i = 0; i < priv->hw_info->max_ports; i++)
> +	for (i = 0; i < priv->hw_info->max_ports; i++) {
> +		/* Disable the xMII link */
>  		gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, i);
>  
> +		/* Automatically select the xMII interface clock */
> +		gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_RATE_MASK,
> +				   GSWIP_MII_CFG_RATE_AUTO, i);
> +	}
> +
>  	/* enable special tag insertion on cpu port */
>  	gswip_switch_mask(priv, 0, GSWIP_FDMA_PCTRL_STEN,
>  			  GSWIP_FDMA_PCTRLp(cpu_port));
> 

-- 
Florian

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

* Re: [PATCH net] net: dsa: lantiq_gswip: Let GSWIP automatically set the xMII clock
  2021-03-25 18:09 ` Florian Fainelli
@ 2021-03-25 18:31   ` Martin Blumenstingl
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Blumenstingl @ 2021-03-25 18:31 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Hauke Mehrtens, netdev, linux-kernel, andrew, vivien.didelot,
	olteanv, davem, kuba

Hi Florian,

On Thu, Mar 25, 2021 at 7:09 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
[...]
> > It would be great to have this fix backported to Linux 5.4 and 5.10 to
> > get rid of one more blocker which prevents OpenWrt from switching to
> > this new in-tree driver.
>
> Given there is a Fixes: tag this should land at some point in the stable
> tree auto-selection. Stable fixes for networking patches follows a
> slightly different path:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/netdev-FAQ.rst#n145
thank you very much for this link - I missed the news that net patches
should now also be Cc'ed to linux-stable
I think this simplifies the process (at least for me as contributor)

Also thank you for the Reviewed-by!


Best regards,
Martin

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

* Re: [PATCH net] net: dsa: lantiq_gswip: Let GSWIP automatically set the xMII clock
  2021-03-24 19:36 [PATCH net] net: dsa: lantiq_gswip: Let GSWIP automatically set the xMII clock Martin Blumenstingl
  2021-03-25 18:09 ` Florian Fainelli
@ 2021-03-26  0:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-26  0:30 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: hauke, netdev, linux-kernel, andrew, vivien.didelot, f.fainelli,
	olteanv, davem, kuba

Hello:

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

On Wed, 24 Mar 2021 20:36:04 +0100 you wrote:
> The xMII interface clock depends on the PHY interface (MII, RMII, RGMII)
> as well as the current link speed. Explicitly configure the GSWIP to
> automatically select the appropriate xMII interface clock.
> 
> This fixes an issue seen by some users where ports using an external
> RMII or RGMII PHY were deaf (no RX or TX traffic could be seen). Most
> likely this is due to an "invalid" xMII clock being selected either by
> the bootloader or hardware-defaults.
> 
> [...]

Here is the summary with links:
  - [net] net: dsa: lantiq_gswip: Let GSWIP automatically set the xMII clock
    https://git.kernel.org/netdev/net/c/3e6fdeb28f4c

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] 4+ messages in thread

end of thread, other threads:[~2021-03-26  0:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 19:36 [PATCH net] net: dsa: lantiq_gswip: Let GSWIP automatically set the xMII clock Martin Blumenstingl
2021-03-25 18:09 ` Florian Fainelli
2021-03-25 18:31   ` Martin Blumenstingl
2021-03-26  0:30 ` 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).