Re: [PATCH v2 3/6] hwrng: imx-rngc - use polling to detect end of self test

From: Martin Kaiser
Date: Tue Aug 29 2023 - 14:59:24 EST


Hi Alexander,

Alexander Stein (alexander.stein@xxxxxxxxxxxxxxx) wrote:

> I'm still not convinced that using polling is simpler. By using
> readl_poll_timeout() you will also get an interrupt, the timer one. Why
> exactly is using polling much (!) simpler?

it requires much less code in the driver.

> > The selftest should take approx. 450us. Keep the overhead to a minimum
> > by polling every 500us. (We've already lowered the timeout to 1.5ms.)

> I suppose these times only hold true for a specific peripheral clock
> frequency. Is it guaranteed that this frequency is fixed?

Good point. The lowest possible peripheral clock frequency is half of
what I used for the calculations, i.e. 33.25MHz. That would double the
durations. Should be ok for the selftest. But for the initial seed, we'd
get into a region where readl_poll_timeout (usleep_range) does no longer
make sense.

> For using IRQ it's simpler, there is no guessing: you return once the self
> test finished. The timeout is identical anyway.

I've looked at other callers of readl_poll_timeout. It seems that none
of them is called in a driver's probe function or uses an overall
timeout of 200ms.

I'll keep the interrupt + completion and resubmit the patches for
adjusting the timeouts.

Thanks,
Martin