public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: dsa: microchip: Small cleanups for ksz9477 SGMII
@ 2026-03-24 18:08 Maxime Chevallier
  2026-03-24 18:08 ` [PATCH net-next 1/2] net: dsa: microchip: Drop unnecessary check in ksz9477 PCS setup Maxime Chevallier
  2026-03-24 18:08 ` [PATCH net-next 2/2] net: dsa: microchip: drop an outdated comment about SGMII support Maxime Chevallier
  0 siblings, 2 replies; 5+ messages in thread
From: Maxime Chevallier @ 2026-03-24 18:08 UTC (permalink / raw)
  To: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Woojung Huh, Vladimir Oltean, UNGLinuxDriver
  Cc: Maxime Chevallier, thomas.petazzoni, netdev, linux-kernel

Hi,

While working with ksz9477, I've done some  very minor cleanups around the
PCS code for the SGMII port. No changes intended.

Maxime

Maxime Chevallier (2):
  net: dsa: microchip: Drop unnecessary check in ksz9477 PCS setup
  net: dsa: microchip: drop an outdated comment about SGMII support

 drivers/net/dsa/microchip/ksz9477.c | 57 ++++++++++++++---------------
 1 file changed, 27 insertions(+), 30 deletions(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/2] net: dsa: microchip: Drop unnecessary check in ksz9477 PCS setup
  2026-03-24 18:08 [PATCH net-next 0/2] net: dsa: microchip: Small cleanups for ksz9477 SGMII Maxime Chevallier
@ 2026-03-24 18:08 ` Maxime Chevallier
  2026-03-24 20:37   ` Vladimir Oltean
  2026-03-24 18:08 ` [PATCH net-next 2/2] net: dsa: microchip: drop an outdated comment about SGMII support Maxime Chevallier
  1 sibling, 1 reply; 5+ messages in thread
From: Maxime Chevallier @ 2026-03-24 18:08 UTC (permalink / raw)
  To: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Woojung Huh, Vladimir Oltean, UNGLinuxDriver
  Cc: Maxime Chevallier, thomas.petazzoni, netdev, linux-kernel

The ksz_dev_ops .pcs_create() is called under the assumption that the
switch has a PCS port :

  if (ksz_has_sgmii_port(dev) && dev->dev_ops->pcs_create) {
          ret = dev->dev_ops->pcs_create(dev);
	  [...]
  }

The KSZ9477 implementation of .pcs_create() does the same check on
ksz_has_sgmii_port(), and protects the entire function with it.

Drop it, saving a level of indentation and increasing readability.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 drivers/net/dsa/microchip/ksz9477.c | 55 ++++++++++++++---------------
 1 file changed, 26 insertions(+), 29 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index 5416016b33e0..30d8c0146bbb 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;
 }
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/2] net: dsa: microchip: drop an outdated comment about SGMII support
  2026-03-24 18:08 [PATCH net-next 0/2] net: dsa: microchip: Small cleanups for ksz9477 SGMII Maxime Chevallier
  2026-03-24 18:08 ` [PATCH net-next 1/2] net: dsa: microchip: Drop unnecessary check in ksz9477 PCS setup Maxime Chevallier
@ 2026-03-24 18:08 ` Maxime Chevallier
  2026-03-24 20:37   ` Vladimir Oltean
  1 sibling, 1 reply; 5+ messages in thread
From: Maxime Chevallier @ 2026-03-24 18:08 UTC (permalink / raw)
  To: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Woojung Huh, Vladimir Oltean, UNGLinuxDriver
  Cc: Maxime Chevallier, thomas.petazzoni, netdev, linux-kernel

SGMII support has been added to ksz9477, we can drop the comment saying
that it'll be added later.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 drivers/net/dsa/microchip/ksz9477.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index 30d8c0146bbb..d3c23dcaea8c 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -525,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];
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 1/2] net: dsa: microchip: Drop unnecessary check in ksz9477 PCS setup
  2026-03-24 18:08 ` [PATCH net-next 1/2] net: dsa: microchip: Drop unnecessary check in ksz9477 PCS setup Maxime Chevallier
@ 2026-03-24 20:37   ` Vladimir Oltean
  0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Oltean @ 2026-03-24 20:37 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Woojung Huh, UNGLinuxDriver, thomas.petazzoni,
	netdev, linux-kernel

On Tue, Mar 24, 2026 at 07:08:24PM +0100, Maxime Chevallier wrote:
> The ksz_dev_ops .pcs_create() is called under the assumption that the
> switch has a PCS port :
> 
>   if (ksz_has_sgmii_port(dev) && dev->dev_ops->pcs_create) {
>           ret = dev->dev_ops->pcs_create(dev);
> 	  [...]
>   }
> 
> The KSZ9477 implementation of .pcs_create() does the same check on
> ksz_has_sgmii_port(), and protects the entire function with it.
> 
> Drop it, saving a level of indentation and increasing readability.
> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 2/2] net: dsa: microchip: drop an outdated comment about SGMII support
  2026-03-24 18:08 ` [PATCH net-next 2/2] net: dsa: microchip: drop an outdated comment about SGMII support Maxime Chevallier
@ 2026-03-24 20:37   ` Vladimir Oltean
  0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Oltean @ 2026-03-24 20:37 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Woojung Huh, UNGLinuxDriver, thomas.petazzoni,
	netdev, linux-kernel

On Tue, Mar 24, 2026 at 07:08:25PM +0100, Maxime Chevallier wrote:
> SGMII support has been added to ksz9477, we can drop the comment saying
> that it'll be added later.
> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-24 20:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 18:08 [PATCH net-next 0/2] net: dsa: microchip: Small cleanups for ksz9477 SGMII Maxime Chevallier
2026-03-24 18:08 ` [PATCH net-next 1/2] net: dsa: microchip: Drop unnecessary check in ksz9477 PCS setup Maxime Chevallier
2026-03-24 20:37   ` Vladimir Oltean
2026-03-24 18:08 ` [PATCH net-next 2/2] net: dsa: microchip: drop an outdated comment about SGMII support Maxime Chevallier
2026-03-24 20:37   ` Vladimir Oltean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox