From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA91D26B2A3; Tue, 8 Apr 2025 12:25:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744115107; cv=none; b=ZX4U/mjWhYq+RT2MnvBiDNNlVb2Wjqy6J4mqRdE6xKDat7+W9GLEz/w5gxU5+uZlotTqspkMB7+y3w1OBzRCnQ7b++gdUxFU6yV02KZ1ZshPFyML+1F7pvF4B5Dk213oQcefJzU7Y/aNj5uNDweHgtAteGCkNpQN1j7oDOCoSU0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744115107; c=relaxed/simple; bh=OX6hgk58lEqsi4MlrwInEWktx+hKSh83bpyVIypg1dI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ULMUr9SvxIUyX4x39ErfczdBhfAzVdf5JPQHP/y4x6IsIy3W9DxLO8zF7dWGI1126N+U9gxjynYXKiAdgwx45B7Yj4R5FqPKduo9rHo57kjoYWzOomOXIvVSo6zRBmbEsvdG/OUNPgl2xRxQxpVgUB2E8KRFnivu6x48RoeTm1w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wnqA3BN0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wnqA3BN0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BB5DC4CEE5; Tue, 8 Apr 2025 12:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744115107; bh=OX6hgk58lEqsi4MlrwInEWktx+hKSh83bpyVIypg1dI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wnqA3BN0L0VDGEx9zi0ezPCyH3JgZ9DUAl1jzRWIGZhJ2+iMAD8R9C6ebujblzsdN Uu3sYNfGxCm4qbn8BX/lZcw9DXbtaNwyYbKwbZmBThBPXwr4uq7xEMK5P4MNF0V315 njtzuV72mG/21u+LJYmc77JArtZ/kHGuvdi5qeZw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Claudiu Beznea , Alexandre Belloni , Sasha Levin Subject: [PATCH 6.13 353/499] rtc: renesas-rtca3: Disable interrupts only if the RTC is enabled Date: Tue, 8 Apr 2025 12:49:25 +0200 Message-ID: <20250408104900.033826995@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104851.256868745@linuxfoundation.org> References: <20250408104851.256868745@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Claudiu Beznea [ Upstream commit 27b2fcbd6b98204b0dce62e9aa9540ca0a2b70f1 ] 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: d4488377609e ("rtc: renesas-rtca3: Add driver for RTCA-3 available on Renesas RZ/G3S SoC") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20250205095519.2031742-1-claudiu.beznea.uj@bp.renesas.com Signed-off-by: Alexandre Belloni Signed-off-by: Sasha Levin --- drivers/rtc/rtc-renesas-rtca3.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/rtc/rtc-renesas-rtca3.c b/drivers/rtc/rtc-renesas-rtca3.c index d127933bfc8ad..598bf943cc5b6 100644 --- a/drivers/rtc/rtc-renesas-rtca3.c +++ b/drivers/rtc/rtc-renesas-rtca3.c @@ -586,17 +586,14 @@ static int rtca3_initial_setup(struct clk *clk, struct rtca3_priv *priv) */ usleep_range(sleep_us, sleep_us + 10); - /* Disable all interrupts. */ - mask = RTCA3_RCR1_AIE | RTCA3_RCR1_CIE | RTCA3_RCR1_PIE; - ret = rtca3_alarm_irq_set_helper(priv, mask, 0); - if (ret) - return ret; - mask = RTCA3_RCR2_START | RTCA3_RCR2_HR24; val = readb(priv->base + RTCA3_RCR2); - /* Nothing to do if already started in 24 hours and calendar count mode. */ - if ((val & mask) == mask) - return 0; + /* Only disable the interrupts if already started in 24 hours and calendar count mode. */ + if ((val & mask) == mask) { + /* Disable all interrupts. */ + mask = RTCA3_RCR1_AIE | RTCA3_RCR1_CIE | RTCA3_RCR1_PIE; + return rtca3_alarm_irq_set_helper(priv, mask, 0); + } /* Reconfigure the RTC in 24 hours and calendar count mode. */ mask = RTCA3_RCR2_START | RTCA3_RCR2_CNTMD; -- 2.39.5