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

Configure Feed

Select the types of activity you want to include in your feed.

net: phy: air_en8811h: deprecate "airoha,pnswap-rx" and "airoha,pnswap-tx"

Prefer the new "rx-polarity" and "tx-polarity" properties, and use the
vendor specific ones as fallback if the standard description doesn't
exist.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20260119091220.1493761-3-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Vladimir Oltean and committed by
Jakub Kicinski
66d8a334 44f62aa1

+39 -15
+1
drivers/net/phy/Kconfig
··· 98 98 99 99 config AIR_EN8811H_PHY 100 100 tristate "Airoha EN8811H 2.5 Gigabit PHY" 101 + select PHY_COMMON_PROPS 101 102 help 102 103 Currently supports the Airoha EN8811H PHY. 103 104
+38 -15
drivers/net/phy/air_en8811h.c
··· 14 14 #include <linux/clk.h> 15 15 #include <linux/clk-provider.h> 16 16 #include <linux/phy.h> 17 + #include <linux/phy/phy-common-props.h> 17 18 #include <linux/firmware.h> 18 19 #include <linux/property.h> 19 20 #include <linux/wordpart.h> ··· 967 966 return 0; 968 967 } 969 968 969 + static int en8811h_config_serdes_polarity(struct phy_device *phydev) 970 + { 971 + struct device *dev = &phydev->mdio.dev; 972 + unsigned int pol, default_pol; 973 + u32 pbus_value = 0; 974 + int ret; 975 + 976 + default_pol = PHY_POL_NORMAL; 977 + if (device_property_read_bool(dev, "airoha,pnswap-rx")) 978 + default_pol = PHY_POL_INVERT; 979 + 980 + ret = phy_get_rx_polarity(dev_fwnode(dev), phy_modes(phydev->interface), 981 + BIT(PHY_POL_NORMAL) | BIT(PHY_POL_INVERT), 982 + default_pol, &pol); 983 + if (ret) 984 + return ret; 985 + if (pol == PHY_POL_INVERT) 986 + pbus_value |= EN8811H_POLARITY_RX_REVERSE; 987 + 988 + default_pol = PHY_POL_NORMAL; 989 + if (device_property_read_bool(dev, "airoha,pnswap-tx")) 990 + default_pol = PHY_POL_INVERT; 991 + 992 + ret = phy_get_tx_polarity(dev_fwnode(dev), phy_modes(phydev->interface), 993 + BIT(PHY_POL_NORMAL) | BIT(PHY_POL_INVERT), 994 + default_pol, &pol); 995 + if (ret) 996 + return ret; 997 + if (pol == PHY_POL_NORMAL) 998 + pbus_value |= EN8811H_POLARITY_TX_NORMAL; 999 + 1000 + return air_buckpbus_reg_modify(phydev, EN8811H_POLARITY, 1001 + EN8811H_POLARITY_RX_REVERSE | 1002 + EN8811H_POLARITY_TX_NORMAL, pbus_value); 1003 + } 1004 + 970 1005 static int en8811h_config_init(struct phy_device *phydev) 971 1006 { 972 1007 struct en8811h_priv *priv = phydev->priv; 973 - struct device *dev = &phydev->mdio.dev; 974 - u32 pbus_value; 975 1008 int ret; 976 1009 977 1010 /* If restart happened in .probe(), no need to restart now */ ··· 1038 1003 if (ret < 0) 1039 1004 return ret; 1040 1005 1041 - /* Serdes polarity */ 1042 - pbus_value = 0; 1043 - if (device_property_read_bool(dev, "airoha,pnswap-rx")) 1044 - pbus_value |= EN8811H_POLARITY_RX_REVERSE; 1045 - else 1046 - pbus_value &= ~EN8811H_POLARITY_RX_REVERSE; 1047 - if (device_property_read_bool(dev, "airoha,pnswap-tx")) 1048 - pbus_value &= ~EN8811H_POLARITY_TX_NORMAL; 1049 - else 1050 - pbus_value |= EN8811H_POLARITY_TX_NORMAL; 1051 - ret = air_buckpbus_reg_modify(phydev, EN8811H_POLARITY, 1052 - EN8811H_POLARITY_RX_REVERSE | 1053 - EN8811H_POLARITY_TX_NORMAL, pbus_value); 1006 + ret = en8811h_config_serdes_polarity(phydev); 1054 1007 if (ret < 0) 1055 1008 return ret; 1056 1009