summaryrefslogtreecommitdiff
path: root/drivers/net/dsa/microchip/ksz9477.c
diff options
context:
space:
mode:
authorArun Ramadoss <arun.ramadoss@microchip.com>2022-06-22 14:34:15 +0530
committerDavid S. Miller <davem@davemloft.net>2022-06-24 11:31:43 +0100
commit331d64f752bbdae4c846416d6f4406010a24f539 (patch)
tree8b82097bfa927abc318cc86c4b4cb32879f06bb1 /drivers/net/dsa/microchip/ksz9477.c
parentfb9324beb5d4ce8e4f81718a3270ae0c4a354f56 (diff)
net: dsa: microchip: add the enable_stp_addr pointer in ksz_dev_ops
In order to transmit the STP BPDU packet to the CPU port, the STP address 01-80-c2-00-00-00 has to be added to static alu table for ksz8795 series switch. For the ksz9477 switch, there is reserved multicast table which handles forwarding the particular set of multicast address to cpu port. So enabling the multicast reserved table and updated the cpu port index. The stp addr is enabled during the setup phase using the enable_stp_addr pointer in struct ksz_dev_ops. Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/microchip/ksz9477.c')
-rw-r--r--drivers/net/dsa/microchip/ksz9477.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index fef8142440cf..6ca0d5753df0 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -1236,6 +1236,36 @@ static void ksz9477_config_cpu_port(struct dsa_switch *ds)
}
}
+static int ksz9477_enable_stp_addr(struct ksz_device *dev)
+{
+ u32 data;
+ int ret;
+
+ /* Enable Reserved multicast table */
+ ksz_cfg(dev, REG_SW_LUE_CTRL_0, SW_RESV_MCAST_ENABLE, true);
+
+ /* Set the Override bit for forwarding BPDU packet to CPU */
+ ret = ksz_write32(dev, REG_SW_ALU_VAL_B,
+ ALU_V_OVERRIDE | BIT(dev->cpu_port));
+ if (ret < 0)
+ return ret;
+
+ data = ALU_STAT_START | ALU_RESV_MCAST_ADDR;
+
+ ret = ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);
+ if (ret < 0)
+ return ret;
+
+ /* wait to be finished */
+ ret = ksz9477_wait_alu_sta_ready(dev);
+ if (ret < 0) {
+ dev_err(dev->dev, "Failed to update Reserved Multicast table\n");
+ return ret;
+ }
+
+ return 0;
+}
+
static int ksz9477_setup(struct dsa_switch *ds)
{
struct ksz_device *dev = ds->priv;
@@ -1281,6 +1311,8 @@ static int ksz9477_setup(struct dsa_switch *ds)
/* start switch */
ksz_cfg(dev, REG_SW_OPERATION, SW_START, true);
+ dev->dev_ops->enable_stp_addr(dev);
+
ksz_init_mib_timer(dev);
ds->configure_vlan_while_not_filtering = false;
@@ -1401,6 +1433,7 @@ static const struct ksz_dev_ops ksz9477_dev_ops = {
.change_mtu = ksz9477_change_mtu,
.max_mtu = ksz9477_max_mtu,
.config_cpu_port = ksz9477_config_cpu_port,
+ .enable_stp_addr = ksz9477_enable_stp_addr,
.reset = ksz9477_reset_switch,
.init = ksz9477_switch_init,
.exit = ksz9477_switch_exit,