[PATCH RFC net-next 08/23] net: dsa: lantiq_gswip: store switch API version in priv

From: Daniel Golle
Date: Sat Aug 16 2025 - 15:54:52 EST


Store the switch API version in struct gswip_priv to prepare supporting
newer features such as 4096 VLANs and per-port configurable learning.

Signed-off-by: Daniel Golle <daniel@xxxxxxxxxxxxxx>
---
drivers/net/dsa/lantiq_gswip.c | 13 ++++++-------
drivers/net/dsa/lantiq_gswip.h | 1 +
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
index a66466bac1a8..16b92af9ff23 100644
--- a/drivers/net/dsa/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq_gswip.c
@@ -1882,7 +1882,6 @@ static int gswip_probe(struct platform_device *pdev)
struct gswip_priv *priv;
int err;
int i;
- u32 version;

priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -1915,10 +1914,10 @@ static int gswip_probe(struct platform_device *pdev)
priv->ds->phylink_mac_ops = &gswip_phylink_mac_ops;
priv->dev = dev;
mutex_init(&priv->pce_table_lock);
- version = gswip_switch_r(priv, GSWIP_VERSION);
+ priv->version = gswip_switch_r(priv, GSWIP_VERSION);

np = dev->of_node;
- switch (version) {
+ switch (priv->version) {
case GSWIP_VERSION_2_0:
case GSWIP_VERSION_2_1:
if (!of_device_is_compatible(np, "lantiq,xrx200-gswip"))
@@ -1932,13 +1931,13 @@ static int gswip_probe(struct platform_device *pdev)
break;
default:
return dev_err_probe(dev, -ENOENT,
- "unknown GSWIP version: 0x%x\n", version);
+ "unknown GSWIP version: 0x%x\n", priv->version);
}

/* bring up the mdio bus */
gphy_fw_np = of_get_compatible_child(dev->of_node, "lantiq,gphy-fw");
if (gphy_fw_np) {
- err = gswip_gphy_fw_list(priv, gphy_fw_np, version);
+ err = gswip_gphy_fw_list(priv, gphy_fw_np, priv->version);
of_node_put(gphy_fw_np);
if (err)
return dev_err_probe(dev, err,
@@ -1965,8 +1964,8 @@ static int gswip_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);

dev_info(dev, "probed GSWIP version %lx mod %lx\n",
- (version & GSWIP_VERSION_REV_MASK) >> GSWIP_VERSION_REV_SHIFT,
- (version & GSWIP_VERSION_MOD_MASK) >> GSWIP_VERSION_MOD_SHIFT);
+ (priv->version & GSWIP_VERSION_REV_MASK) >> GSWIP_VERSION_REV_SHIFT,
+ (priv->version & GSWIP_VERSION_MOD_MASK) >> GSWIP_VERSION_MOD_SHIFT);
return 0;

disable_switch:
diff --git a/drivers/net/dsa/lantiq_gswip.h b/drivers/net/dsa/lantiq_gswip.h
index c68848fb1c2d..433b65b047dd 100644
--- a/drivers/net/dsa/lantiq_gswip.h
+++ b/drivers/net/dsa/lantiq_gswip.h
@@ -260,6 +260,7 @@ struct gswip_priv {
int num_gphy_fw;
struct gswip_gphy_fw *gphy_fw;
u32 port_vlan_filter;
+ u32 version;
struct mutex pce_table_lock;
};

--
2.50.1