The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/2] net: phy: nxp-c45-tja11xx: add support for TJA1121
@ 2025-02-28 15:43 Andrei Botila
  2025-02-28 15:43 ` [PATCH net-next v2 1/2] net: phy: nxp-c45-tja11xx: add match_phy_device to TJA1103/TJA1104 Andrei Botila
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andrei Botila @ 2025-02-28 15:43 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, s32, Christophe Lizzi, Alberto Ruiz,
	Enric Balletbo, Andrei Botila

This patch series adds .match_phy_device for the existing TJAs
to differentiate between TJA1103/TJA1104 and TJA1120/TJA1121.
TJA1103 and TJA1104 share the same PHY_ID but TJA1104 has MACsec
capabilities while TJA1103 doesn't.
Also add support for TJA1121 which is based on TJA1120 hardware
with additional MACsec IP.

Changes in v2:
- add .match_phy_device
- removed errata from v1, will be sent to net for backporting

Andrei Botila (2):
  net: phy: nxp-c45-tja11xx: add match_phy_device to TJA1103/TJA1104
  net: phy: nxp-c45-tja11xx: add support for TJA1121

 drivers/net/phy/Kconfig           |  2 +-
 drivers/net/phy/nxp-c45-tja11xx.c | 94 ++++++++++++++++++++++++++++++-
 2 files changed, 92 insertions(+), 4 deletions(-)

-- 
2.48.1


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

* [PATCH net-next v2 1/2] net: phy: nxp-c45-tja11xx: add match_phy_device to TJA1103/TJA1104
  2025-02-28 15:43 [PATCH net-next v2 0/2] net: phy: nxp-c45-tja11xx: add support for TJA1121 Andrei Botila
@ 2025-02-28 15:43 ` Andrei Botila
  2025-02-28 16:40   ` Andrew Lunn
  2025-02-28 15:43 ` [PATCH net-next v2 2/2] net: phy: nxp-c45-tja11xx: add support for TJA1121 Andrei Botila
  2025-03-05  1:20 ` [PATCH net-next v2 0/2] " patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Andrei Botila @ 2025-02-28 15:43 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, s32, Christophe Lizzi, Alberto Ruiz,
	Enric Balletbo, Andrei Botila

Add .match_phy_device for the existing TJAs to differentiate between
TJA1103 and TJA1104.
TJA1103 and TJA1104 share the same PHY_ID but TJA1104 has MACsec
capabilities while TJA1103 doesn't.

Signed-off-by: Andrei Botila <andrei.botila@oss.nxp.com>
---
 drivers/net/phy/nxp-c45-tja11xx.c | 54 +++++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
index 34231b5b9175..4013a17c205a 100644
--- a/drivers/net/phy/nxp-c45-tja11xx.c
+++ b/drivers/net/phy/nxp-c45-tja11xx.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /* NXP C45 PHY driver
- * Copyright 2021-2023 NXP
+ * Copyright 2021-2025 NXP
  * Author: Radu Pirea <radu-nicolae.pirea@oss.nxp.com>
  */
 
@@ -19,6 +19,8 @@
 
 #include "nxp-c45-tja11xx.h"
 
+#define PHY_ID_MASK			GENMASK(31, 4)
+/* Same id: TJA1103, TJA1104 */
 #define PHY_ID_TJA_1103			0x001BB010
 #define PHY_ID_TJA_1120			0x001BB031
 
@@ -1888,6 +1890,30 @@ static void tja1120_nmi_handler(struct phy_device *phydev,
 	}
 }
 
+static int nxp_c45_macsec_ability(struct phy_device *phydev)
+{
+	bool macsec_ability;
+	int phy_abilities;
+
+	phy_abilities = phy_read_mmd(phydev, MDIO_MMD_VEND1,
+				     VEND1_PORT_ABILITIES);
+	macsec_ability = !!(phy_abilities & MACSEC_ABILITY);
+
+	return macsec_ability;
+}
+
+static int tja1103_match_phy_device(struct phy_device *phydev)
+{
+	return phy_id_compare(phydev->phy_id, PHY_ID_TJA_1103, PHY_ID_MASK) &&
+	       !nxp_c45_macsec_ability(phydev);
+}
+
+static int tja1104_match_phy_device(struct phy_device *phydev)
+{
+	return phy_id_compare(phydev->phy_id, PHY_ID_TJA_1103, PHY_ID_MASK) &&
+	       nxp_c45_macsec_ability(phydev);
+}
+
 static const struct nxp_c45_regmap tja1120_regmap = {
 	.vend1_ptp_clk_period	= 0x1020,
 	.vend1_event_msg_filt	= 0x9010,
@@ -1958,7 +1984,6 @@ static const struct nxp_c45_phy_data tja1120_phy_data = {
 
 static struct phy_driver nxp_c45_driver[] = {
 	{
-		PHY_ID_MATCH_MODEL(PHY_ID_TJA_1103),
 		.name			= "NXP C45 TJA1103",
 		.get_features		= nxp_c45_get_features,
 		.driver_data		= &tja1103_phy_data,
@@ -1980,6 +2005,31 @@ static struct phy_driver nxp_c45_driver[] = {
 		.get_sqi		= nxp_c45_get_sqi,
 		.get_sqi_max		= nxp_c45_get_sqi_max,
 		.remove			= nxp_c45_remove,
+		.match_phy_device	= tja1103_match_phy_device,
+	},
+	{
+		.name			= "NXP C45 TJA1104",
+		.get_features		= nxp_c45_get_features,
+		.driver_data		= &tja1103_phy_data,
+		.probe			= nxp_c45_probe,
+		.soft_reset		= nxp_c45_soft_reset,
+		.config_aneg		= genphy_c45_config_aneg,
+		.config_init		= nxp_c45_config_init,
+		.config_intr		= tja1103_config_intr,
+		.handle_interrupt	= nxp_c45_handle_interrupt,
+		.read_status		= genphy_c45_read_status,
+		.suspend		= genphy_c45_pma_suspend,
+		.resume			= genphy_c45_pma_resume,
+		.get_sset_count		= nxp_c45_get_sset_count,
+		.get_strings		= nxp_c45_get_strings,
+		.get_stats		= nxp_c45_get_stats,
+		.cable_test_start	= nxp_c45_cable_test_start,
+		.cable_test_get_status	= nxp_c45_cable_test_get_status,
+		.set_loopback		= genphy_c45_loopback,
+		.get_sqi		= nxp_c45_get_sqi,
+		.get_sqi_max		= nxp_c45_get_sqi_max,
+		.remove			= nxp_c45_remove,
+		.match_phy_device	= tja1104_match_phy_device,
 	},
 	{
 		PHY_ID_MATCH_MODEL(PHY_ID_TJA_1120),
-- 
2.48.1


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

* [PATCH net-next v2 2/2] net: phy: nxp-c45-tja11xx: add support for TJA1121
  2025-02-28 15:43 [PATCH net-next v2 0/2] net: phy: nxp-c45-tja11xx: add support for TJA1121 Andrei Botila
  2025-02-28 15:43 ` [PATCH net-next v2 1/2] net: phy: nxp-c45-tja11xx: add match_phy_device to TJA1103/TJA1104 Andrei Botila
