Skip to contentSkip to conversation

net: dsa: qca8k: make sure PAD0 MAC06 exchange is disabled

PATCH Applied Ansuel Smith 2 participants 2 messages Nov 2, 2021 – Nov 3, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: qca8k: make sure PAD0 MAC06 exchange is disabled

Some device set MAC06 exchange in the bootloader. This cause some problem as we don't support this strange mode and we just set the port6 as the primary CPU port. With MAC06 exchange, PAD0 reg configure port6 instead of port0. Add an extra check and explicitly disable MAC06 exchange to correctly configure the port PAD config.

Fixes 3fcf734aa482 ("net: dsa: qca8k: add support for cpu port 6")
---
 drivers/net/dsa/qca8k.c | 8 ++++++++
 drivers/net/dsa/qca8k.h | 1 +
 2 files changed, 9 insertions(+)

Some comments here:
Resetting the switch using the sw reg doesn't reset the port PAD configuration. I was thinking if it would be better to clear all the pad configuration but considering that the entire reg is set by phylink mac config, I think it's not necessary as the PAD related to the port will be reset anyway with the new values. Have a dirty configuration on PAD6 doesn't cause any problem as we have that port disabled and it would be reset and configured anyway if defined.

drivers/net/dsa/qca8k.c +8 -0
index ea7f12778922..a429c9750add 100644
@@ -1109,6 +1109,14 @@ qca8k_setup(struct dsa_switch *ds)
 	if (ret)
 		return ret;
 
+	/* Make sure MAC06 is disabled */
+	ret = qca8k_reg_clear(priv, QCA8K_REG_PORT0_PAD_CTRL,
+			      QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN);
+	if (ret) {
+		dev_err(priv->dev, "failed disabling MAC06 exchange");
+		return ret;
+	}
+
 	/* Enable CPU Port */
 	ret = qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0,
 			    QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN);
drivers/net/dsa/qca8k.h +1 -0
index e10571a398c9..128b8cf85e08 100644
@@ -34,6 +34,7 @@
 #define   QCA8K_MASK_CTRL_DEVICE_ID_MASK		GENMASK(15, 8)
 #define   QCA8K_MASK_CTRL_DEVICE_ID(x)			((x) >> 8)
 #define QCA8K_REG_PORT0_PAD_CTRL			0x004
+#define   QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN		BIT(31)
 #define   QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE	BIT(19)
 #define   QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE	BIT(18)
 #define QCA8K_REG_PORT5_PAD_CTRL			0x008
Signature · 1 line
2.32.0
#1 lore raw
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 11 lines · On Tue, 2 Nov 2021 19:30:41 +0100 you wrote:

Some device set MAC06 exchange in the bootloader. This cause some problem as we don't support this strange mode and we just set the port6 as the primary CPU port. With MAC06 exchange, PAD0 reg configure port6 instead of port0. Add an extra check and explicitly disable MAC06 exchange to correctly configure the port PAD config.

Fixes 3fcf734aa482 ("net: dsa: qca8k: add support for cpu port 6")

[...]

Here is the summary with links:
- [net] net: dsa: qca8k: make sure PAD0 MAC06 exchange is disabled

    https://git.kernel.org/netdev/net/c/5f15d392dcb4

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html