[PATCH net-next v2 08/13] net: renesas: rswitch: add basic vlan init to rswitch_fwd_init

From: Michael Dege

Date: Fri Mar 27 2026 - 04:35:45 EST


Add basic vlan related register initialization.

Signed-off-by: Michael Dege <michael.dege@xxxxxxxxxxx>
---
drivers/net/ethernet/renesas/rswitch_main.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/renesas/rswitch_main.c b/drivers/net/ethernet/renesas/rswitch_main.c
index b16f7aca4a69..ac87175b918e 100644
--- a/drivers/net/ethernet/renesas/rswitch_main.c
+++ b/drivers/net/ethernet/renesas/rswitch_main.c
@@ -120,6 +120,7 @@ static int rswitch_fwd_init(struct rswitch_private *priv)
u32 all_ports_mask = GENMASK(RSWITCH_NUM_AGENTS - 1, 0);
unsigned int i;
u32 reg_val;
+ int ret;

/* Start with empty configuration */
for (i = 0; i < RSWITCH_NUM_AGENTS; i++) {
@@ -154,17 +155,27 @@ static int rswitch_fwd_init(struct rswitch_private *priv)
}

/* For GWCA port, allow direct descriptor forwarding */
- rswitch_modify(priv->addr, FWPC1(priv->gwca.index), FWPC1_DDE, FWPC1_DDE);
+ rswitch_modify(priv->addr, FWPC1(priv->gwca.index), 0, FWPC1_DDE);

/* Initialize hardware L2 forwarding table */

- /* Allow entire table to be used for "unsecure" entries */
+ /* Allow entire table to be used for "un-secure" entries */
rswitch_modify(priv->addr, FWMACHEC, 0, FWMACHEC_MACHMUE_MASK);

/* Initialize MAC hash table */
iowrite32(FWMACTIM_MACTIOG, priv->addr + FWMACTIM);

- return rswitch_reg_wait(priv->addr, FWMACTIM, FWMACTIM_MACTIOG, 0);
+ ret = rswitch_reg_wait(priv->addr, FWMACTIM, FWMACTIM_MACTIOG, 0);
+ if (ret)
+ return ret;
+
+ /* Allow entire VLAN table to be used for "un-secure" entries */
+ iowrite32(VLANTMUE, priv->addr + FWVLANTEC);
+
+ /* Initialize VLAN table */
+ iowrite32(VLANTIOG, priv->addr + FWVLANTIM);
+
+ return rswitch_reg_wait(priv->addr, FWVLANTIM, VLANTIOG, 0);
}

/* Gateway CPU agent block (GWCA) */

--
2.43.0