[PATCH net-next v5 6/9] net: stmmac: configure SerDes on mac_finish
From: Choong Yong Liang
Date: Wed Feb 14 2024 - 22:10:03 EST
SerDes will configure according to the provided interface mode after
finish a major reconfiguration of the interface mode.
Signed-off-by: Choong Yong Liang <yong.liang.choong@xxxxxxxxxxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +++++++++++++
include/linux/stmmac.h | 3 +++
2 files changed, 16 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index dbd16fc38888..69a33e9f1a5c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1120,12 +1120,25 @@ static unsigned int stmmac_get_pcs_neg_mode(struct phylink_config *config,
return neg_mode;
}
+static int stmmac_mac_finish(struct phylink_config *config, unsigned int mode,
+ phy_interface_t interface)
+{
+ struct net_device *ndev = to_net_dev(config->dev);
+ struct stmmac_priv *priv = netdev_priv(ndev);
+
+ if (priv->plat->config_serdes)
+ priv->plat->config_serdes(ndev, priv->plat->bsp_priv, interface);
+
+ return 0;
+}
+
static const struct phylink_mac_ops stmmac_phylink_mac_ops = {
.mac_select_pcs = stmmac_mac_select_pcs,
.mac_config = stmmac_mac_config,
.mac_link_down = stmmac_mac_link_down,
.mac_link_up = stmmac_mac_link_up,
.mac_get_pcs_neg_mode = stmmac_get_pcs_neg_mode,
+ .mac_finish = stmmac_mac_finish,
};
/**
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index ffd66722eeda..fd3d7d25f871 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -279,6 +279,9 @@ struct plat_stmmacenet_data {
void (*speed_mode_2500)(struct net_device *ndev, void *priv);
unsigned int (*get_pcs_neg_mode)(phy_interface_t interface,
struct pci_dev *pdev);
+ int (*config_serdes)(struct net_device *ndev,
+ void *priv,
+ phy_interface_t interface);
void (*ptp_clk_freq_config)(struct stmmac_priv *priv);
int (*init)(struct platform_device *pdev, void *priv);
void (*exit)(struct platform_device *pdev, void *priv);
--
2.34.1