* [PATCH] net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset
@ 2025-01-16 14:55 Milos Reljin
2025-01-20 22:47 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: Milos Reljin @ 2025-01-16 14:55 UTC (permalink / raw)
To: andrei.botila, andrew, hkallweit1, linux, davem, edumazet, kuba,
pabeni, netdev, linux-kernel
Cc: milos.reljin
Add delay before first MDIO read following MDIO write in soft_reset
function. Without this, soft_reset fails and PHY init cannot complete.
Signed-off-by: Milos Reljin <milos_reljin@outlook.com>
---
drivers/net/phy/nxp-c45-tja11xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
index ade544bc007d..be0ca7b12dc3 100644
--- a/drivers/net/phy/nxp-c45-tja11xx.c
+++ b/drivers/net/phy/nxp-c45-tja11xx.c
@@ -1300,7 +1300,7 @@ static int nxp_c45_soft_reset(struct phy_device *phydev)
return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1,
VEND1_DEVICE_CONTROL, ret,
!(ret & DEVICE_CONTROL_RESET), 20000,
- 240000, false);
+ 240000, true);
}
static int nxp_c45_cable_test_start(struct phy_device *phydev)
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset
2025-01-16 14:55 [PATCH] net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset Milos Reljin
@ 2025-01-20 22:47 ` Jakub Kicinski
2025-01-21 13:20 ` Milos Reljin
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2025-01-20 22:47 UTC (permalink / raw)
To: Milos Reljin
Cc: andrei.botila, andrew, hkallweit1, linux, davem, edumazet, pabeni,
netdev, linux-kernel, milos.reljin
On Thu, 16 Jan 2025 14:55:39 +0000 Milos Reljin wrote:
> Add delay before first MDIO read following MDIO write in soft_reset
> function. Without this, soft_reset fails and PHY init cannot complete.
A bit more info about the problem would be good.
Does the problem happen every time for you, if not how often?
What PHY chip do you see this with exactly? The driver supports
at least two. If you can repro with a evaluation / development /
reference board of some sort please also mention which.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset
2025-01-20 22:47 ` Jakub Kicinski
@ 2025-01-21 13:20 ` Milos Reljin
2025-01-21 14:02 ` Andrew Lunn
0 siblings, 1 reply; 5+ messages in thread
From: Milos Reljin @ 2025-01-21 13:20 UTC (permalink / raw)
To: Jakub Kicinski
Cc: andrei.botila, andrew, hkallweit1, linux, davem, edumazet, pabeni,
netdev, linux-kernel, milos.reljin
On Mon, Jan 20, 2025 at 02:47:56PM -0800, Jakub Kicinski wrote:
> On Thu, 16 Jan 2025 14:55:39 +0000 Milos Reljin wrote:
> > Add delay before first MDIO read following MDIO write in soft_reset
> > function. Without this, soft_reset fails and PHY init cannot complete.
>
> A bit more info about the problem would be good.
>
> Does the problem happen every time for you, if not how often?
Yes, soft_reset in original driver always returns error.
> What PHY chip do you see this with exactly? The driver supports
> at least two. If you can repro with a evaluation / development /
> reference board of some sort please also mention which.
> --
> pw-bot: cr
The PHY is TJA1120A and its PHY_ID_2 register reports value of 0xB031.
Unfortunately I don't have evaluation board - I'm working on custom
board bringup. Linux is running on TI J784S4 SoC.
If you have access to TJA1120's application note (AN13663), page 30
contains info on startup timing.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset
2025-01-21 13:20 ` Milos Reljin
@ 2025-01-21 14:02 ` Andrew Lunn
2025-01-21 15:27 ` Milos Reljin
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2025-01-21 14:02 UTC (permalink / raw)
To: Milos Reljin
Cc: Jakub Kicinski, andrei.botila, hkallweit1, linux, davem, edumazet,
pabeni, netdev, linux-kernel, milos.reljin
> If you have access to TJA1120's application note (AN13663), page 30
> contains info on startup timing.
You could summarise what the datasheet says in the commit message. It
then becomes clear where you got the values from, making a good
justification.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset
2025-01-21 14:02 ` Andrew Lunn
@ 2025-01-21 15:27 ` Milos Reljin
0 siblings, 0 replies; 5+ messages in thread
From: Milos Reljin @ 2025-01-21 15:27 UTC (permalink / raw)
To: Andrew Lunn
Cc: Jakub Kicinski, andrei.botila, hkallweit1, linux, davem, edumazet,
pabeni, netdev, linux-kernel, milos.reljin
On Tue, Jan 21, 2025 at 03:02:17PM +0100, Andrew Lunn wrote:
> > If you have access to TJA1120's application note (AN13663), page 30
> > contains info on startup timing.
>
> You could summarise what the datasheet says in the commit message. It
> then becomes clear where you got the values from, making a good
> justification.
>
> Andrew
Good suggestion, thanks. I'll add this in the next version of patch.
In datasheet there's a figure with average PHY startup timing values
with measurement uncertainty following software reset.
The time it takes for SMI to become operational after software reset
ranges roughly from 500 us to 1500 us.
In the next version of this patch, instead of setting the last parameter
of phy_read_mmd_poll_timeout (sleep_before_read) to true (which adds a
20000 us sleep and by datasheet is excessive), I can add:
usleep_range(2000, 2050);
before the line with phy_read_mmd_poll_timeout. I tested with 1000 us
and it was working, but to be sure, 2000 us should cover the worst case.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-21 15:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-16 14:55 [PATCH] net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset Milos Reljin
2025-01-20 22:47 ` Jakub Kicinski
2025-01-21 13:20 ` Milos Reljin
2025-01-21 14:02 ` Andrew Lunn
2025-01-21 15:27 ` Milos Reljin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).