Re: [PATCH RFC 04/10] coresight: cpu-debug: Bound the power up retries
From: Leo Yan
Date: Fri Dec 04 2026 - 12:29:06 EST
On Fri, Nov 27, 2026 at 08:38:41AM +0200, Igor Velkov via B4 Relay wrote:
[...]
> static void debug_force_cpu_powered_up(struct debug_drvdata *drvdata)
> {
> + int tries = DEBUG_POWER_UP_TRIES;
> u32 edprcr;
>
> try_again:
> @@ -186,8 +188,8 @@ static void debug_force_cpu_powered_up(struct debug_drvdata *drvdata)
>
> drvdata->edprsr = readl_relaxed(drvdata->base + EDPRSR);
>
> - /* The core power domain got switched off on use, try again */
> - if (unlikely(!(drvdata->edprsr & EDPRSR_PU)))
> + /* The core power domain got switched off on use, try again if allowed */
> + if (unlikely(!(drvdata->edprsr & EDPRSR_PU)) && --tries)
> goto try_again;
I'd add a helper to poll the CPU power state:
static int debug_poll_cpu_power_state(struct debug_drvdata *drvdata)
{
return readx_poll_timeout_atomic(readl_relaxed, drvdata->base + EDPRSR,
drvdata->edprsr, drvdata->edprsr & EDPRSR_PU,
DEBUG_WAIT_SLEEP, DEBUG_WAIT_TIMEOUT);
}
We can then call it twice (one is after setting EDPRCR_COREPURQ and
again after setting EDPRCR_COREPURQ | EDPRCR_CORENPDRQ).
Thanks,
Leo