Commit 6d0da953 authored by Michal Vokáč's avatar Michal Vokáč Committed by Greg Kroah-Hartman

net: dsa: qca8k: Use up to 7 ports for all operations

[ Upstream commit 7ae6d93c ]

The QCA8K family supports up to 7 ports. So use the existing
QCA8K_NUM_PORTS define to allocate the switch structure and limit all
operations with the switch ports.

This was not an issue until commit 0394a63a ("net: dsa: enable and
disable all ports") disabled all unused ports. Since the unused ports 7-11
are outside of the correct register range on this switch some registers
were rewritten with invalid content.

Fixes: 6b93fb46 ("net-next: dsa: add new driver for qca8xxx family")
Fixes: a0c02161 ("net: dsa: variable number of ports")
Fixes: 0394a63a ("net: dsa: enable and disable all ports")
Signed-off-by: default avatarMichal Vokáč <michal.vokac@ysoft.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 1cd24f5e
...@@ -543,7 +543,7 @@ qca8k_setup(struct dsa_switch *ds) ...@@ -543,7 +543,7 @@ qca8k_setup(struct dsa_switch *ds)
BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S); BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S);
/* Setup connection between CPU port & user ports */ /* Setup connection between CPU port & user ports */
for (i = 0; i < DSA_MAX_PORTS; i++) { for (i = 0; i < QCA8K_NUM_PORTS; i++) {
/* CPU port gets connected to all user ports of the switch */ /* CPU port gets connected to all user ports of the switch */
if (dsa_is_cpu_port(ds, i)) { if (dsa_is_cpu_port(ds, i)) {
qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT), qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT),
...@@ -897,7 +897,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev) ...@@ -897,7 +897,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
if (id != QCA8K_ID_QCA8337) if (id != QCA8K_ID_QCA8337)
return -ENODEV; return -ENODEV;
priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS); priv->ds = dsa_switch_alloc(&mdiodev->dev, QCA8K_NUM_PORTS);
if (!priv->ds) if (!priv->ds)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment