Re: [PATCH] net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset

Milos Reljin
2025-01-21T15:27:47Z

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.