summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-11-23 20:27:02 +0000
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2025-09-29 10:14:56 +0100
commit8364b96b56d319a42d760ff25f2c939f88e122f6 (patch)
tree1800ff7c0df837802ce70793c569e19ebd261be1
parent024df99d592211a33b69171b8d444b2d34b29b72 (diff)
net: mvneta: add phy_interface_t to LPI methods and validate it
Add the PHY interface mode to the LPI methods and validate that LPI is being entered for a supported mode. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 01eedc3e54d9..cf452acbcd03 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4288,7 +4288,8 @@ static void mvneta_mac_link_up(struct phylink_config *config,
mvneta_port_up(pp);
}
-static void mvneta_mac_disable_tx_lpi(struct phylink_config *config)
+static void mvneta_mac_disable_tx_lpi(struct phylink_config *config,
+ phy_interface_t interface)
{
struct mvneta_port *pp = netdev_priv(to_net_dev(config->dev));
u32 lpi1;
@@ -4300,12 +4301,17 @@ static void mvneta_mac_disable_tx_lpi(struct phylink_config *config)
mvreg_write(pp, MVNETA_LPI_CTRL_1, lpi1);
}
-static int mvneta_mac_enable_tx_lpi(struct phylink_config *config, u32 timer,
+static int mvneta_mac_enable_tx_lpi(struct phylink_config *config,
+ phy_interface_t interface, u32 timer,
bool tx_clk_stop)
{
struct mvneta_port *pp = netdev_priv(to_net_dev(config->dev));
u32 ts, tw, lpi0, lpi1, status;
+ if (interface != PHY_INTERFACE_MODE_SGMII &&
+ interface != PHY_INTERFACE_MODE_QSGMII)
+ return -EOPNOTSUPP;
+
status = mvreg_read(pp, MVNETA_GMAC_STATUS);
if (status & MVNETA_GMAC_SPEED_1000) {
/* At 1G speeds, the timer resolution are 1us, and
@@ -5480,7 +5486,7 @@ static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
return -EINVAL;
/* Ensure LPI is disabled */
- mvneta_mac_disable_tx_lpi(&pp->phylink_config);
+ mvneta_mac_disable_tx_lpi(&pp->phylink_config, phy_mode);
return 0;
}