@ 2025-02-28 15:43 ` Andrei Botila
  2025-02-28 16:41   ` Andrew Lunn
  2025-03-05  1:20 ` [PATCH net-next v2 0/2] " patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Andrei Botila @ 2025-02-28 15:43 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, s32, Christophe Lizzi, Alberto Ruiz,
	Enric Balletbo, Andrei Botila

Add support for TJA1121 which is based on TJA1120 but with
additional MACsec IP.

Signed-off-by: Andrei Botila <andrei.botila@oss.nxp.com>
---
 drivers/net/phy/Kconfig           |  2 +-
 drivers/net/phy/nxp-c45-tja11xx.c | 40 ++++++++++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 41c15a2c2037..d29f9f7fd2e1 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -328,7 +328,7 @@ config NXP_C45_TJA11XX_PHY
 	depends on MACSEC || !MACSEC
 	help
 	  Enable support for NXP C45 TJA11XX PHYs.
-	  Currently supports the TJA1103, TJA1104 and TJA1120 PHYs.
+	  Currently supports the TJA1103, TJA1104, TJA1120 and TJA1121 PHYs.
 
 config NXP_TJA11XX_PHY
 	tristate "NXP TJA11xx PHYs support"
diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
index 4013a17c205a..63945fe58227 100644
--- a/drivers/net/phy/nxp-c45-tja11xx.c
+++ b/drivers/net/phy/nxp-c45-tja11xx.c
@@ -22,6 +22,7 @@
 #define PHY_ID_MASK			GENMASK(31, 4)
 /* Same id: TJA1103, TJA1104 */
 #define PHY_ID_TJA_1103			0x001BB010
+/* Same id: TJA1120, TJA1121 */
 #define PHY_ID_TJA_1120			0x001BB031
 
 #define VEND1_DEVICE_CONTROL		0x0040
@@ -1914,6 +1915,18 @@ static int tja1104_match_phy_device(struct phy_device *phydev)
 	       nxp_c45_macsec_ability(phydev);
 }
 
+static int tja1120_match_phy_device(struct phy_device *phydev)
+{
+	return phy_id_compare(phydev->phy_id, PHY_ID_TJA_1120, PHY_ID_MASK) &&
+	       !nxp_c45_macsec_ability(phydev);
+}
+
+static int tja1121_match_phy_device(struct phy_device *phydev)
+{
+	return phy_id_compare(phydev->phy_id, PHY_ID_TJA_1120, PHY_ID_MASK) &&
+	       nxp_c45_macsec_ability(phydev);
+}
+
 static const struct nxp_c45_regmap tja1120_regmap = {
 	.vend1_ptp_clk_period	= 0x1020,
 	.vend1_event_msg_filt	= 0x9010,
@@ -2032,7 +2045,6 @@ static struct phy_driver nxp_c45_driver[] = {
 		.match_phy_device	= tja1104_match_phy_device,
 	},
 	{
-		PHY_ID_MATCH_MODEL(PHY_ID_TJA_1120),
 		.name			= "NXP C45 TJA1120",
 		.get_features		= nxp_c45_get_features,
 		.driver_data		= &tja1120_phy_data,
@@ -2055,6 +2067,32 @@ static struct phy_driver nxp_c45_driver[] = {
 		.get_sqi		= nxp_c45_get_sqi,
 		.get_sqi_max		= nxp_c45_get_sqi_max,
 		.remove			= nxp_c45_remove,
+		.match_phy_device	= tja1120_match_phy_device,
+	},
+	{
+		.name			= "NXP C45 TJA1121",
+		.get_features		= nxp_c45_get_features,
+		.driver_data		= &tja1120_phy_data,
+		.probe			= nxp_c45_probe,
+		.soft_reset		= nxp_c45_soft_reset,
+		.config_aneg		= genphy_c45_config_aneg,
+		.config_init		= nxp_c45_config_init,
+		.config_intr		= tja1120_config_intr,
+		.handle_interrupt	= nxp_c45_handle_interrupt,
+		.read_status		= genphy_c45_read_status,
+		.link_change_notify	= tja1120_link_change_notify,
+		.suspend		= genphy_c45_pma_suspend,
+		.resume			= genphy_c45_pma_resume,
+		.get_sset_count		= nxp_c45_get_sset_count,
+		.get_strings		= nxp_c45_get_strings,
+		.get_stats		= nxp_c45_get_stats,
+		.cable_test_start	= nxp_c45_cable_test_start,
+		.cable_test_get_status	= nxp_c45_cable_test_get_status,
+		.set_loopback		= genphy_c45_loopback,
+		.get_sqi		= nxp_c45_get_sqi,
+		.get_sqi_max		= nxp_c45_get_sqi_max,
+		.remove			= nxp_c45_remove,
+		.match_phy_device	= tja1121_match_phy_device,
 	},
 };
 
-- 
2.48.1


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

* Re: [PATCH net-next v2 1/2] net: phy: nxp-c45-tja11xx: add match_phy_device to TJA1103/TJA1104
  2025-02-28 15:43 ` [PATCH net-next v2 1/2] net: phy: nxp-c45-tja11xx: add match_phy_device to TJA1103/TJA1104 Andrei Botila
