Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'net-phy-nxp-c45-tja11xx-add-support-for-tja1121'

Andrei Botila says:

====================
net: phy: nxp-c45-tja11xx: add support for TJA1121

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.
====================

Link: https://patch.msgid.link/20250228154320.2979000-1-andrei.botila@oss.nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+92 -4
+1 -1
drivers/net/phy/Kconfig
··· 328 328 depends on MACSEC || !MACSEC 329 329 help 330 330 Enable support for NXP C45 TJA11XX PHYs. 331 - Currently supports the TJA1103, TJA1104 and TJA1120 PHYs. 331 + Currently supports the TJA1103, TJA1104, TJA1120 and TJA1121 PHYs. 332 332 333 333 config NXP_TJA11XX_PHY 334 334 tristate "NXP TJA11xx PHYs support"
+91 -3
drivers/net/phy/nxp-c45-tja11xx.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* NXP C45 PHY driver 3 - * Copyright 2021-2023 NXP 3 + * Copyright 2021-2025 NXP 4 4 * Author: Radu Pirea <radu-nicolae.pirea@oss.nxp.com> 5 5 */ 6 6 ··· 19 19 20 20 #include "nxp-c45-tja11xx.h" 21 21 22 + #define PHY_ID_MASK GENMASK(31, 4) 23 + /* Same id: TJA1103, TJA1104 */ 22 24 #define PHY_ID_TJA_1103 0x001BB010 25 + /* Same id: TJA1120, TJA1121 */ 23 26 #define PHY_ID_TJA_1120 0x001BB031 24 27 25 28 #define VEND1_DEVICE_CONTROL 0x0040 ··· 1891 1888 } 1892 1889 } 1893 1890 1891 + static int nxp_c45_macsec_ability(struct phy_device *phydev) 1892 + { 1893 + bool macsec_ability; 1894 + int phy_abilities; 1895 + 1896 + phy_abilities = phy_read_mmd(phydev, MDIO_MMD_VEND1, 1897 + VEND1_PORT_ABILITIES); 1898 + macsec_ability = !!(phy_abilities & MACSEC_ABILITY); 1899 + 1900 + return macsec_ability; 1901 + } 1902 + 1903 + static int tja1103_match_phy_device(struct phy_device *phydev) 1904 + { 1905 + return phy_id_compare(phydev->phy_id, PHY_ID_TJA_1103, PHY_ID_MASK) && 1906 + !nxp_c45_macsec_ability(phydev); 1907 + } 1908 + 1909 + static int tja1104_match_phy_device(struct phy_device *phydev) 1910 + { 1911 + return phy_id_compare(phydev->phy_id, PHY_ID_TJA_1103, PHY_ID_MASK) && 1912 + nxp_c45_macsec_ability(phydev); 1913 + } 1914 + 1915 + static int tja1120_match_phy_device(struct phy_device *phydev) 1916 + { 1917 + return phy_id_compare(phydev->phy_id, PHY_ID_TJA_1120, PHY_ID_MASK) && 1918 + !nxp_c45_macsec_ability(phydev); 1919 + } 1920 + 1921 + static int tja1121_match_phy_device(struct phy_device *phydev) 1922 + { 1923 + return phy_id_compare(phydev->phy_id, PHY_ID_TJA_1120, PHY_ID_MASK) && 1924 + nxp_c45_macsec_ability(phydev); 1925 + } 1926 + 1894 1927 static const struct nxp_c45_regmap tja1120_regmap = { 1895 1928 .vend1_ptp_clk_period = 0x1020, 1896 1929 .vend1_event_msg_filt = 0x9010, ··· 1997 1958 1998 1959 static struct phy_driver nxp_c45_driver[] = { 1999 1960 { 2000 - PHY_ID_MATCH_MODEL(PHY_ID_TJA_1103), 2001 1961 .name = "NXP C45 TJA1103", 2002 1962 .get_features = nxp_c45_get_features, 2003 1963 .driver_data = &tja1103_phy_data, ··· 2018 1980 .get_sqi = nxp_c45_get_sqi, 2019 1981 .get_sqi_max = nxp_c45_get_sqi_max, 2020 1982 .remove = nxp_c45_remove, 1983 + .match_phy_device = tja1103_match_phy_device, 2021 1984 }, 2022 1985 { 2023 - PHY_ID_MATCH_MODEL(PHY_ID_TJA_1120), 1986 + .name = "NXP C45 TJA1104", 1987 + .get_features = nxp_c45_get_features, 1988 + .driver_data = &tja1103_phy_data, 1989 + .probe = nxp_c45_probe, 1990 + .soft_reset = nxp_c45_soft_reset, 1991 + .config_aneg = genphy_c45_config_aneg, 1992 + .config_init = nxp_c45_config_init, 1993 + .config_intr = tja1103_config_intr, 1994 + .handle_interrupt = nxp_c45_handle_interrupt, 1995 + .read_status = genphy_c45_read_status, 1996 + .suspend = genphy_c45_pma_suspend, 1997 + .resume = genphy_c45_pma_resume, 1998 + .get_sset_count = nxp_c45_get_sset_count, 1999 + .get_strings = nxp_c45_get_strings, 2000 + .get_stats = nxp_c45_get_stats, 2001 + .cable_test_start = nxp_c45_cable_test_start, 2002 + .cable_test_get_status = nxp_c45_cable_test_get_status, 2003 + .set_loopback = genphy_c45_loopback, 2004 + .get_sqi = nxp_c45_get_sqi, 2005 + .get_sqi_max = nxp_c45_get_sqi_max, 2006 + .remove = nxp_c45_remove, 2007 + .match_phy_device = tja1104_match_phy_device, 2008 + }, 2009 + { 2024 2010 .name = "NXP C45 TJA1120", 2025 2011 .get_features = nxp_c45_get_features, 2026 2012 .driver_data = &tja1120_phy_data, ··· 2067 2005 .get_sqi = nxp_c45_get_sqi, 2068 2006 .get_sqi_max = nxp_c45_get_sqi_max, 2069 2007 .remove = nxp_c45_remove, 2008 + .match_phy_device = tja1120_match_phy_device, 2009 + }, 2010 + { 2011 + .name = "NXP C45 TJA1121", 2012 + .get_features = nxp_c45_get_features, 2013 + .driver_data = &tja1120_phy_data, 2014 + .probe = nxp_c45_probe, 2015 + .soft_reset = nxp_c45_soft_reset, 2016 + .config_aneg = genphy_c45_config_aneg, 2017 + .config_init = nxp_c45_config_init, 2018 + .config_intr = tja1120_config_intr, 2019 + .handle_interrupt = nxp_c45_handle_interrupt, 2020 + .read_status = genphy_c45_read_status, 2021 + .link_change_notify = tja1120_link_change_notify, 2022 + .suspend = genphy_c45_pma_suspend, 2023 + .resume = genphy_c45_pma_resume, 2024 + .get_sset_count = nxp_c45_get_sset_count, 2025 + .get_strings = nxp_c45_get_strings, 2026 + .get_stats = nxp_c45_get_stats, 2027 + .cable_test_start = nxp_c45_cable_test_start, 2028 + .cable_test_get_status = nxp_c45_cable_test_get_status, 2029 + .set_loopback = genphy_c45_loopback, 2030 + .get_sqi = nxp_c45_get_sqi, 2031 + .get_sqi_max = nxp_c45_get_sqi_max, 2032 + .remove = nxp_c45_remove, 2033 + .match_phy_device = tja1121_match_phy_device, 2070 2034 }, 2071 2035 }; 2072 2036