Re: [net-next PATCH v5 05/14] drivers: net: dsa: qca8k: add support for cpu port 6

From: Florian Fainelli
Date: Sun Oct 10 2021 - 22:01:19 EST


For consistency with other patch subjects, drop the "drivers: " prefix.

On 10/10/2021 6:30 PM, Ansuel Smith wrote:
Currently CPU port is always hardcoded to port 0. This switch have 2 CPU
port.

Plural: ports.

The original intention of this driver seems to be use the
mac06_exchange bit to swap MAC0 with MAC6 in the strange configuration
where device have connected only the CPU port 6. To skip the
introduction of a new binding, rework the driver to address the
secondary CPU port as primary and drop any reference of hardcoded port.
With configuration of mac06 exchange, just skip the definition of port0
and define the CPU port as a secondary. The driver will autoconfigure
the switch to use that as the primary CPU port.

Signed-off-by: Ansuel Smith <ansuelsmth@xxxxxxxxx>
---
drivers/net/dsa/qca8k.c | 50 +++++++++++++++++++++++++++++------------
drivers/net/dsa/qca8k.h | 2 --
2 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index e335a4cfcb75..de50116d483e 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -977,6 +977,22 @@ qca8k_setup_mac_pwr_sel(struct qca8k_priv *priv)
return ret;
}
+static int qca8k_find_cpu_port(struct dsa_switch *ds)
+{
+ struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;

For new functions please avoid the cast from void * which is unnecessary.

With those comments addressed:

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