net: phy: qca808x: handle the active-high LED polarity mode
Subsystems (5)
PATCH 1/1 net: phy: qca808x: handle the active-high LED polarity mode
Commit a274465cc3be ("net: phy: support 'active-high' property for PHY LEDs") added PHY_LED_ACTIVE_HIGH but did not cover qca808x, so qca808x_led_polarity_set() returns -EINVAL for it. phy_probe() propagates that, leaving the mdio device unbound and phy_attach_direct() falling back to the genphy driver.
Accepting the mode alone is not enough: led_polarity_mode records active_low, so an explicit 'active-high' node stores 0, while qca808x_config_init() re-asserts QCA808X_LED_ACTIVE_HIGH only for -1. The bit does not survive the reset phy_init_hw() runs first, so the LED would come up active-low.
---
Supersedes [PATCH net v3 3/3] ([email protected]); 1/3 and 2/3 are in mainline. Andrew Lunn's Reviewed-by on v3 3/3 is dropped -- this changes behavior.
Compile-tested only (W=1, sparse). I have no QCA808x hardware, and there is no KUnit suite or MDIO mock under drivers/net/phy to exercise the MMD7 write without it.
drivers/net/phy/qcom/qca808x.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/phy/qcom/qca808x.c +5 -2
@@ -200,8 +200,8 @@ static int qca808x_config_init(struct phy_device *phydev)struct qca808x_priv *priv = phydev->priv;int ret; -/* Default to LED Active High if active-low not in DT */ -if (priv->led_polarity_mode ==-1 ) { +/* Set LED Active High unless active-low was requested in DT */ +if (priv->led_polarity_mode !=1 ) { ret =phy_set_bits_mmd (phydev,MDIO_MMD_AN ,QCA808X_MMD7_LED_POLARITY_CTRL ,QCA808X_LED_ACTIVE_HIGH );
@@ -603,6 +603,9 @@ static int qca808x_led_polarity_set(struct phy_device *phydev, int index,case PHY_LED_ACTIVE_LOW : active_low = true;break ; +case PHY_LED_ACTIVE_HIGH : + active_low = false; +break ;default :return -EINVAL ; }
Signature · 1 line
2.53.0
Andrew Lunn
maintainerQuoted 1 line
Compile-tested only (W=1, sparse). I have no QCA808x hardware
Please try Rosen Penev <[email protected]> and Christian Marangi <[email protected]>. They might have hardware to test on.
Andrew
---
pw-bot: cr