* [PATCH 1/2] net: phy: adin1100: Fix software power-down ready condition
[not found] <20251119124737.280939-1-ada@thorsis.com>
@ 2025-11-19 12:47 ` Alexander Dahl
2025-11-19 13:21 ` Russell King (Oracle)
2025-11-19 12:47 ` [PATCH 2/2] net: phy: adin1100: Simplify register value passing Alexander Dahl
1 sibling, 1 reply; 5+ messages in thread
From: Alexander Dahl @ 2025-11-19 12:47 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexandru Tachici,
Alexandru Ardelean, open list
Value CRSM_SFT_PD written to Software Power-Down Control Register
(CRSM_SFT_PD_CNTRL) is 0x01 and therefor different to value
CRSM_SFT_PD_RDY (0x02) read from System Status Register (CRSM_STAT) for
confirmation powerdown has been reached.
The condition could have only worked when disabling powerdown
(both 0x00), but never when enabling it (0x01 != 0x02).
Result is a timeout, like so:
$ ifdown eth0
macb f802c000.ethernet eth0: Link is Down
ADIN1100 f802c000.ethernet-ffffffff:01: adin_set_powerdown_mode failed: -110
ADIN1100 f802c000.ethernet-ffffffff:01: adin_set_powerdown_mode failed: -110
Fixes: 7eaf9132996a ("net: phy: adin1100: Add initial support for ADIN1100 industrial PHY")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
drivers/net/phy/adin1100.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/adin1100.c b/drivers/net/phy/adin1100.c
index bd7a47a903ac..10b796c2daee 100644
--- a/drivers/net/phy/adin1100.c
+++ b/drivers/net/phy/adin1100.c
@@ -201,7 +201,7 @@ static int adin_set_powerdown_mode(struct phy_device *phydev, bool en)
return ret;
return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, ADIN_CRSM_STAT, ret,
- (ret & ADIN_CRSM_SFT_PD_RDY) == val,
+ !!(ret & ADIN_CRSM_SFT_PD_RDY) == en,
1000, 30000, true);
}
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] net: phy: adin1100: Simplify register value passing
[not found] <20251119124737.280939-1-ada@thorsis.com>
2025-11-19 12:47 ` [PATCH 1/2] net: phy: adin1100: Fix software power-down ready condition Alexander Dahl
@ 2025-11-19 12:47 ` Alexander Dahl
2025-11-19 13:20 ` Russell King (Oracle)
1 sibling, 1 reply; 5+ messages in thread
From: Alexander Dahl @ 2025-11-19 12:47 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, open list
The additional use case for that variable is gone,
the expression is simple enough to pass it inline now.
Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
drivers/net/phy/adin1100.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/phy/adin1100.c b/drivers/net/phy/adin1100.c
index 10b796c2daee..8f9753d4318c 100644
--- a/drivers/net/phy/adin1100.c
+++ b/drivers/net/phy/adin1100.c
@@ -192,11 +192,10 @@ static irqreturn_t adin_phy_handle_interrupt(struct phy_device *phydev)
static int adin_set_powerdown_mode(struct phy_device *phydev, bool en)
{
int ret;
- int val;
- val = en ? ADIN_CRSM_SFT_PD_CNTRL_EN : 0;
ret = phy_write_mmd(phydev, MDIO_MMD_VEND1,
- ADIN_CRSM_SFT_PD_CNTRL, val);
+ ADIN_CRSM_SFT_PD_CNTRL,
+ en ? ADIN_CRSM_SFT_PD_CNTRL_EN : 0);
if (ret < 0)
return ret;
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] net: phy: adin1100: Simplify register value passing
2025-11-19 12:47 ` [PATCH 2/2] net: phy: adin1100: Simplify register value passing Alexander Dahl
@ 2025-11-19 13:20 ` Russell King (Oracle)
2025-11-19 13:22 ` Russell King (Oracle)
0 siblings, 1 reply; 5+ messages in thread
From: Russell King (Oracle) @ 2025-11-19 13:20 UTC (permalink / raw)
To: Alexander Dahl
Cc: netdev, Andrew Lunn, Heiner Kallweit, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, open list
On Wed, Nov 19, 2025 at 01:47:37PM +0100, Alexander Dahl wrote:
> The additional use case for that variable is gone,
> the expression is simple enough to pass it inline now.
Looking at net-next, this patch is wrong. You remove "val" but the code
after the context in this patch is:
return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, ADIN_CRSM_STAT, ret,
(ret & ADIN_CRSM_SFT_PD_RDY) == val,
1000, 30000, true);
which also references "val".
Note that this code is buggy as things stand. "val" will be zero (when
en is false) or 1 (when en is true), whereas ADIN_CRSM_SFT_PD_RDY is 2.
Thus, if en is true, then the condition can never be true.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] net: phy: adin1100: Fix software power-down ready condition
2025-11-19 12:47 ` [PATCH 1/2] net: phy: adin1100: Fix software power-down ready condition Alexander Dahl
@ 2025-11-19 13:21 ` Russell King (Oracle)
0 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2025-11-19 13:21 UTC (permalink / raw)
To: Alexander Dahl
Cc: netdev, Andrew Lunn, Heiner Kallweit, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexandru Tachici,
Alexandru Ardelean, open list
On Wed, Nov 19, 2025 at 01:47:36PM +0100, Alexander Dahl wrote:
> Value CRSM_SFT_PD written to Software Power-Down Control Register
> (CRSM_SFT_PD_CNTRL) is 0x01 and therefor different to value
> CRSM_SFT_PD_RDY (0x02) read from System Status Register (CRSM_STAT) for
> confirmation powerdown has been reached.
>
> The condition could have only worked when disabling powerdown
> (both 0x00), but never when enabling it (0x01 != 0x02).
>
> Result is a timeout, like so:
>
> $ ifdown eth0
> macb f802c000.ethernet eth0: Link is Down
> ADIN1100 f802c000.ethernet-ffffffff:01: adin_set_powerdown_mode failed: -110
> ADIN1100 f802c000.ethernet-ffffffff:01: adin_set_powerdown_mode failed: -110
>
> Fixes: 7eaf9132996a ("net: phy: adin1100: Add initial support for ADIN1100 industrial PHY")
> Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thanks!
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] net: phy: adin1100: Simplify register value passing
2025-11-19 13:20 ` Russell King (Oracle)
@ 2025-11-19 13:22 ` Russell King (Oracle)
0 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2025-11-19 13:22 UTC (permalink / raw)
To: Alexander Dahl
Cc: netdev, Andrew Lunn, Heiner Kallweit, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, open list
On Wed, Nov 19, 2025 at 01:20:51PM +0000, Russell King (Oracle) wrote:
> On Wed, Nov 19, 2025 at 01:47:37PM +0100, Alexander Dahl wrote:
> > The additional use case for that variable is gone,
> > the expression is simple enough to pass it inline now.
>
> Looking at net-next, this patch is wrong. You remove "val" but the code
> after the context in this patch is:
>
> return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, ADIN_CRSM_STAT, ret,
> (ret & ADIN_CRSM_SFT_PD_RDY) == val,
> 1000, 30000, true);
>
> which also references "val".
>
> Note that this code is buggy as things stand. "val" will be zero (when
> en is false) or 1 (when en is true), whereas ADIN_CRSM_SFT_PD_RDY is 2.
> Thus, if en is true, then the condition can never be true.
Sorry, missed the first patch (the two patches arrived in reverse
order.) Please ignore this comment.
For the patch:
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thanks!
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-19 13:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20251119124737.280939-1-ada@thorsis.com>
2025-11-19 12:47 ` [PATCH 1/2] net: phy: adin1100: Fix software power-down ready condition Alexander Dahl
2025-11-19 13:21 ` Russell King (Oracle)
2025-11-19 12:47 ` [PATCH 2/2] net: phy: adin1100: Simplify register value passing Alexander Dahl
2025-11-19 13:20 ` Russell King (Oracle)
2025-11-19 13:22 ` Russell King (Oracle)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox