net: stmmac: dwmac-socfpga: Move internal helpers

This is preparatory work to allow reusing the SGMII configuration helper
and the wrapper to get the interface in the fix_mac_speed() callback.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/20260324092102.687082-2-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Maxime Chevallier 2026-03-24 10:20:56 +01:00 committed by Jakub Kicinski
parent dbd94b9831
commit 845a044111

View File

@ -72,6 +72,18 @@ struct socfpga_dwmac {
const struct socfpga_dwmac_ops *ops;
};
static int socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac)
{
return dwmac->plat_dat->phy_interface;
}
static void socfpga_sgmii_config(struct socfpga_dwmac *dwmac, bool enable)
{
u16 val = enable ? SGMII_ADAPTER_ENABLE : SGMII_ADAPTER_DISABLE;
writew(val, dwmac->sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
}
static void socfpga_dwmac_fix_mac_speed(void *bsp_priv,
phy_interface_t interface, int speed,
unsigned int mode)
@ -244,18 +256,6 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
return ret;
}
static int socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac)
{
return dwmac->plat_dat->phy_interface;
}
static void socfpga_sgmii_config(struct socfpga_dwmac *dwmac, bool enable)
{
u16 val = enable ? SGMII_ADAPTER_ENABLE : SGMII_ADAPTER_DISABLE;
writew(val, dwmac->sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
}
static int socfpga_set_phy_mode_common(int phymode, u32 *val)
{
switch (phymode) {