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>
This commit is contained in:
Jakub Kicinski 2026-03-26 18:55:22 -07:00
commit a771cddbd6

View File

@ -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;
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 = 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;
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;
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;
}
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];