linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] net: mt7531: pll & reset fixes
@ 2022-09-17  0:07 Alexander Couzens
  2022-09-17  0:07 ` [PATCH net v2 1/2] net: mt7531: only do PLL once after the reset Alexander Couzens
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Alexander Couzens @ 2022-09-17  0:07 UTC (permalink / raw)
  To: Sean Wang, Landen Chao, DENG Qingfang, Andrew Lunn,
	Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger
  Cc: Alexander Couzens, Landen Chao, netdev, linux-arm-kernel,
	linux-mediatek, linux-kernel

v1 -> v2:
 - commit message: add Fixes: tag
 - add missing target branch in subject

Alexander Couzens (2):
  net: mt7531: only do PLL once after the reset
  net: mt7531: ensure all MACs are powered down before reset

 drivers/net/dsa/mt7530.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

-- 
2.37.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net v2 1/2] net: mt7531: only do PLL once after the reset
  2022-09-17  0:07 [PATCH net v2 0/2] net: mt7531: pll & reset fixes Alexander Couzens
@ 2022-09-17  0:07 ` Alexander Couzens
  2022-09-17  0:07 ` [PATCH net v2 2/2] net: mt7531: ensure all MACs are powered down before reset Alexander Couzens
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Alexander Couzens @ 2022-09-17  0:07 UTC (permalink / raw)
  To: Sean Wang, Landen Chao, DENG Qingfang, Andrew Lunn,
	Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger
  Cc: Alexander Couzens, stable, Landen Chao, netdev, linux-arm-kernel,
	linux-mediatek, linux-kernel

Move the PLL init of the switch out of the pad configuration of the port
6 (usally cpu port).

Fix a unidirectional 100 mbit limitation on 1 gbit or 2.5 gbit links for
outbound traffic on port 5 or port 6.

Fixes: c288575f7810 ("net: dsa: mt7530: Add the support of MT7531 switch")
Cc: stable@vger.kernel.org
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
---
 drivers/net/dsa/mt7530.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 835807911be0..95a57aeb466e 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -506,14 +506,19 @@ static bool mt7531_dual_sgmii_supported(struct mt7530_priv *priv)
 static int
 mt7531_pad_setup(struct dsa_switch *ds, phy_interface_t interface)
 {
-	struct mt7530_priv *priv = ds->priv;
+	return 0;
+}
+
+static void
+mt7531_pll_setup(struct mt7530_priv *priv)
+{
 	u32 top_sig;
 	u32 hwstrap;
 	u32 xtal;
 	u32 val;
 
 	if (mt7531_dual_sgmii_supported(priv))
-		return 0;
+		return;
 
 	val = mt7530_read(priv, MT7531_CREV);
 	top_sig = mt7530_read(priv, MT7531_TOP_SIG_SR);
@@ -592,8 +597,6 @@ mt7531_pad_setup(struct dsa_switch *ds, phy_interface_t interface)
 	val |= EN_COREPLL;
 	mt7530_write(priv, MT7531_PLLGP_EN, val);
 	usleep_range(25, 35);
-
-	return 0;
 }
 
 static void
@@ -2331,6 +2334,8 @@ mt7531_setup(struct dsa_switch *ds)
 		     SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST |
 		     SYS_CTRL_REG_RST);
 
+	mt7531_pll_setup(priv);
+
 	if (mt7531_dual_sgmii_supported(priv)) {
 		priv->p5_intf_sel = P5_INTF_SEL_GMAC5_SGMII;
 
@@ -2887,8 +2892,6 @@ mt7531_cpu_port_config(struct dsa_switch *ds, int port)
 	case 6:
 		interface = PHY_INTERFACE_MODE_2500BASEX;
 
-		mt7531_pad_setup(ds, interface);
-
 		priv->p6_interface = interface;
 		break;
 	default:
-- 
2.37.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net v2 2/2] net: mt7531: ensure all MACs are powered down before reset
  2022-09-17  0:07 [PATCH net v2 0/2] net: mt7531: pll & reset fixes Alexander Couzens
  2022-09-17  0:07 ` [PATCH net v2 1/2] net: mt7531: only do PLL once after the reset Alexander Couzens
