imx.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: phy: nxp-c45-tja11xx: fix the PHY ID mismatch issue when using C45
@ 2025-08-07  4:08 Clark Wang
  2025-08-12 10:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Clark Wang @ 2025-08-07  4:08 UTC (permalink / raw)
  To: andrei.botila
  Cc: andrew, ansuelsmth, davem, edumazet, hkallweit1, kuba, pabeni,
	rmk+kernel, sd, linux, linux-kernel, netdev, imx

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: 1b76b2497aba ("net: phy: nxp-c45-tja11xx: simplify .match_phy_device OP")
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
---
 drivers/net/phy/nxp-c45-tja11xx.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
index 4c6d905f0a9f..87adb6508017 100644
--- a/drivers/net/phy/nxp-c45-tja11xx.c
+++ b/drivers/net/phy/nxp-c45-tja11xx.c
@@ -1965,24 +1965,27 @@ static int nxp_c45_macsec_ability(struct phy_device *phydev)
 	return macsec_ability;
 }
 
+static bool tja11xx_phy_id_compare(struct phy_device *phydev,
+				   const struct phy_driver *phydrv)
+{
+	u32 id = phydev->is_c45 ? phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] :
+				  phydev->phy_id;
+
+	return phy_id_compare(id, phydrv->phy_id, phydrv->phy_id_mask);
+}
+
 static int tja11xx_no_macsec_match_phy_device(struct phy_device *phydev,
 					      const struct phy_driver *phydrv)
 {
-	if (!phy_id_compare(phydev->phy_id, phydrv->phy_id,
-			    phydrv->phy_id_mask))
-		return 0;
-
-	return !nxp_c45_macsec_ability(phydev);
+	return tja11xx_phy_id_compare(phydev, phydrv) &&
+	       !nxp_c45_macsec_ability(phydev);
 }
 
 static int tja11xx_macsec_match_phy_device(struct phy_device *phydev,
 					   const struct phy_driver *phydrv)
 {
-	if (!phy_id_compare(phydev->phy_id, phydrv->phy_id,
-			    phydrv->phy_id_mask))
-		return 0;
-
-	return nxp_c45_macsec_ability(phydev);
+	return tja11xx_phy_id_compare(phydev, phydrv) &&
+	       nxp_c45_macsec_ability(phydev);
 }
 
 static const struct nxp_c45_regmap tja1120_regmap = {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: phy: nxp-c45-tja11xx: fix the PHY ID mismatch issue when using C45
  2025-08-07  4:08 [PATCH net] net: phy: nxp-c45-tja11xx: fix the PHY ID mismatch issue when using C45 Clark Wang
@ 2025-08-12 10:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-12 10:40 UTC (permalink / raw)
  To: Clark Wang
  Cc: andrei.botila, andrew, ansuelsmth, davem, edumazet, hkallweit1,
	kuba, pabeni, rmk+kernel, sd, linux, linux-kernel, netdev, imx

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Thu,  7 Aug 2025 12:08:32 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net] net: phy: nxp-c45-tja11xx: fix the PHY ID mismatch issue when using C45
    https://git.kernel.org/netdev/net/c/8ee90742cf29

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-12 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07  4:08 [PATCH net] net: phy: nxp-c45-tja11xx: fix the PHY ID mismatch issue when using C45 Clark Wang
2025-08-12 10:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).