From 01c67a381c3e7dc70ad75b4d69ae3c82dff5afa8 Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Tue, 12 Apr 2022 10:31:34 -0300 Subject: phy: nxp-c45-tja11xx: Rename functions to be c45 tja11xx specific This driver supports NXP C45 TJA11XX PHYs, but there're also other NXP TJA11XX PHYs. Let's rename functions in this driver to be c45 variant specific, so further drivers can be introduced adding support for NXP TJA11XX PHYs. Signed-off-by: Ariel D'Alessandro --- drivers/net/phy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index d4731860f73..e61c9b8a178 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -530,7 +530,7 @@ int phy_init(void) phy_natsemi_init(); #endif #ifdef CONFIG_NXP_C45_TJA11XX_PHY - phy_nxp_tja11xx_init(); + phy_nxp_c45_tja11xx_init(); #endif #ifdef CONFIG_PHY_REALTEK phy_realtek_init(); -- cgit v1.2.3 From 087baf80ec70660b71ea578b20f357c24deb2ed4 Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Tue, 12 Apr 2022 10:31:36 -0300 Subject: net: phy: Add phy_modify() accessor Add read-modify-write unlocked accessor for accessing a PHY register. Signed-off-by: Ariel D'Alessandro Reviewed-by: Ramon Fried --- drivers/net/phy/phy.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index e61c9b8a178..50448cf62c4 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1110,3 +1110,23 @@ int phy_get_interface_by_name(const char *str) return -1; } + +/** + * phy_modify - Convenience function for modifying a given PHY register + * @phydev: the phy_device struct + * @devad: The MMD to read from + * @regnum: register number to write + * @mask: bit mask of bits to clear + * @set: new value of bits set in mask to write to @regnum + */ +int phy_modify(struct phy_device *phydev, int devad, int regnum, u16 mask, + u16 set) +{ + int ret; + + ret = phy_read(phydev, devad, regnum); + if (ret < 0) + return ret; + + return phy_write(phydev, devad, regnum, (ret & ~mask) | set); +} -- cgit v1.2.3 From a2f5c9366a42572f9d4aa49174ac117408bf7c12 Mon Sep 17 00:00:00 2001 From: Michael Trimarchi Date: Tue, 12 Apr 2022 10:31:37 -0300 Subject: net: phy: nxp-tja11xx: Add NXP TJA11xx PHY driver Add driver for the NXP TJA1100 and TJA1101 PHYs. These PHYs are special BroadRReach 100BaseT1 PHYs used in automotive. Signed-off-by: Michael Trimarchi Signed-off-by: Ariel D'Alessandro Reviewed-by: Ramon Fried --- drivers/net/phy/phy.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 50448cf62c4..36722620f0c 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -532,6 +532,9 @@ int phy_init(void) #ifdef CONFIG_NXP_C45_TJA11XX_PHY phy_nxp_c45_tja11xx_init(); #endif +#ifdef CONFIG_PHY_NXP_TJA11XX + phy_nxp_tja11xx_init(); +#endif #ifdef CONFIG_PHY_REALTEK phy_realtek_init(); #endif -- cgit v1.2.3