]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: stmmac: lpc18xx: validate phy_intf_sel
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thu, 6 Nov 2025 11:23:27 +0000 (11:23 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sat, 8 Nov 2025 03:05:48 +0000 (19:05 -0800)
Validate the phy_intf_sel value rather than the PHY interface mode.
This will allow us to transition to the ->set_phy_intf_sel() method.
Note that this will allow GMII as well as MII as the phy_intf_sel
value is the same for both.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1vGy5P-0000000DhQJ-0Oi3@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c

index 0f6be2a17e659d4016c5d6e6a7f12b5889f48d3c..ec60968113b83e08f3956cf67dc6452e07a26bc0 100644 (file)
@@ -47,14 +47,13 @@ static int lpc18xx_dwmac_probe(struct platform_device *pdev)
                return PTR_ERR(reg);
        }
 
-       if (plat_dat->phy_interface != PHY_INTERFACE_MODE_MII &&
-           plat_dat->phy_interface != PHY_INTERFACE_MODE_RMII) {
+       ethmode = stmmac_get_phy_intf_sel(plat_dat->phy_interface);
+       if (ethmode != PHY_INTF_SEL_GMII_MII &&
+           ethmode != PHY_INTF_SEL_RMII) {
                dev_err(&pdev->dev, "Only MII and RMII mode supported\n");
                return -EINVAL;
        }
 
-       ethmode = stmmac_get_phy_intf_sel(plat_dat->phy_interface);
-
        regmap_update_bits(reg, LPC18XX_CREG_CREG6,
                           LPC18XX_CREG_CREG6_ETHMODE_MASK, ethmode);