Skip to content

Commit 27b2fcb

Browse files
claudiubezneaalexandrebelloni
authored andcommitted
rtc: renesas-rtca3: Disable interrupts only if the RTC is enabled
If the RTC is not enabled and the code attempts to disable the interrupt, the readb_poll_timeout_atomic() function in the rtca3_alarm_irq_set_helper() may timeout, leading to probe failures. This issue is reproducible on some devices because the initial values of the PIE and AIE bits in the RCR1 register are undefined. To prevent probe failures in this scenario, disable RTC interrupts only when the RTC is actually enabled. Fixes: d448837 ("rtc: renesas-rtca3: Add driver for RTCA-3 available on Renesas RZ/G3S SoC") Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Link: https://lore.kernel.org/r/20250205095519.2031742-1-claudiu.beznea.uj@bp.renesas.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 8a9b175 commit 27b2fcb

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

drivers/rtc/rtc-renesas-rtca3.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -586,17 +586,14 @@ static int rtca3_initial_setup(struct clk *clk, struct rtca3_priv *priv)
586586
*/
587587
usleep_range(sleep_us, sleep_us + 10);
588588

589-
/* Disable all interrupts. */
590-
mask = RTCA3_RCR1_AIE | RTCA3_RCR1_CIE | RTCA3_RCR1_PIE;
591-
ret = rtca3_alarm_irq_set_helper(priv, mask, 0);
592-
if (ret)
593-
return ret;
594-
595589
mask = RTCA3_RCR2_START | RTCA3_RCR2_HR24;
596590
val = readb(priv->base + RTCA3_RCR2);
597-
/* Nothing to do if already started in 24 hours and calendar count mode. */
598-
if ((val & mask) == mask)
599-
return 0;
591+
/* Only disable the interrupts if already started in 24 hours and calendar count mode. */
592+
if ((val & mask) == mask) {
593+
/* Disable all interrupts. */
594+
mask = RTCA3_RCR1_AIE | RTCA3_RCR1_CIE | RTCA3_RCR1_PIE;
595+
return rtca3_alarm_irq_set_helper(priv, mask, 0);
596+
}
600597

601598
/* Reconfigure the RTC in 24 hours and calendar count mode. */
602599
mask = RTCA3_RCR2_START | RTCA3_RCR2_CNTMD;

0 commit comments

Comments
 (0)