summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-03-27 04:55:22 +0300
committerJakub Kicinski <kuba@kernel.org>2026-03-27 04:55:22 +0300
commita771cddbd6541587b2b423576a57e4217ec11a38 (patch)
treed8622688d06282fc626dc49da56ef8685e212571
parent5f70b0aa08ada1004259902dbee3b401ac2f7dcb (diff)
parent588cd4e7d22cf82081865a6677a468c88d93b4ba (diff)
downloadlinux-a771cddbd6541587b2b423576a57e4217ec11a38.tar.xz
Merge branch 'net-dsa-microchip-small-cleanups-for-ksz9477-sgmii'
Maxime Chevallier says: ==================== net: dsa: microchip: Small cleanups for ksz9477 SGMII While working with ksz9477, I've done some very minor cleanups around the PCS code for the SGMII port. No changes intended. ==================== Link: https://patch.msgid.link/20260324180826.524327-1-maxime.chevallier@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/dsa/microchip/ksz9477.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index 5416016b33e0..d3c23dcaea8c 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -310,36 +310,33 @@ static int ksz9477_pcs_write(struct mii_bus *bus, int phy, int mmd, int reg,
int ksz9477_pcs_create(struct ksz_device *dev)
{
- /* This chip has a SGMII port. */
- if (ksz_has_sgmii_port(dev)) {
- int port = ksz_get_sgmii_port(dev);
- struct ksz_port *p = &dev->ports[port];
- struct phylink_pcs *pcs;
- struct mii_bus *bus;
- int ret;
-
- bus = devm_mdiobus_alloc(dev->dev);
- if (!bus)
- return -ENOMEM;
-
- bus->name = "ksz_pcs_mdio_bus";
- snprintf(bus->id, MII_BUS_ID_SIZE, "%s-pcs",
- dev_name(dev->dev));
- bus->read_c45 = &ksz9477_pcs_read;
- bus->write_c45 = &ksz9477_pcs_write;
- bus->parent = dev->dev;
- bus->phy_mask = ~0;
- bus->priv = dev;
-
- ret = devm_mdiobus_register(dev->dev, bus);
- if (ret)
- return ret;
+ int port = ksz_get_sgmii_port(dev);
+ struct ksz_port *p = &dev->ports[port];
+ struct phylink_pcs *pcs;
+ struct mii_bus *bus;
+ int ret;
- pcs = xpcs_create_pcs_mdiodev(bus, 0);
- if (IS_ERR(pcs))
- return PTR_ERR(pcs);
- p->pcs = pcs;
- }
+ bus = devm_mdiobus_alloc(dev->dev);
+ if (!bus)
+ return -ENOMEM;
+
+ bus->name = "ksz_pcs_mdio_bus";
+ snprintf(bus->id, MII_BUS_ID_SIZE, "%s-pcs",
+ dev_name(dev->dev));
+ bus->read_c45 = &ksz9477_pcs_read;
+ bus->write_c45 = &ksz9477_pcs_write;
+ bus->parent = dev->dev;
+ bus->phy_mask = ~0;
+ bus->priv = dev;
+
+ ret = devm_mdiobus_register(dev->dev, bus);
+ if (ret)
+ return ret;
+
+ pcs = xpcs_create_pcs_mdiodev(bus, 0);
+ if (IS_ERR(pcs))
+ return PTR_ERR(pcs);
+ p->pcs = pcs;
return 0;
}
@@ -528,7 +525,7 @@ int ksz9477_r_phy(struct ksz_device *dev, u16 addr, u16 reg, u16 *data)
* A fixed PHY can be setup in the device tree, but this function is
* still called for that port during initialization.
* For RGMII PHY there is no way to access it so the fixed PHY should
- * be used. For SGMII PHY the supporting code will be added later.
+ * be used.
*/
if (!dev->info->internal_phy[addr]) {
struct ksz_port *p = &dev->ports[addr];