Skip to content

Commit ca78588

Browse files
Jesseeeekuba-moo
authored andcommitted
net: dsa: microchip: Make MDIO bus name unique
In configurations with 2 or more DSA clusters it will fail to allocate unique MDIO bus names as only the switch ID is used, fix this by using a combination of the tree ID and switch ID when needed Signed-off-by: Jesse Van Gavere <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2d20773 commit ca78588

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/net/dsa/microchip/ksz_common.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2550,7 +2550,11 @@ static int ksz_mdio_register(struct ksz_device *dev)
25502550
bus->read = ksz_sw_mdio_read;
25512551
bus->write = ksz_sw_mdio_write;
25522552
bus->name = "ksz user smi";
2553-
snprintf(bus->id, MII_BUS_ID_SIZE, "SMI-%d", ds->index);
2553+
if (ds->dst->index != 0) {
2554+
snprintf(bus->id, MII_BUS_ID_SIZE, "SMI-%d-%d", ds->dst->index, ds->index);
2555+
} else {
2556+
snprintf(bus->id, MII_BUS_ID_SIZE, "SMI-%d", ds->index);
2557+
}
25542558
}
25552559

25562560
ret = ksz_parse_dt_phy_config(dev, bus, mdio_np);

0 commit comments

Comments
 (0)