Re: [PATCH v5 net-next] net: phy: mediatek: support MT7530 PHYs on EN71221 MCM
From: Daniel Golle
Date: Tue Sep 15 2026 - 10:02:54 EST
On Tue, Sep 15, 2026 at 11:34:27AM +0000, Caleb James DeLisle wrote:
> [...]
> +/*
> + * MTK_GPHY_ID_MT7530 ID is also used for an EcoNet SoC FE phy, but that PHY
> + * does not advertise ESTATUS_1000_TFULL.
> + */
> +static bool mt7530_is_gphy(struct phy_device *phydev)
> +{
> + return phydev->phy_id == MTK_GPHY_ID_MT7530 &&
> + (phy_read(phydev, MII_ESTATUS) & ESTATUS_1000_TFULL) != 0;
> +}
> +
> +static int mt7530_phy_match(struct phy_device *phydev,
> + const struct phy_driver *phydrv)
> +{
> + return mt7530_is_gphy(phydev) && !en751221_is_mcm_phy(phydev);
> +}
> +
> +static int en751221_phy_match(struct phy_device *phydev,
> + const struct phy_driver *phydrv)
> +{
> + return mt7530_is_gphy(phydev) && en751221_is_mcm_phy(phydev);
> +}
> +
> static int mt7531_phy_config_init(struct phy_device *phydev)
> {
> mtk_gephy_config_init(phydev);
> @@ -135,6 +199,23 @@ static struct phy_driver mtk_gephy_driver[] = {
> */
> .config_intr = genphy_no_config_intr,
> .handle_interrupt = genphy_handle_interrupt_no_ack,
> + .match_phy_device = mt7530_phy_match,
> + .suspend = genphy_suspend,
> + .resume = genphy_resume,
> + .read_page = mtk_phy_read_page,
> + .write_page = mtk_phy_write_page,
> + },
> + {
> + PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7530),
I'd suggest to actually use phy_id and phy_id_mask assigned by the
PHY_ID_MATCH_EXACT macro by calling genphy_match_phy_device() in your
match functions above instead of open-coding the ID match.
Or drop PHY_ID_MATCH_EXACT from *both* drivers.