[RFC PATCH v3 net-next 08/10] net: mscc: ocelot: felix: add ability to enable a CPU / NPI port

From: Colin Foster
Date: Fri Aug 13 2021 - 22:51:08 EST


For the vsc7512 ocelot SPI driver, the CPU interface port needs to be enabled,
but can't be enabled via ocelot_adjust_link since it doesn't have a phylink.
This adds a hook so the port can be manually enabled.

Signed-off-by: Colin Foster <colin.foster@xxxxxxxxxxxxxxxx>
---
drivers/net/dsa/ocelot/felix.c | 5 +++++
drivers/net/dsa/ocelot/felix.h | 1 +
2 files changed, 6 insertions(+)

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 77644deb4a35..33c0c7bc3e58 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -492,8 +492,13 @@ static void felix_teardown_tag_8021q(struct dsa_switch *ds, int cpu)
*/
static void felix_npi_port_init(struct ocelot *ocelot, int port)
{
+ struct felix *felix = ocelot_to_felix(ocelot);
+
ocelot->npi = port;

+ if (felix->info->enable_npi_port)
+ felix->info->enable_npi_port(ocelot);
+
ocelot_write(ocelot, QSYS_EXT_CPU_CFG_EXT_CPUQ_MSK_M |
QSYS_EXT_CPU_CFG_EXT_CPU_PORT(port),
QSYS_EXT_CPU_CFG);
diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h
index 25f664ef4947..c872705115bc 100644
--- a/drivers/net/dsa/ocelot/felix.h
+++ b/drivers/net/dsa/ocelot/felix.h
@@ -47,6 +47,7 @@ struct felix_info {
u32 speed);
struct regmap *(*init_regmap)(struct ocelot *ocelot,
struct resource *res);
+ void (*enable_npi_port)(struct ocelot *ocelot);
};

extern const struct dsa_switch_ops felix_switch_ops;
--
2.25.1