diff mbox series

[net-next,v2,6/7] net: tn40xx: optimize mdio speed settings

Message ID trinity-f28f6938-afbc-4059-a149-d220fa8dc6f9-1726430902358@3c-app-gmx-bap07 (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series None | expand

Commit Message

Hans-Frieder Vogt Sept. 15, 2024, 8:08 p.m. UTC
Optimize MDIO speed settings. The PHYs of all currently supported TN4010
cards support 6 MHz operation. Therefore select 6 MHz already before
devm_mdiobus_register, which also saves another call to
tn40_mdio_set_speed afterwards. As a nice side effect, the loading of the
firmware for the AQR105 PHY is then reduced from 30 s to 5 s.

Remove the write to TN40_REG_MDIO_CMD_STAT in tn40_priv_init, which is
equivalent to tn40_mdio_set_speed to 1 Mhz and therefore would revert the
6 MHz speedup of the MDIO communication.

Signed-off-by: Hans-Frieder Vogt <hfdevel@gmx.net>
---
 drivers/net/ethernet/tehuti/tn40.c      | 1 -
 drivers/net/ethernet/tehuti/tn40_mdio.c | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

--
2.45.2
diff mbox series

Patch

diff --git a/drivers/net/ethernet/tehuti/tn40.c b/drivers/net/ethernet/tehuti/tn40.c
index 5f73eb1f7d9f..9ccf5cd89663 100644
--- a/drivers/net/ethernet/tehuti/tn40.c
+++ b/drivers/net/ethernet/tehuti/tn40.c
@@ -1642,7 +1642,6 @@  static int tn40_priv_init(struct tn40_priv *priv)
 	/* Set GPIO[9:0] to output 0 */
 	tn40_write_reg(priv, 0x51E0, 0x30010006);	/* GPIO_OE_ WR CMD */
 	tn40_write_reg(priv, 0x51F0, 0x0);	/* GPIO_OE_ DATA */
-	tn40_write_reg(priv, TN40_REG_MDIO_CMD_STAT, 0x3ec8);

 	/* we use tx descriptors to load a firmware. */
 	ret = tn40_create_tx_ring(priv);
diff --git a/drivers/net/ethernet/tehuti/tn40_mdio.c b/drivers/net/ethernet/tehuti/tn40_mdio.c
index 80eb68384389..993458cc4932 100644
--- a/drivers/net/ethernet/tehuti/tn40_mdio.c
+++ b/drivers/net/ethernet/tehuti/tn40_mdio.c
@@ -185,14 +185,13 @@  int tn40_mdiobus_init(struct tn40_priv *priv)
 			ret);
 	}

-	tn40_mdio_set_speed(priv, TN40_MDIO_SPEED_1MHZ);
+	tn40_mdio_set_speed(priv, TN40_MDIO_SPEED_6MHZ);
 	ret = devm_mdiobus_register(&pdev->dev, bus);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register mdiobus %d %u %u\n",
 			ret, bus->state, MDIOBUS_UNREGISTERED);
 		goto err_swnodes_unregister;
 	}
-	tn40_mdio_set_speed(priv, TN40_MDIO_SPEED_6MHZ);
 	priv->mdio = bus;
 	return 0;