]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: ti: icssg-prueth: Fix emac link speed handling
authorMD Danish Anwar <danishanwar@ti.com>
Tue, 5 Aug 2025 17:38:12 +0000 (23:08 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Aug 2025 16:30:17 +0000 (18:30 +0200)
[ Upstream commit 06feac15406f4f66f4c0c6ea60b10d44775d4133 ]

When link settings are changed emac->speed is populated by
emac_adjust_link(). The link speed and other settings are then written into
the DRAM. However if both ports are brought down after this and brought up
again or if the operating mode is changed and a firmware reload is needed,
the DRAM is cleared by icssg_config(). As a result the link settings are
lost.

Fix this by calling emac_adjust_link() after icssg_config(). This re
populates the settings in the DRAM after a new firmware load.

Fixes: 9facce84f406 ("net: ti: icssg-prueth: Fix firmware load sequence.")
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Message-ID: <20250805173812.2183161-1-danishanwar@ti.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/ti/icssg/icssg_prueth.c

index 0769e1ade30b4ceae5b5c6b1a68137ea41ff28bb..ddbc4624ae8876aa56e7ef788124f1b749041874 100644 (file)
@@ -50,6 +50,8 @@
 /* CTRLMMR_ICSSG_RGMII_CTRL register bits */
 #define ICSSG_CTRL_RGMII_ID_MODE                BIT(24)
 
+static void emac_adjust_link(struct net_device *ndev);
+
 static int emac_get_tx_ts(struct prueth_emac *emac,
                          struct emac_tx_ts_response *rsp)
 {
@@ -266,6 +268,10 @@ static int prueth_emac_common_start(struct prueth *prueth)
                ret = icssg_config(prueth, emac, slice);
                if (ret)
                        goto disable_class;
+
+               mutex_lock(&emac->ndev->phydev->lock);
+               emac_adjust_link(emac->ndev);
+               mutex_unlock(&emac->ndev->phydev->lock);
        }
 
        ret = prueth_emac_start(prueth);