094686f11bef544da2a3c4c84750f346536158ea
[openwrt/staging/ldir.git] /
1 From 8d1af50842bf2774f4edc57054206e909117469b Mon Sep 17 00:00:00 2001
2 From: Ansuel Smith <ansuelsmth@gmail.com>
3 Date: Sat, 16 Apr 2022 01:30:17 +0200
4 Subject: [PATCH 6/6] net: dsa: qca8k: unify bus id naming with legacy and OF
5 mdio bus
6
7 Add support for multiple switch with OF mdio bus declaration.
8 Unify the bus id naming and use the same logic for both legacy and OF
9 mdio bus.
10
11 Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14 drivers/net/dsa/qca8k.c | 5 ++---
15 1 file changed, 2 insertions(+), 3 deletions(-)
16
17 --- a/drivers/net/dsa/qca8k.c
18 +++ b/drivers/net/dsa/qca8k.c
19 @@ -1323,6 +1323,8 @@ qca8k_mdio_register(struct qca8k_priv *p
20 return -ENOMEM;
21
22 bus->priv = (void *)priv;
23 + snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d.%d",
24 + ds->dst->index, ds->index);
25 bus->parent = ds->dev;
26 bus->phy_mask = ~ds->phys_mii_mask;
27 ds->slave_mii_bus = bus;
28 @@ -1330,7 +1332,6 @@ qca8k_mdio_register(struct qca8k_priv *p
29 /* Check if the devicetree declare the port:phy mapping */
30 mdio = of_get_child_by_name(priv->dev->of_node, "mdio");
31 if (of_device_is_available(mdio)) {
32 - snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d", ds->index);
33 bus->name = "qca8k slave mii";
34 bus->read = qca8k_internal_mdio_read;
35 bus->write = qca8k_internal_mdio_write;
36 @@ -1340,8 +1341,6 @@ qca8k_mdio_register(struct qca8k_priv *p
37 /* If a mapping can't be found the legacy mapping is used,
38 * using the qca8k_port_to_phy function
39 */
40 - snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d.%d",
41 - ds->dst->index, ds->index);
42 bus->name = "qca8k-legacy slave mii";
43 bus->read = qca8k_legacy_mdio_read;
44 bus->write = qca8k_legacy_mdio_write;