[net-next,v5,6/9] net: stmmac: configure SerDes on mac_finish
Commit Message
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@linux.intel.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +++++++++++++
include/linux/stmmac.h | 3 +++
2 files changed, 16 insertions(+)
@@ -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,
};
/**
@@ -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);