@ 2025-02-28 16:40   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2025-02-28 16:40 UTC (permalink / raw)
  To: Andrei Botila
  Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel, s32,
	Christophe Lizzi, Alberto Ruiz, Enric Balletbo

On Fri, Feb 28, 2025 at 05:43:19PM +0200, Andrei Botila wrote:
> Add .match_phy_device for the existing TJAs to differentiate between
> TJA1103 and TJA1104.
> TJA1103 and TJA1104 share the same PHY_ID but TJA1104 has MACsec
> capabilities while TJA1103 doesn't.
> 
> Signed-off-by: Andrei Botila <andrei.botila@oss.nxp.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v2 2/2] net: phy: nxp-c45-tja11xx: add support for TJA1121
  2025-02-28 15:43 ` [PATCH net-next v2 2/2] net: phy: nxp-c45-tja11xx: add support for TJA1121 Andrei Botila
@ 2025-02-28 16:41   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2025-02-28 16:41 UTC (permalink / raw)
  To: Andrei Botila
  Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel, s32,
	Christophe Lizzi, Alberto Ruiz, Enric Balletbo

On Fri, Feb 28, 2025 at 05:43:20PM +0200, Andrei Botila wrote:
> Add support for TJA1121 which is based on TJA1120 but with
> additional MACsec IP.
> 
> Signed-off-by: Andrei Botila <andrei.botila@oss.nxp.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v2 0/2] net: phy: nxp-c45-tja11xx: add support for TJA1121
  2025-02-28 15:43 [PATCH net-next v2 0/2] net: phy: nxp-c45-tja11xx: add support for TJA1121 Andrei Botila
  2025-02-28 15:43 ` [PATCH net-next v2 1/2] net: phy: nxp-c45-tja11xx: add match_phy_device to TJA1103/TJA1104 Andrei Botila
  2025-02-28 15:43 ` [PATCH net-next v2 2/2] net: phy: nxp-c45-tja11xx: add support for TJA1121 Andrei Botila
@ 2025-03-05  1:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-05  1:20 UTC (permalink / raw)
  To: Andrei Botila
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, s32, clizzi, aruizrui, eballetb

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 28 Feb 2025 17:43:18 +0200 you wrote:
> This patch series adds .match_phy_device for the existing TJAs
> to differentiate between TJA1103/TJA1104 and TJA1120/TJA1121.
> TJA1103 and TJA1104 share the same PHY_ID but TJA1104 has MACsec
> capabilities while TJA1103 doesn't.
> Also add support for TJA1121 which is based on TJA1120 hardware
> with additional MACsec IP.
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/2] net: phy: nxp-c45-tja11xx: add match_phy_device to TJA1103/TJA1104
    https://git.kernel.org/netdev/net-next/c/a06a868a0cd9
  - [net-next,v2,2/2] net: phy: nxp-c45-tja11xx: add support for TJA1121
    https://git.kernel.org/netdev/net-next/c/7215e9375694

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] 6+ messages in thread

end of thread, other threads:[~2025-03-05  1:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-28 15:43 [PATCH net-next v2 0/2] net: phy: nxp-c45-tja11xx: add support for TJA1121 Andrei Botila
2025-02-28 15:43 ` [PATCH net-next v2 1/2] net: phy: nxp-c45-tja11xx: add match_phy_device to TJA1103/TJA1104 Andrei Botila
2025-02-28 16:40   ` Andrew Lunn
2025-02-28 15:43 ` [PATCH net-next v2 2/2] net: phy: nxp-c45-tja11xx: add support for TJA1121 Andrei Botila
2025-02-28 16:41   ` Andrew Lunn
2025-03-05  1:20 ` [PATCH net-next v2 0/2] " 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