Skip to content

Commit 8ee9074

Browse files
wangxiaoningnxpPaolo Abeni
authored andcommitted
net: phy: nxp-c45-tja11xx: fix the PHY ID mismatch issue when using C45
TJA1103/04/20/21 support both C22 and C45 accessing methods. The TJA11xx driver has implemented the match_phy_device() API. However, it does not handle the C45 ID. If C45 was used to access TJA11xx, match_phy_device() would always return false due to phydev->phy_id only used by C22 being empty, resulting in the generic phy driver being used for TJA11xx PHYs. Therefore, check phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] when using C45. Fixes: 1b76b24 ("net: phy: nxp-c45-tja11xx: simplify .match_phy_device OP") Signed-off-by: Clark Wang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 89886ab commit 8ee9074

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

drivers/net/phy/nxp-c45-tja11xx.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,24 +1965,27 @@ static int nxp_c45_macsec_ability(struct phy_device *phydev)
19651965
return macsec_ability;
19661966
}
19671967

1968+
static bool tja11xx_phy_id_compare(struct phy_device *phydev,
1969+
const struct phy_driver *phydrv)
1970+
{
1971+
u32 id = phydev->is_c45 ? phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] :
1972+
phydev->phy_id;
1973+
1974+
return phy_id_compare(id, phydrv->phy_id, phydrv->phy_id_mask);
1975+
}
1976+
19681977
static int tja11xx_no_macsec_match_phy_device(struct phy_device *phydev,
19691978
const struct phy_driver *phydrv)
19701979
{
1971-
if (!phy_id_compare(phydev->phy_id, phydrv->phy_id,
1972-
phydrv->phy_id_mask))
1973-
return 0;
1974-
1975-
return !nxp_c45_macsec_ability(phydev);
1980+
return tja11xx_phy_id_compare(phydev, phydrv) &&
1981+
!nxp_c45_macsec_ability(phydev);
19761982
}
19771983

19781984
static int tja11xx_macsec_match_phy_device(struct phy_device *phydev,
19791985
const struct phy_driver *phydrv)
19801986
{
1981-
if (!phy_id_compare(phydev->phy_id, phydrv->phy_id,
1982-
phydrv->phy_id_mask))
1983-
return 0;
1984-
1985-
return nxp_c45_macsec_ability(phydev);
1987+
return tja11xx_phy_id_compare(phydev, phydrv) &&
1988+
nxp_c45_macsec_ability(phydev);
19861989
}
19871990

19881991
static const struct nxp_c45_regmap tja1120_regmap = {

0 commit comments

Comments
 (0)