net: stmmac: anarion: remove of_get_phy_mode()

devm_stmmac_probe_config_dt() already gets the PHY mode from firmware,
which is stored in plat_dat->phy_interface. Therefore, we don't need to
get it in platform code.

Rearrange the initialisation order so we can pass plat_dat into
anarion_config_dt(), thereby providing plat_dat->phy_interface as
necessary there.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1tsIGS-005uzf-QE@rmk-PC.armlinux.org.uk
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Russell King (Oracle)
2025-03-12 09:20:36 +00:00
committed by Paolo Abeni
parent 46f84d700c
commit e3ef12172a

View File

@@ -59,10 +59,11 @@ static void anarion_gmac_exit(struct platform_device *pdev, void *priv)
gmac_write_reg(gmac, GMAC_RESET_CONTROL_REG, 1);
}
static struct anarion_gmac *anarion_config_dt(struct platform_device *pdev)
static struct anarion_gmac *
anarion_config_dt(struct platform_device *pdev,
struct plat_stmmacenet_data *plat_dat)
{
struct anarion_gmac *gmac;
phy_interface_t phy_mode;
void __iomem *ctl_block;
int err;
@@ -79,11 +80,7 @@ static struct anarion_gmac *anarion_config_dt(struct platform_device *pdev)
gmac->ctl_block = ctl_block;
err = of_get_phy_mode(pdev->dev.of_node, &phy_mode);
if (err)
return ERR_PTR(err);
switch (phy_mode) {
switch (plat_dat->phy_interface) {
case PHY_INTERFACE_MODE_RGMII:
fallthrough;
case PHY_INTERFACE_MODE_RGMII_ID:
@@ -93,7 +90,7 @@ static struct anarion_gmac *anarion_config_dt(struct platform_device *pdev)
break;
default:
dev_err(&pdev->dev, "Unsupported phy-mode (%d)\n",
phy_mode);
plat_dat->phy_interface);
return ERR_PTR(-ENOTSUPP);
}
@@ -111,14 +108,14 @@ static int anarion_dwmac_probe(struct platform_device *pdev)
if (ret)
return ret;
gmac = anarion_config_dt(pdev);
if (IS_ERR(gmac))
return PTR_ERR(gmac);
plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac);
if (IS_ERR(plat_dat))
return PTR_ERR(plat_dat);
gmac = anarion_config_dt(pdev, plat_dat);
if (IS_ERR(gmac))
return PTR_ERR(gmac);
plat_dat->init = anarion_gmac_init;
plat_dat->exit = anarion_gmac_exit;
anarion_gmac_init(pdev, gmac);