@ 2022-09-17  0:07 ` Alexander Couzens
  2022-09-22  1:20 ` [PATCH net v2 0/2] net: mt7531: pll & reset fixes Jakub Kicinski
  2022-09-23 14:10 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Alexander Couzens @ 2022-09-17  0:07 UTC (permalink / raw)
  To: Sean Wang, Landen Chao, DENG Qingfang, Andrew Lunn,
	Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger
  Cc: Alexander Couzens, Landen Chao, netdev, linux-arm-kernel,
	linux-mediatek, linux-kernel

The datasheet [1] explicit describes it as requirement for a reset.

[1] MT7531 Reference Manual for Development Board rev 1.0, page 735

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
---
 drivers/net/dsa/mt7530.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 95a57aeb466e..409d5c3d76ea 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -2329,6 +2329,10 @@ mt7531_setup(struct dsa_switch *ds)
 		return -ENODEV;
 	}
 
+	/* all MACs must be forced link-down before sw reset */
+	for (i = 0; i < MT7530_NUM_PORTS; i++)
+		mt7530_write(priv, MT7530_PMCR_P(i), MT7531_FORCE_LNK);
+
 	/* Reset the switch through internal reset */
 	mt7530_write(priv, MT7530_SYS_CTRL,
 		     SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST |
-- 
2.37.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net v2 0/2] net: mt7531: pll & reset fixes
  2022-09-17  0:07 [PATCH net v2 0/2] net: mt7531: pll & reset fixes Alexander Couzens
  2022-09-17  0:07 ` [PATCH net v2 1/2] net: mt7531: only do PLL once after the reset Alexander Couzens
  2022-09-17  0:07 ` [PATCH net v2 2/2] net: mt7531: ensure all MACs are powered down before reset Alexander Couzens
@ 2022-09-22  1:20 ` Jakub Kicinski
  2022-09-23 14:10 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2022-09-22  1:20 UTC (permalink / raw)
  To: Alexander Couzens
  Cc: Sean Wang, Landen Chao, DENG Qingfang, Andrew Lunn,
	Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Paolo Abeni, Matthias Brugger,
	netdev, linux-arm-kernel, linux-mediatek, linux-kernel

On Sat, 17 Sep 2022 02:07:32 +0200 Alexander Couzens wrote:
> v1 -> v2:
>  - commit message: add Fixes: tag
>  - add missing target branch in subject

Landen, DENG, Sean - please review.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net v2 0/2] net: mt7531: pll & reset fixes
  2022-09-17  0:07 [PATCH net v2 0/2] net: mt7531: pll & reset fixes Alexander Couzens
                   ` (2 preceding siblings ...)
  2022-09-22  1:20 ` [PATCH net v2 0/2] net: mt7531: pll & reset fixes Jakub Kicinski
@ 2022-09-23 14:10 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-23 14:10 UTC (permalink / raw)
  To: Alexander 'lynxis' Couzens
  Cc: sean.wang, Landen.Chao, dqfext, andrew, vivien.didelot,
	f.fainelli, olteanv, davem, edumazet, kuba, pabeni, matthias.bgg,
	landen.chao, netdev, linux-arm-kernel, linux-mediatek,
	linux-kernel

Hello:

This series was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 17 Sep 2022 02:07:32 +0200 you wrote:
> v1 -> v2:
>  - commit message: add Fixes: tag
>  - add missing target branch in subject
> 
> Alexander Couzens (2):
>   net: mt7531: only do PLL once after the reset
>   net: mt7531: ensure all MACs are powered down before reset
> 
> [...]

Here is the summary with links:
  - [net,v2,1/2] net: mt7531: only do PLL once after the reset
    https://git.kernel.org/netdev/net/c/42bc4fafe359
  - [net,v2,2/2] net: mt7531: ensure all MACs are powered down before reset
    https://git.kernel.org/netdev/net/c/728c2af6ad8c

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



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-09-23 14:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-17  0:07 [PATCH net v2 0/2] net: mt7531: pll & reset fixes Alexander Couzens
2022-09-17  0:07 ` [PATCH net v2 1/2] net: mt7531: only do PLL once after the reset Alexander Couzens
2022-09-17  0:07 ` [PATCH net v2 2/2] net: mt7531: ensure all MACs are powered down before reset Alexander Couzens
2022-09-22  1:20 ` [PATCH net v2 0/2] net: mt7531: pll & reset fixes Jakub Kicinski
2022-09-23 14:10 ` 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).