diff options
| author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2025-11-06 11:23:52 +0000 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2025-11-07 19:05:49 -0800 |
| commit | e3c8f25cf2aa3f2547da26e7a46424c016550d31 (patch) | |
| tree | 509a2e4240a1cd8858caff2c0e6fc77b955e7cfa | |
| parent | ef5e870be90ffc390ae9afc0b50d411d3538126c (diff) | |
net: stmmac: sti: use ->set_phy_intf_sel()
Rather than placing the phy_intf_sel() setup in the ->init() method,
move it to the new ->set_phy_intf_sel() method.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1vGy5o-0000000DhQn-34JE@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c index 593e154b5957..b0509ab6b31c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c @@ -146,17 +146,18 @@ static void stih4xx_fix_retime_src(void *priv, int spd, unsigned int mode) stih4xx_tx_retime_val[src]); } -static int sti_dwmac_set_mode(struct sti_dwmac *dwmac) +static int sti_set_phy_intf_sel(void *bsp_priv, u8 phy_intf_sel) { - struct regmap *regmap = dwmac->regmap; - u32 reg = dwmac->ctrl_reg; - int phy_intf_sel; - u32 val; + struct sti_dwmac *dwmac = bsp_priv; + struct regmap *regmap; + u32 reg, val; + + regmap = dwmac->regmap; + reg = dwmac->ctrl_reg; if (dwmac->gmac_en) regmap_update_bits(regmap, reg, EN_MASK, EN); - phy_intf_sel = stmmac_get_phy_intf_sel(dwmac->interface); if (phy_intf_sel != PHY_INTF_SEL_GMII_MII && phy_intf_sel != PHY_INTF_SEL_RGMII && phy_intf_sel != PHY_INTF_SEL_SGMII && @@ -231,17 +232,8 @@ static int sti_dwmac_parse_data(struct sti_dwmac *dwmac, static int sti_dwmac_init(struct platform_device *pdev, void *bsp_priv) { struct sti_dwmac *dwmac = bsp_priv; - int ret; - - ret = clk_prepare_enable(dwmac->clk); - if (ret) - return ret; - - ret = sti_dwmac_set_mode(dwmac); - if (ret) - clk_disable_unprepare(dwmac->clk); - return ret; + return clk_prepare_enable(dwmac->clk); } static void sti_dwmac_exit(struct platform_device *pdev, void *bsp_priv) @@ -286,6 +278,7 @@ static int sti_dwmac_probe(struct platform_device *pdev) dwmac->fix_retime_src = data->fix_retime_src; plat_dat->bsp_priv = dwmac; + plat_dat->set_phy_intf_sel = sti_set_phy_intf_sel; plat_dat->fix_mac_speed = data->fix_retime_src; plat_dat->init = sti_dwmac_init; plat_dat->exit = sti_dwmac_exit; |
