[PATCH v6 1/4] clk: ingenic: Poll JZ4780 CPU1 power status atomically
From: Florian Fainelli
Date: Fri Nov 13 2026 - 14:55:22 EST
The CPU1 clock enable callback runs under the clock framework's spinlock
with interrupts disabled. Its readl_poll_timeout() can sleep between
reads, which is invalid in this context when SMP powers up CPU1.
Use readl_poll_timeout_atomic() with the existing interval and timeout.
This is a prerequisite for the JZ4780 SMP bring-up path. The original
CPU1 clock implementation by Zhou Yanjie is already upstream.
Cross-built for CI20; the subsequent SMP-enabled image brought up both
CPU cores. Development and validation used Codex assistance.
CC: stable@xxxxxxxxxxxxxxx
Fixes: 6673db4f3f26 ("clk: JZ4780: Add function for enable the second core.")
Link: https://lkml.kernel.org/r/1582215889-113034-3-git-send-email-zhouyanjie@xxxxxxxxxxxxxx
Reviewed-by: Paul Cercueil <paul@xxxxxxxxxxxxxxx>
Tested-by: Paul Cercueil <paul@xxxxxxxxxxxxxxx>
Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
---
Changes since previous posting:
- No changes to this patch.
drivers/clk/ingenic/jz4780-cgu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/ingenic/jz4780-cgu.c b/drivers/clk/ingenic/jz4780-cgu.c
index 1e88aef7ac0f..1809f8859c7e 100644
--- a/drivers/clk/ingenic/jz4780-cgu.c
+++ b/drivers/clk/ingenic/jz4780-cgu.c
@@ -242,8 +242,8 @@ static int jz4780_core1_enable(struct clk_hw *hw)
spin_unlock_irqrestore(&cgu->lock, flags);
/* wait for the CPU to be powered up */
- retval = readl_poll_timeout(cgu->base + CGU_REG_LCR, lcr,
- !(lcr & LCR_SCPUS), 10, timeout);
+ retval = readl_poll_timeout_atomic(cgu->base + CGU_REG_LCR, lcr,
+ !(lcr & LCR_SCPUS), 10, timeout);
if (retval == -ETIMEDOUT) {
pr_err("%s: Wait for power up core1 timeout\n", __func__);
return retval;