Commit 4fb67904 authored by Horatiu Vultur's avatar Horatiu Vultur Committed by Jakub Kicinski

net: micrel: Fix lan8841_config_intr after getting out of sleep mode

When the interrupt is enabled, the function lan8841_config_intr tries to
clear any pending interrupts by reading the interrupt status, then
checks the return value for errors and then continue to enable the
interrupt. It has been seen that once the system gets out of sleep mode,
the interrupt status has the value 0x400 meaning that the PHY detected
that the link was in low power. That is correct value but the problem is
that the check is wrong.  We try to check for errors but we return an
error also in this case which is not an error. Therefore fix this by
returning only when there is an error.

Fixes: a8f1a19d ("net: micrel: Add support for lan8841 PHY")
Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: default avatarSuman Ghosh <sumang@marvell.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/20240524085350.359812-1-horatiu.vultur@microchip.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent bf0497f5
...@@ -4029,7 +4029,7 @@ static int lan8841_config_intr(struct phy_device *phydev) ...@@ -4029,7 +4029,7 @@ static int lan8841_config_intr(struct phy_device *phydev)
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
err = phy_read(phydev, LAN8814_INTS); err = phy_read(phydev, LAN8814_INTS);
if (err) if (err < 0)
return err; return err;
/* Enable / disable interrupts. It is OK to enable PTP interrupt /* Enable / disable interrupts. It is OK to enable PTP interrupt
...@@ -4045,6 +4045,14 @@ static int lan8841_config_intr(struct phy_device *phydev) ...@@ -4045,6 +4045,14 @@ static int lan8841_config_intr(struct phy_device *phydev)
return err; return err;
err = phy_read(phydev, LAN8814_INTS); err = phy_read(phydev, LAN8814_INTS);
if (err < 0)
return err;
/* Getting a positive value doesn't mean that is an error, it
* just indicates what was the status. Therefore make sure to
* clear the value and say that there is no error.
*/
err = 0;
} }
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment