* [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs
@ 2026-08-21 13:55 Prabhakar
2026-08-21 13:55 ` [PATCH v5 01/17] dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support Prabhakar
` (16 more replies)
0 siblings, 17 replies; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:55 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Hi all,
This series adds support for the RTC IP found on the Renesas RZ/T2H and
RZ/N2H SoCs.
The RTC block is closely related to the RZ/N1 implementation and can
reuse the existing driver infrastructure when operating in SCMP mode,
which is required on these SoCs due to their 195.3 kHz RTC input clock.
While the RZ/T2H and RZ/N2H variants do not implement the RTCA0SUBU
register present on RZ/N1, this register is not accessed by the driver
in SCMP mode, allowing support to be added with minimal changes.
The RZ/T2H RTC variant also supports a 1 Hz output signal on the
RTCAT1HZ pin, controlled by the RTCA0CTL1[RTCA01HZE] bit. This bit is
marked as reserved in the RZ/N1 hardware manual, making RZ/T2H a
distinct RTC variant despite its overall compatibility with the RZ/N1
implementation.
Patches have been rebased on top of next-20260820.
v4->v5:
- Collected Reviewed-by and Tested-by tags from Wolfram
- Added Suggested-by tag from Wolfram.
- Added a new patch to disable interrupts when arming a new alarm
- Added a new patch to handle unset alarm weekday in rzn1_rtc_read_alarm()
- Shuffled the pm_runtime_put_sync() patch to be applied before the patch
that replaces the .remove() callback with devm_add_action_or_reset()
- Renamed rzn1_data to rzn1_rtc_rzn1_data
- Added a print message to indicate that SUBU mode is not supported
on the variant.
- Added a comment to indicate that the xtal clock is NULL when SUBU
mode is not supported.
- Renamed rzt2h_data to rzn1_rtc_rzt2h_data
v3->v4:
- Added Reviewed-by tags from Wolfram.
- Made use of tm->tm_wday directly instead of recalculating the weekday
from the day-of-month.
- Updated commit message in patch #3
- Shortened the comment describing the calculation of RTC_PCLK.
- Updated usleep_range() value to use 2 * rtc->sync_time.
- Added new patch to gate SUBU register access based on OF match data.
- Added new patch to make use of pm_runtime_put_sync() in rzn1_rtc_disable_hardware().
- Added new patch to drop trailing comma from OF match table sentinel.
- Added OF rzt2h_data for OF data
- Updated commit message for patch #15
v2->v3:
- Added new patch to fix weekday underflow when alarm crosses month
boundary.
- Make use of devm_add_action_or_reset() to simplify driver teardown
and remove the .remove() callback.
v1->v2:
- Dropped wakeup capability support patch.
- Dropped header sort patch as it was already fixed upstream.
- Updated commit message to drop reference about RTCA0TCR register.
- Added Acked-by and Reviewed-by tags.
- Updated Kconfig help text to keep it generic and not specific to
RZ/N1 SoCs.
- Initialized rate variable to 32768 to avoid timeout_us of 0.
- Made use of RZN1_RTC_SUBU_RTCA0FX mask for SUBU register access
instead of 0x3F.
v1: https://lore.kernel.org/all/20260615154805.1619693-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
Cheers,
Prabhakar
Lad Prabhakar (17):
dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support
rtc: rzn1: Handle EPROBE_DEFER for optional pps interrupt
rtc: rzn1: Fix weekday underflow when alarm crosses month boundary
rtc: rzn1: Handle unset alarm weekday in rzn1_rtc_read_alarm
rtc: rzn1: Fix alarm range check truncation on 32-bit systems
rtc: rzn1: Disable alarm interrupt before reprogramming alarm
registers
rtc: rzn1: Fix malformed MODULE_AUTHOR string
rtc: Kconfig: Broaden RTC_DRV_RZN1 dependency to ARCH_RENESAS
rtc: rzn1: Use pm_runtime_put_sync()
rtc: rzn1: Replace remove callback with devm_add_action_or_reset()
rtc: rzn1: Dynamically calculate synchronization delay based on clock
rate
rtc: rzn1: Use temporary variable for struct device
rtc: rzn1: Consistently use dev_err_probe()
rtc: rzn1: use FIELD_PREP/FIELD_GET and GENMASK for register access
rtc: rzn1: Add OF match data to gate SUBU register access
rtc: rzn1: Drop trailing comma from OF match table sentinel
rtc: rzn1: Add support for Renesas RZ/T2H and RZ/N2H SoCs
.../bindings/rtc/renesas,rzn1-rtc.yaml | 35 +++-
drivers/rtc/Kconfig | 5 +-
drivers/rtc/rtc-rzn1.c | 197 +++++++++++-------
3 files changed, 147 insertions(+), 90 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH v5 01/17] dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
@ 2026-08-21 13:55 ` Prabhakar
2026-08-21 14:05 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 02/17] rtc: rzn1: Handle EPROBE_DEFER for optional pps interrupt Prabhakar
` (15 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:55 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar, Conor Dooley
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Add compatible strings for the RTC block found on the Renesas RZ/T2H
(R9A09G077) and RZ/N2H (R9A09G087) SoCs.
These SoCs integrate a closely related variant of the RZ/N1 RTC IP.
Unlike RZ/N1, they do not implement the RTCA0SUBU register. This is
not a limitation for Linux support, as these registers are not used
when the RTC operates in "scmp" clock mode, which is required on
RZ/T2H and RZ/N2H due to their 195.3 kHz input clock.
The RZ/T2H RTC variant also supports a 1Hz output signal on the
RTCAT1HZ pin, controlled by the RTCA0CTL1[RTCA01HZE] bit. This bit is
marked as reserved in the RZ/N1 hardware manual.
Update the binding schema to require the additional clock inputs used by
these SoCs.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- No changes.
v3->v4:
- No changes.
v2->v3:
- No changes
v1->v2:
- Updated commit message to drop reference about RTCA0TCR register.
- Added Acked-by and Reviewed-by tags.
---
.../bindings/rtc/renesas,rzn1-rtc.yaml | 35 +++++++++++++++----
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/Documentation/devicetree/bindings/rtc/renesas,rzn1-rtc.yaml b/Documentation/devicetree/bindings/rtc/renesas,rzn1-rtc.yaml
index 1860f0e4c31a..ea7b039a91e7 100644
--- a/Documentation/devicetree/bindings/rtc/renesas,rzn1-rtc.yaml
+++ b/Documentation/devicetree/bindings/rtc/renesas,rzn1-rtc.yaml
@@ -9,15 +9,19 @@ title: Renesas RZ/N1 SoCs Real-Time Clock
maintainers:
- Miquel Raynal <miquel.raynal@bootlin.com>
-allOf:
- - $ref: rtc.yaml#
-
properties:
compatible:
- items:
- - enum:
- - renesas,r9a06g032-rtc
- - const: renesas,rzn1-rtc
+ oneOf:
+ - items:
+ - enum:
+ - renesas,r9a06g032-rtc
+ - const: renesas,rzn1-rtc
+
+ - const: renesas,r9a09g077-rtc
+
+ - items:
+ - const: renesas,r9a09g087-rtc
+ - const: renesas,r9a09g077-rtc
reg:
maxItems: 1
@@ -54,6 +58,23 @@ required:
- clock-names
- power-domains
+allOf:
+ - $ref: rtc.yaml#
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - renesas,r9a09g077-rtc
+ - renesas,r9a09g087-rtc
+ then:
+ properties:
+ clocks:
+ minItems: 2
+ clock-names:
+ minItems: 2
+
unevaluatedProperties: false
examples:
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 02/17] rtc: rzn1: Handle EPROBE_DEFER for optional pps interrupt
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-08-21 13:55 ` [PATCH v5 01/17] dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support Prabhakar
@ 2026-08-21 13:55 ` Prabhakar
2026-08-21 14:07 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 03/17] rtc: rzn1: Fix weekday underflow when alarm crosses month boundary Prabhakar
` (14 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:55 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar, stable
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Check for -EPROBE_DEFER from platform_get_irq_byname_optional() and handle
the deferred probe request properly.
Although the "pps" interrupt is optional, an error code of -EPROBE_DEFER
indicates that the interrupt subsystem is not yet ready. Intercept this
specific error condition, assign it to the return value, and jump to the
dis_runtime_pm label to avoid ignoring a valid probe deferral.
Fixes: eea7791e00f33 ("rtc: rzn1: implement one-second accuracy for alarms")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Added Tested-by tag from Wolfram.
v3->v4:
- Added Reviewed-by tag from Wolfram.
v2->v3:
- No changes
v1->v2:
- No changes
---
drivers/rtc/rtc-rzn1.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index 305f10a8a85b..aa27ad7f5941 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -464,6 +464,10 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
}
irq = platform_get_irq_byname_optional(pdev, "pps");
+ if (irq == -EPROBE_DEFER) {
+ ret = irq;
+ goto dis_runtime_pm;
+ }
if (irq >= 0)
ret = devm_request_irq(&pdev->dev, irq, rzn1_rtc_1s_irq, 0, "RZN1 RTC 1s", rtc);
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 03/17] rtc: rzn1: Fix weekday underflow when alarm crosses month boundary
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-08-21 13:55 ` [PATCH v5 01/17] dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support Prabhakar
2026-08-21 13:55 ` [PATCH v5 02/17] rtc: rzn1: Handle EPROBE_DEFER for optional pps interrupt Prabhakar
@ 2026-08-21 13:55 ` Prabhakar
2026-08-21 14:08 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 04/17] rtc: rzn1: Handle unset alarm weekday in rzn1_rtc_read_alarm Prabhakar
` (13 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:55 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar, stable
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
rzn1_rtc_set_alarm() calculates the alarm weekday from the difference
between the alarm day and the current day of the month. When the alarm
crosses a month boundary, this difference can become negative. Since
days_ahead is unsigned, it underflows and results in an incorrect
weekday being programmed into RZN1_RTC_ALW.
The RTC core already provides a fully populated struct rtc_time for
the alarm, including the correct tm_wday. Use tm->tm_wday directly
instead of recalculating the weekday from the day-of-month.
This avoids the underflow and ensures alarms scheduled across a month
boundary use the correct weekday.
Fixes: b5ad1bf00d2c4 ("rtc: rzn1: Add alarm support")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Suggested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Added Tested-by tag from Wolfram.
v3->v4:
- Made use of tm->tm_wday directly instead of recalculating the weekday
from the day-of-month.
- Updated commit message.
v2->v3:
- New patch to fix weekday underflow when alarm crosses month boundary.
---
drivers/rtc/rtc-rzn1.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index aa27ad7f5941..8c70dbf8c7ec 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -260,7 +260,6 @@ static int rzn1_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
struct rzn1_rtc *rtc = dev_get_drvdata(dev);
struct rtc_time *tm = &alrm->time, tm_now;
unsigned long alarm, farest;
- unsigned int days_ahead, wday;
int ret;
ret = rzn1_rtc_read_time(dev, &tm_now);
@@ -273,13 +272,9 @@ static int rzn1_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
if (time_after(alarm, farest))
return -ERANGE;
- /* Convert alarm day into week day */
- days_ahead = tm->tm_mday - tm_now.tm_mday;
- wday = (tm_now.tm_wday + days_ahead) % 7;
-
writel(bin2bcd(tm->tm_min), rtc->base + RZN1_RTC_ALM);
writel(bin2bcd(tm->tm_hour), rtc->base + RZN1_RTC_ALH);
- writel(BIT(wday), rtc->base + RZN1_RTC_ALW);
+ writel(BIT(tm->tm_wday), rtc->base + RZN1_RTC_ALW);
rtc->tm_alarm = alrm->time;
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 04/17] rtc: rzn1: Handle unset alarm weekday in rzn1_rtc_read_alarm
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (2 preceding siblings ...)
2026-08-21 13:55 ` [PATCH v5 03/17] rtc: rzn1: Fix weekday underflow when alarm crosses month boundary Prabhakar
@ 2026-08-21 13:55 ` Prabhakar
2026-08-21 14:10 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 05/17] rtc: rzn1: Fix alarm range check truncation on 32-bit systems Prabhakar
` (12 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:55 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar, stable
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
RZN1_RTC_ALW is a weekday bitmask where bit N represents weekday N.
When no alarm has been configured, the register has its power-on-reset
value of zero.
rzn1_rtc_read_alarm() uses fls() to convert the weekday bitmask into a
weekday number. When RZN1_RTC_ALW is zero, fls(0) returns zero and
fls(wday) - 1 evaluates to -1. This invalid weekday is then used to
calculate the alarm date and can either leave tm_wday set to -1 or
produce a fabricated alarm date.
Treat a zero RZN1_RTC_ALW value as an unset alarm weekday and return
without calculating the alarm date. Move reading RZN1_RTC_CTL1 before
this check so that alrm->enabled is updated for both configured and
unconfigured alarms.
On a cold-booted board with no alarm configured, the following was
observed before the fix:
root@rzn2h-evk:~# cat /proc/driver/rtc
rtc_time : 00:00:19
rtc_date : 2000-01-01
alrm_time : 00:00:00
alrm_date : 2000-01-07
alarm_IRQ : no
alrm_pending : no
update IRQ enabled : no
periodic IRQ enabled : no
periodic IRQ frequency : 1
max user IRQ frequency : 64
24hr : yes
After the fix:
root@rzn2h-evk:~# cat /proc/driver/rtc
rtc_time : 00:00:25
rtc_date : 2000-01-01
alrm_time : 00:00:00
alrm_date : 2000-01-01
alarm_IRQ : no
alrm_pending : no
update IRQ enabled : no
periodic IRQ enabled : no
periodic IRQ frequency : 1
max user IRQ frequency : 64
24hr : yes
Fixes: b5ad1bf00d2c4 ("rtc: rzn1: Add alarm support")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- New patch
---
drivers/rtc/rtc-rzn1.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index 8c70dbf8c7ec..e0fdb591ba91 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -234,13 +234,24 @@ static int rzn1_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
if (ret)
return ret;
+ ctl1 = readl(rtc->base + RZN1_RTC_CTL1);
+ alrm->enabled = !!(ctl1 & (RZN1_RTC_CTL1_ALME | RZN1_RTC_CTL1_1SE));
+
min = readl(rtc->base + RZN1_RTC_ALM);
hour = readl(rtc->base + RZN1_RTC_ALH);
- wday = readl(rtc->base + RZN1_RTC_ALW);
tm->tm_sec = 0;
tm->tm_min = bcd2bin(min);
tm->tm_hour = bcd2bin(hour);
+
+ /*
+ * If wday is zero, no bit is set in RZN1_RTC_ALW. This is the
+ * register's power-on reset value.
+ */
+ wday = readl(rtc->base + RZN1_RTC_ALW);
+ if (!wday)
+ return 0;
+
delta_days = ((fls(wday) - 1) - tm->tm_wday + 7) % 7;
tm->tm_wday = fls(wday) - 1;
@@ -249,9 +260,6 @@ static int rzn1_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
rtc_time64_to_tm(alarm, tm);
}
- ctl1 = readl(rtc->base + RZN1_RTC_CTL1);
- alrm->enabled = !!(ctl1 & (RZN1_RTC_CTL1_ALME | RZN1_RTC_CTL1_1SE));
-
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 05/17] rtc: rzn1: Fix alarm range check truncation on 32-bit systems
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (3 preceding siblings ...)
2026-08-21 13:55 ` [PATCH v5 04/17] rtc: rzn1: Handle unset alarm weekday in rzn1_rtc_read_alarm Prabhakar
@ 2026-08-21 13:55 ` Prabhakar
2026-08-21 14:06 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 06/17] rtc: rzn1: Disable alarm interrupt before reprogramming alarm registers Prabhakar
` (11 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:55 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
alarm and farest were declared as unsigned long, but
rtc_tm_to_time64() returns time64_t (s64). On 32-bit systems where
unsigned long is 32 bits, the assignment silently truncates the upper
32 bits of the timestamp.
Fix by declaring alarm and farest as time64_t and replacing
time_after() with a direct signed comparison, which is correct for
time64_t values that will never realistically overflow.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Added Tested-by tag from Wolfram.
v3->v4:
- Added Reviewed-by tag from Wolfram.
v2->v3:
- No changes.
v1->v2:
- Added Reviewed-by tag.
---
drivers/rtc/rtc-rzn1.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index e0fdb591ba91..44e8db466cb7 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -267,7 +267,7 @@ static int rzn1_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
struct rzn1_rtc *rtc = dev_get_drvdata(dev);
struct rtc_time *tm = &alrm->time, tm_now;
- unsigned long alarm, farest;
+ time64_t alarm, farest;
int ret;
ret = rzn1_rtc_read_time(dev, &tm_now);
@@ -277,7 +277,7 @@ static int rzn1_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
/* We cannot set alarms more than one week ahead */
farest = rtc_tm_to_time64(&tm_now) + rtc->rtcdev->alarm_offset_max;
alarm = rtc_tm_to_time64(tm);
- if (time_after(alarm, farest))
+ if (alarm > farest)
return -ERANGE;
writel(bin2bcd(tm->tm_min), rtc->base + RZN1_RTC_ALM);
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 06/17] rtc: rzn1: Disable alarm interrupt before reprogramming alarm registers
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (4 preceding siblings ...)
2026-08-21 13:55 ` [PATCH v5 05/17] rtc: rzn1: Fix alarm range check truncation on 32-bit systems Prabhakar
@ 2026-08-21 13:55 ` Prabhakar
2026-08-21 14:10 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 07/17] rtc: rzn1: Fix malformed MODULE_AUTHOR string Prabhakar
` (10 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:55 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar, stable
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
rzn1_rtc_set_alarm() updates RZN1_RTC_ALM, RZN1_RTC_ALH and
RZN1_RTC_ALW using separate MMIO writes without first disabling the
alarm interrupt. If a previous alarm is still enabled, the interrupt
can fire while the alarm registers contain a mixture of old and newly
written values.
Fix this by disabling the alarm interrupt before reprogramming ALM, ALH
and ALW with a call to rzn1_rtc_alarm_irq_enable().
Fixes: b5ad1bf00d2c4 ("rtc: rzn1: Add alarm support")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- New patch
---
drivers/rtc/rtc-rzn1.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index 44e8db466cb7..09631a3a5134 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -280,6 +280,11 @@ static int rzn1_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
if (alarm > farest)
return -ERANGE;
+ /* Disable alarm interrupts before reprogramming the alarm. */
+ ret = rzn1_rtc_alarm_irq_enable(dev, 0);
+ if (ret)
+ return ret;
+
writel(bin2bcd(tm->tm_min), rtc->base + RZN1_RTC_ALM);
writel(bin2bcd(tm->tm_hour), rtc->base + RZN1_RTC_ALH);
writel(BIT(tm->tm_wday), rtc->base + RZN1_RTC_ALW);
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 07/17] rtc: rzn1: Fix malformed MODULE_AUTHOR string
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (5 preceding siblings ...)
2026-08-21 13:55 ` [PATCH v5 06/17] rtc: rzn1: Disable alarm interrupt before reprogramming alarm registers Prabhakar
@ 2026-08-21 13:55 ` Prabhakar
2026-08-21 14:01 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 08/17] rtc: Kconfig: Broaden RTC_DRV_RZN1 dependency to ARCH_RENESAS Prabhakar
` (9 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:55 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Fix a malformed MODULE_AUTHOR macro in the rtc-rzn1 driver where a missing
closing angle bracket on the second author entry creates an invalid format.
Correct it to the standard "Name <email>" format.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Added Tested-by tag from Wolfram.
v3->v4:
- No changes.
v2->v3:
- No changes.
v1->v2:
- Added Reviewed-by tags.
---
drivers/rtc/rtc-rzn1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index 09631a3a5134..a7f22a491d61 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -524,6 +524,6 @@ static struct platform_driver rzn1_rtc_driver = {
module_platform_driver(rzn1_rtc_driver);
MODULE_AUTHOR("Michel Pollet <buserror@gmail.com>");
-MODULE_AUTHOR("Miquel Raynal <miquel.raynal@bootlin.com");
+MODULE_AUTHOR("Miquel Raynal <miquel.raynal@bootlin.com>");
MODULE_DESCRIPTION("RZ/N1 RTC driver");
MODULE_LICENSE("GPL");
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 08/17] rtc: Kconfig: Broaden RTC_DRV_RZN1 dependency to ARCH_RENESAS
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (6 preceding siblings ...)
2026-08-21 13:55 ` [PATCH v5 07/17] rtc: rzn1: Fix malformed MODULE_AUTHOR string Prabhakar
@ 2026-08-21 13:55 ` Prabhakar
2026-08-21 14:02 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 09/17] rtc: rzn1: Use pm_runtime_put_sync() Prabhakar
` (8 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:55 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Replace the ARCH_RZN1 dependency with ARCH_RENESAS for the RTC_DRV_RZN1
config option to make the driver available across both ARM32 and ARM64
Renesas architectures.
The newer RZ/T2H and RZ/N2H ARM64 SoCs integrate a closely related variant
of the RTC IP block found on the RZ/N1 SoCs. Update the build dependency
and expand the Kconfig help text to allow this driver to be selected for
these additional platforms.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Added Tested-by tag from Wolfram.
v3->v4:
- Added Reviewed-by tag from Wolfram.
v2->v3:
- No changes.
v1->v2:
- Updated help text to keep it generic and not specific to RZ/N1 SoCs.
---
drivers/rtc/Kconfig | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 01def8231873..d23a0fbe8d89 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1635,10 +1635,11 @@ config RTC_DRV_RS5C313
config RTC_DRV_RZN1
tristate "Renesas RZ/N1 RTC"
- depends on ARCH_RZN1 || COMPILE_TEST
+ depends on ARCH_RENESAS || COMPILE_TEST
depends on OF && HAS_IOMEM
help
- If you say yes here you get support for the Renesas RZ/N1 RTC.
+ If you say yes here you get support for the RTC initially found on
+ Renesas RZ/N1 SoCs.
config RTC_DRV_GENERIC
tristate "Generic RTC support"
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 09/17] rtc: rzn1: Use pm_runtime_put_sync()
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (7 preceding siblings ...)
2026-08-21 13:55 ` [PATCH v5 08/17] rtc: Kconfig: Broaden RTC_DRV_RZN1 dependency to ARCH_RENESAS Prabhakar
@ 2026-08-21 13:56 ` Prabhakar
2026-08-21 14:08 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 10/17] rtc: rzn1: Replace remove callback with devm_add_action_or_reset() Prabhakar
` (7 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:56 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
pm_runtime_put() may trigger the idle check after pm_runtime_disable()
is run as part of devm_pm_runtime_enable()'s cleanup action, leaving
runtime PM active.
Use pm_runtime_put_sync() to ensure the idle check runs synchronously.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- Updated commit message
- Moved the patch prior to the patch that replaces the .remove() callback
with devm_add_action_or_reset()
v3->v4:
- New patch
---
drivers/rtc/rtc-rzn1.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index a7f22a491d61..6a434cb418cd 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -492,7 +492,7 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
return 0;
dis_runtime_pm:
- pm_runtime_put(&pdev->dev);
+ pm_runtime_put_sync(&pdev->dev);
return ret;
}
@@ -504,7 +504,7 @@ static void rzn1_rtc_remove(struct platform_device *pdev)
/* Disable all interrupts */
writel(0, rtc->base + RZN1_RTC_CTL1);
- pm_runtime_put(&pdev->dev);
+ pm_runtime_put_sync(&pdev->dev);
}
static const struct of_device_id rzn1_rtc_of_match[] = {
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 10/17] rtc: rzn1: Replace remove callback with devm_add_action_or_reset()
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (8 preceding siblings ...)
2026-08-21 13:56 ` [PATCH v5 09/17] rtc: rzn1: Use pm_runtime_put_sync() Prabhakar
@ 2026-08-21 13:56 ` Prabhakar
2026-08-21 14:07 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 11/17] rtc: rzn1: Dynamically calculate synchronization delay based on clock rate Prabhakar
` (6 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:56 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Simplify the driver teardown by registering a managed cleanup action with
devm_add_action_or_reset(). This eliminates the explicit probe error path
and allows the .remove() callback to be dropped.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Fixed conflict due to moving the pm_runtime_put_sync() patch prior to this one.
- Added Tested-by tag from Wolfram.
v3->v4:
- Added Reviewed-by tag from Wolfram.
v2->v3:
- New patch to replace the remove callback with devm_add_action_or_reset().
---
drivers/rtc/rtc-rzn1.c | 56 +++++++++++++++++-------------------------
1 file changed, 23 insertions(+), 33 deletions(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index 6a434cb418cd..02d720e95a7f 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -384,6 +384,17 @@ static const struct rtc_class_ops rzn1_rtc_ops_scmp = {
.alarm_irq_enable = rzn1_rtc_alarm_irq_enable,
};
+static void rzn1_rtc_disable_hardware(void *data)
+{
+ struct device *dev = data;
+ struct rzn1_rtc *rtc = dev_get_drvdata(dev);
+
+ /* Disable all interrupts */
+ writel(0, rtc->base + RZN1_RTC_CTL1);
+
+ pm_runtime_put_sync(dev);
+}
+
static int rzn1_rtc_probe(struct platform_device *pdev)
{
struct rzn1_rtc *rtc;
@@ -421,18 +432,19 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
+ ret = devm_add_action_or_reset(&pdev->dev, rzn1_rtc_disable_hardware, &pdev->dev);
+ if (ret)
+ return ret;
+
/* Only switch to scmp if we have an xtal clock with a valid rate and != 32768 */
xtal = devm_clk_get_optional(&pdev->dev, "xtal");
if (IS_ERR(xtal)) {
- ret = PTR_ERR(xtal);
- goto dis_runtime_pm;
+ return PTR_ERR(xtal);
} else if (xtal) {
rate = clk_get_rate(xtal);
- if (rate < 32000 || rate > BIT(22)) {
- ret = -EOPNOTSUPP;
- goto dis_runtime_pm;
- }
+ if (rate < 32000 || rate > BIT(22))
+ return -EOPNOTSUPP;
if (rate != 32768)
scmp_val = RZN1_RTC_CTL0_SLSB_SCMP;
@@ -445,7 +457,7 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
ret = readl_poll_timeout(rtc->base + RZN1_RTC_CTL0, val,
!(val & RZN1_RTC_CTL0_CEST), 62, 123);
if (ret)
- goto dis_runtime_pm;
+ return ret;
/* Set desired modes leaving the controller disabled */
writel(RZN1_RTC_CTL0_AMPM | scmp_val, rtc->base + RZN1_RTC_CTL0);
@@ -468,14 +480,12 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
ret = devm_request_irq(&pdev->dev, irq, rzn1_rtc_alarm_irq, 0, "RZN1 RTC Alarm", rtc);
if (ret) {
dev_err(&pdev->dev, "RTC alarm interrupt not available\n");
- goto dis_runtime_pm;
+ return ret;
}
irq = platform_get_irq_byname_optional(pdev, "pps");
- if (irq == -EPROBE_DEFER) {
- ret = irq;
- goto dis_runtime_pm;
- }
+ if (irq == -EPROBE_DEFER)
+ return irq;
if (irq >= 0)
ret = devm_request_irq(&pdev->dev, irq, rzn1_rtc_1s_irq, 0, "RZN1 RTC 1s", rtc);
@@ -485,26 +495,7 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
dev_warn(&pdev->dev, "RTC pps interrupt not available. Alarm has only minute accuracy\n");
}
- ret = devm_rtc_register_device(rtc->rtcdev);
- if (ret)
- goto dis_runtime_pm;
-
- return 0;
-
-dis_runtime_pm:
- pm_runtime_put_sync(&pdev->dev);
-
- return ret;
-}
-
-static void rzn1_rtc_remove(struct platform_device *pdev)
-{
- struct rzn1_rtc *rtc = platform_get_drvdata(pdev);
-
- /* Disable all interrupts */
- writel(0, rtc->base + RZN1_RTC_CTL1);
-
- pm_runtime_put_sync(&pdev->dev);
+ return devm_rtc_register_device(rtc->rtcdev);
}
static const struct of_device_id rzn1_rtc_of_match[] = {
@@ -515,7 +506,6 @@ MODULE_DEVICE_TABLE(of, rzn1_rtc_of_match);
static struct platform_driver rzn1_rtc_driver = {
.probe = rzn1_rtc_probe,
- .remove = rzn1_rtc_remove,
.driver = {
.name = "rzn1-rtc",
.of_match_table = rzn1_rtc_of_match,
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 11/17] rtc: rzn1: Dynamically calculate synchronization delay based on clock rate
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (9 preceding siblings ...)
2026-08-21 13:56 ` [PATCH v5 10/17] rtc: rzn1: Replace remove callback with devm_add_action_or_reset() Prabhakar
@ 2026-08-21 13:56 ` Prabhakar
2026-08-21 14:05 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 12/17] rtc: rzn1: Use temporary variable for struct device Prabhakar
` (5 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:56 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Replace the hardcoded hardware synchronization delays with a calculated
time window derived from the operating sub-clock frequency.
The driver currently hardcodes microsecond ranges assuming a fixed
sub-clock frequency of 32.768 kHz. Newer SoC variants, such as the
RZ/T2H, drive this hardware block using a much faster clock rate
(~195.3 kHz). Hardcoding these wait windows forces faster blocks to
over-sleep, introducing unnecessary delays during clock initialization
and register configuration.
Calculate the duration of the required clock cycles in microseconds based
on the runtime clock rate, and store this value in the driver private
structure to adjust the usleep_range() and readl_poll_timeout() boundaries
dynamically.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Added Reviewed-by and Tested-by tags from Wolfram.
v3->v4:
- Shortened the comment describing the calculation of RTC_PCLK.
- Updated usleep_range() value to use 2 * rtc->sync_time.
v2->v3:
- No changes.
v1->v2:
- Initialized rate variable to 32768 to avoid timeout_us of 0.
---
drivers/rtc/rtc-rzn1.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index 02d720e95a7f..2e5d2460d79d 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -69,6 +69,7 @@ struct rzn1_rtc {
*/
spinlock_t ctl1_access_lock;
struct rtc_time tm_alarm;
+ unsigned long sync_time;
};
static void rzn1_rtc_get_time_snapshot(struct rzn1_rtc *rtc, struct rtc_time *tm)
@@ -119,8 +120,8 @@ static int rzn1_rtc_set_time(struct device *dev, struct rtc_time *tm)
/* Hold the counter if it was counting up */
writel(RZN1_RTC_CTL2_WAIT, rtc->base + RZN1_RTC_CTL2);
- /* Wait for the counter to stop: two 32k clock cycles */
- usleep_range(61, 100);
+ /* Wait 2-4 RTC_PCLK clock cycles for the counter to stop */
+ usleep_range(rtc->sync_time, rtc->sync_time * 2);
ret = readl_poll_timeout(rtc->base + RZN1_RTC_CTL2, val,
val & RZN1_RTC_CTL2_WST, 0, 100);
if (ret)
@@ -397,10 +398,10 @@ static void rzn1_rtc_disable_hardware(void *data)
static int rzn1_rtc_probe(struct platform_device *pdev)
{
+ unsigned long rate = 32768;
struct rzn1_rtc *rtc;
u32 val, scmp_val = 0;
struct clk *xtal;
- unsigned long rate;
int irq, ret;
rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
@@ -450,12 +451,16 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
scmp_val = RZN1_RTC_CTL0_SLSB_SCMP;
}
+ /* Calculate the duration of two RTC_PCLK clock cycles */
+ rtc->sync_time = DIV_ROUND_UP(2 * USEC_PER_SEC, rate);
+
/* Disable controller during SUBU/SCMP setup */
val = readl(rtc->base + RZN1_RTC_CTL0) & ~RZN1_RTC_CTL0_CE;
writel(val, rtc->base + RZN1_RTC_CTL0);
- /* Wait 2-4 32k clock cycles for the disabled controller */
+ /* Wait 2-4 RTC_PCLK clock cycles for the disabled controller to stop */
ret = readl_poll_timeout(rtc->base + RZN1_RTC_CTL0, val,
- !(val & RZN1_RTC_CTL0_CEST), 62, 123);
+ !(val & RZN1_RTC_CTL0_CEST), rtc->sync_time,
+ rtc->sync_time * 2);
if (ret)
return ret;
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 12/17] rtc: rzn1: Use temporary variable for struct device
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (10 preceding siblings ...)
2026-08-21 13:56 ` [PATCH v5 11/17] rtc: rzn1: Dynamically calculate synchronization delay based on clock rate Prabhakar
@ 2026-08-21 13:56 ` Prabhakar
2026-08-21 14:05 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 13/17] rtc: rzn1: Consistently use dev_err_probe() Prabhakar
` (4 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:56 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Use a temporary variable for the struct device pointers to avoid
dereferencing.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Added Tested-by tag from Wolfram.
v3->v4:
- No changes.
v2->v3:
- No changes.
v1->v2:
- Added Reviewed-by tag.
---
drivers/rtc/rtc-rzn1.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index 2e5d2460d79d..1b16fc06bce7 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -398,13 +398,14 @@ static void rzn1_rtc_disable_hardware(void *data)
static int rzn1_rtc_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
unsigned long rate = 32768;
struct rzn1_rtc *rtc;
u32 val, scmp_val = 0;
struct clk *xtal;
int irq, ret;
- rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
+ rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL);
if (!rtc)
return -ENOMEM;
@@ -412,13 +413,13 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
rtc->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rtc->base))
- return dev_err_probe(&pdev->dev, PTR_ERR(rtc->base), "Missing reg\n");
+ return dev_err_probe(dev, PTR_ERR(rtc->base), "Missing reg\n");
irq = platform_get_irq_byname(pdev, "alarm");
if (irq < 0)
return irq;
- rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
+ rtc->rtcdev = devm_rtc_allocate_device(dev);
if (IS_ERR(rtc->rtcdev))
return PTR_ERR(rtc->rtcdev);
@@ -426,19 +427,19 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
rtc->rtcdev->range_max = RTC_TIMESTAMP_END_2099;
rtc->rtcdev->alarm_offset_max = 7 * 86400;
- ret = devm_pm_runtime_enable(&pdev->dev);
+ ret = devm_pm_runtime_enable(dev);
if (ret < 0)
return ret;
- ret = pm_runtime_resume_and_get(&pdev->dev);
+ ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
return ret;
- ret = devm_add_action_or_reset(&pdev->dev, rzn1_rtc_disable_hardware, &pdev->dev);
+ ret = devm_add_action_or_reset(dev, rzn1_rtc_disable_hardware, dev);
if (ret)
return ret;
/* Only switch to scmp if we have an xtal clock with a valid rate and != 32768 */
- xtal = devm_clk_get_optional(&pdev->dev, "xtal");
+ xtal = devm_clk_get_optional(dev, "xtal");
if (IS_ERR(xtal)) {
return PTR_ERR(xtal);
} else if (xtal) {
@@ -482,9 +483,9 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
spin_lock_init(&rtc->ctl1_access_lock);
- ret = devm_request_irq(&pdev->dev, irq, rzn1_rtc_alarm_irq, 0, "RZN1 RTC Alarm", rtc);
+ ret = devm_request_irq(dev, irq, rzn1_rtc_alarm_irq, 0, "RZN1 RTC Alarm", rtc);
if (ret) {
- dev_err(&pdev->dev, "RTC alarm interrupt not available\n");
+ dev_err(dev, "RTC alarm interrupt not available\n");
return ret;
}
@@ -492,12 +493,12 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
if (irq == -EPROBE_DEFER)
return irq;
if (irq >= 0)
- ret = devm_request_irq(&pdev->dev, irq, rzn1_rtc_1s_irq, 0, "RZN1 RTC 1s", rtc);
+ ret = devm_request_irq(dev, irq, rzn1_rtc_1s_irq, 0, "RZN1 RTC 1s", rtc);
if (irq < 0 || ret) {
set_bit(RTC_FEATURE_ALARM_RES_MINUTE, rtc->rtcdev->features);
clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->rtcdev->features);
- dev_warn(&pdev->dev, "RTC pps interrupt not available. Alarm has only minute accuracy\n");
+ dev_warn(dev, "RTC pps interrupt not available. Alarm has only minute accuracy\n");
}
return devm_rtc_register_device(rtc->rtcdev);
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 13/17] rtc: rzn1: Consistently use dev_err_probe()
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (11 preceding siblings ...)
2026-08-21 13:56 ` [PATCH v5 12/17] rtc: rzn1: Use temporary variable for struct device Prabhakar
@ 2026-08-21 13:56 ` Prabhakar
2026-08-21 14:03 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 14/17] rtc: rzn1: use FIELD_PREP/FIELD_GET and GENMASK for register access Prabhakar
` (3 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:56 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Use dev_err_probe() in the IRQ request error path to make error handling
consistent with the rest of rzn1_rtc_probe().
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Added Tested-by tag from Wolfram.
v3->v4:
- No changes.
v2->v3:
- No changes.
v1->v2:
- Added Reviewed-by tags.
---
drivers/rtc/rtc-rzn1.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index 1b16fc06bce7..ea3906d1f868 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -484,10 +484,8 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
spin_lock_init(&rtc->ctl1_access_lock);
ret = devm_request_irq(dev, irq, rzn1_rtc_alarm_irq, 0, "RZN1 RTC Alarm", rtc);
- if (ret) {
- dev_err(dev, "RTC alarm interrupt not available\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "RTC alarm interrupt not available\n");
irq = platform_get_irq_byname_optional(pdev, "pps");
if (irq == -EPROBE_DEFER)
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 14/17] rtc: rzn1: use FIELD_PREP/FIELD_GET and GENMASK for register access
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (12 preceding siblings ...)
2026-08-21 13:56 ` [PATCH v5 13/17] rtc: rzn1: Consistently use dev_err_probe() Prabhakar
@ 2026-08-21 13:56 ` Prabhakar
2026-08-21 14:06 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 15/17] rtc: rzn1: Add OF match data to gate SUBU " Prabhakar
` (2 subsequent siblings)
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:56 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Replace open-coded shift and mask operations with the bitfield API.
Note that the weekday field is changed from an explicit 0x0f mask to
an 8-bit field definition, matching the hardware manual. This does not
change behaviour, as valid weekday values cannot exceed 7.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Added Tested-by tag from Wolfram.
v3->v4:
- Added RB tag from Wolfram
v2->v3:
- No changes.
v1->v2:
- Made use of RZN1_RTC_SUBU_RTCA0FX mask for SUBU register access
instead of 0x3F.
---
drivers/rtc/rtc-rzn1.c | 50 +++++++++++++++++++++++-------------------
1 file changed, 28 insertions(+), 22 deletions(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index ea3906d1f868..8b68a5ad19c0 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -12,6 +12,8 @@
*/
#include <linux/bcd.h>
+#include <linux/bitfield.h>
+#include <linux/bits.h>
#include <linux/clk.h>
#include <linux/init.h>
#include <linux/iopoll.h>
@@ -38,14 +40,18 @@
#define RZN1_RTC_CTL2_STOPPED (RZN1_RTC_CTL2_WAIT | RZN1_RTC_CTL2_WST)
#define RZN1_RTC_TIME 0x30
-#define RZN1_RTC_TIME_MIN_SHIFT 8
-#define RZN1_RTC_TIME_HOUR_SHIFT 16
+#define RZN1_RTC_TIME_SEC GENMASK(7, 0)
+#define RZN1_RTC_TIME_MIN GENMASK(15, 8)
+#define RZN1_RTC_TIME_HOUR GENMASK(23, 16)
+
#define RZN1_RTC_CAL 0x34
-#define RZN1_RTC_CAL_DAY_SHIFT 8
-#define RZN1_RTC_CAL_MON_SHIFT 16
-#define RZN1_RTC_CAL_YEAR_SHIFT 24
+#define RZN1_RTC_CAL_WDAY GENMASK(7, 0)
+#define RZN1_RTC_CAL_DAY GENMASK(15, 8)
+#define RZN1_RTC_CAL_MON GENMASK(23, 16)
+#define RZN1_RTC_CAL_YEAR GENMASK(31, 24)
#define RZN1_RTC_SUBU 0x38
+#define RZN1_RTC_SUBU_RTCA0FX GENMASK(5, 0)
#define RZN1_RTC_SUBU_DEV BIT(7)
#define RZN1_RTC_SUBU_DECR BIT(6)
@@ -77,15 +83,15 @@ static void rzn1_rtc_get_time_snapshot(struct rzn1_rtc *rtc, struct rtc_time *tm
u32 val;
val = readl(rtc->base + RZN1_RTC_TIMEC);
- tm->tm_sec = bcd2bin(val);
- tm->tm_min = bcd2bin(val >> RZN1_RTC_TIME_MIN_SHIFT);
- tm->tm_hour = bcd2bin(val >> RZN1_RTC_TIME_HOUR_SHIFT);
+ tm->tm_sec = bcd2bin(FIELD_GET(RZN1_RTC_TIME_SEC, val));
+ tm->tm_min = bcd2bin(FIELD_GET(RZN1_RTC_TIME_MIN, val));
+ tm->tm_hour = bcd2bin(FIELD_GET(RZN1_RTC_TIME_HOUR, val));
val = readl(rtc->base + RZN1_RTC_CALC);
- tm->tm_wday = val & 0x0f;
- tm->tm_mday = bcd2bin(val >> RZN1_RTC_CAL_DAY_SHIFT);
- tm->tm_mon = bcd2bin(val >> RZN1_RTC_CAL_MON_SHIFT) - 1;
- tm->tm_year = bcd2bin(val >> RZN1_RTC_CAL_YEAR_SHIFT) + 100;
+ tm->tm_wday = FIELD_GET(RZN1_RTC_CAL_WDAY, val);
+ tm->tm_mday = bcd2bin(FIELD_GET(RZN1_RTC_CAL_DAY, val));
+ tm->tm_mon = bcd2bin(FIELD_GET(RZN1_RTC_CAL_MON, val)) - 1;
+ tm->tm_year = bcd2bin(FIELD_GET(RZN1_RTC_CAL_YEAR, val)) + 100;
}
static int rzn1_rtc_read_time(struct device *dev, struct rtc_time *tm)
@@ -128,15 +134,15 @@ static int rzn1_rtc_set_time(struct device *dev, struct rtc_time *tm)
return ret;
}
- val = bin2bcd(tm->tm_sec);
- val |= bin2bcd(tm->tm_min) << RZN1_RTC_TIME_MIN_SHIFT;
- val |= bin2bcd(tm->tm_hour) << RZN1_RTC_TIME_HOUR_SHIFT;
+ val = FIELD_PREP(RZN1_RTC_TIME_SEC, bin2bcd(tm->tm_sec)) |
+ FIELD_PREP(RZN1_RTC_TIME_MIN, bin2bcd(tm->tm_min)) |
+ FIELD_PREP(RZN1_RTC_TIME_HOUR, bin2bcd(tm->tm_hour));
writel(val, rtc->base + RZN1_RTC_TIME);
- val = tm->tm_wday;
- val |= bin2bcd(tm->tm_mday) << RZN1_RTC_CAL_DAY_SHIFT;
- val |= bin2bcd(tm->tm_mon + 1) << RZN1_RTC_CAL_MON_SHIFT;
- val |= bin2bcd(tm->tm_year - 100) << RZN1_RTC_CAL_YEAR_SHIFT;
+ val = FIELD_PREP(RZN1_RTC_CAL_WDAY, tm->tm_wday) |
+ FIELD_PREP(RZN1_RTC_CAL_DAY, bin2bcd(tm->tm_mday)) |
+ FIELD_PREP(RZN1_RTC_CAL_MON, bin2bcd(tm->tm_mon + 1)) |
+ FIELD_PREP(RZN1_RTC_CAL_YEAR, bin2bcd(tm->tm_year - 100));
writel(val, rtc->base + RZN1_RTC_CAL);
writel(0, rtc->base + RZN1_RTC_CTL2);
@@ -307,12 +313,12 @@ static int rzn1_rtc_read_offset(struct device *dev, long *offset)
val = readl(rtc->base + RZN1_RTC_SUBU);
ppb_per_step = val & RZN1_RTC_SUBU_DEV ? 1017 : 3051;
subtract = val & RZN1_RTC_SUBU_DECR;
- val &= 0x3F;
+ val = FIELD_GET(RZN1_RTC_SUBU_RTCA0FX, val);
if (!val)
*offset = 0;
else if (subtract)
- *offset = -(((~val) & 0x3F) + 1) * ppb_per_step;
+ *offset = -(((~val) & RZN1_RTC_SUBU_RTCA0FX) + 1) * ppb_per_step;
else
*offset = (val - 1) * ppb_per_step;
@@ -354,7 +360,7 @@ static int rzn1_rtc_set_offset(struct device *dev, long offset)
subu |= steps + 1;
} else {
subu |= RZN1_RTC_SUBU_DECR;
- subu |= (~(-steps - 1)) & 0x3F;
+ subu |= (~(-steps - 1)) & RZN1_RTC_SUBU_RTCA0FX;
}
ret = readl_poll_timeout(rtc->base + RZN1_RTC_CTL2, ctl2,
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 15/17] rtc: rzn1: Add OF match data to gate SUBU register access
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (13 preceding siblings ...)
2026-08-21 13:56 ` [PATCH v5 14/17] rtc: rzn1: use FIELD_PREP/FIELD_GET and GENMASK for register access Prabhakar
@ 2026-08-21 13:56 ` Prabhakar
2026-08-21 14:08 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 16/17] rtc: rzn1: Drop trailing comma from OF match table sentinel Prabhakar
2026-08-21 13:56 ` [PATCH v5 17/17] rtc: rzn1: Add support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:56 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
The RZ/N1 RTC driver selects SCMP mode only when an optional xtal clock
is provided at a valid rate other than 32768 Hz. Without an xtal clock,
or when it runs at 32768 Hz, the driver uses SUBU mode.
However, the RTCA0SUBU register used by SUBU mode is not present on all
SoCs that integrate a similar variant of the RTC block. Allowing SUBU
mode on those variants would expose RTC offset operations that access a
non-existent register.
Add OF match data to describe whether the RTC supports the SUBU register.
Reject probe with -EOPNOTSUPP when SUBU mode would be selected on a
variant without SUBU support.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Suggested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Renamed rzn1_data to rzn1_rtc_rzn1_data
- Added a print message to indicate that SUBU mode is not supported
on the variant.
- Added a comment to indicate that the xtal clock is NULL when SUBU
mode is not supported.
- Added Suggested-by tag from Wolfram.
v3->v4:
- New patch
---
drivers/rtc/rtc-rzn1.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index 8b68a5ad19c0..35770bff129f 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -18,6 +18,7 @@
#include <linux/init.h>
#include <linux/iopoll.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/rtc.h>
@@ -65,6 +66,10 @@
#define RZN1_RTC_TIMEC 0x68
#define RZN1_RTC_CALC 0x6c
+struct rzn1_rtc_data {
+ bool has_subu;
+};
+
struct rzn1_rtc {
struct rtc_device *rtcdev;
void __iomem *base;
@@ -404,6 +409,7 @@ static void rzn1_rtc_disable_hardware(void *data)
static int rzn1_rtc_probe(struct platform_device *pdev)
{
+ const struct rzn1_rtc_data *data;
struct device *dev = &pdev->dev;
unsigned long rate = 32768;
struct rzn1_rtc *rtc;
@@ -411,6 +417,10 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
struct clk *xtal;
int irq, ret;
+ data = of_device_get_match_data(dev);
+ if (!data)
+ return -ENODEV;
+
rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL);
if (!rtc)
return -ENOMEM;
@@ -454,8 +464,12 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
if (rate < 32000 || rate > BIT(22))
return -EOPNOTSUPP;
- if (rate != 32768)
+ if (rate != 32768 || !data->has_subu)
scmp_val = RZN1_RTC_CTL0_SLSB_SCMP;
+ } else if (!data->has_subu) {
+ /* xtal is NULL here */
+ return dev_err_probe(dev, -EOPNOTSUPP,
+ "No valid XTAL provided and SUBU mode not supported\n");
}
/* Calculate the duration of two RTC_PCLK clock cycles */
@@ -508,8 +522,12 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
return devm_rtc_register_device(rtc->rtcdev);
}
+static const struct rzn1_rtc_data rzn1_rtc_rzn1_data = {
+ .has_subu = true,
+};
+
static const struct of_device_id rzn1_rtc_of_match[] = {
- { .compatible = "renesas,rzn1-rtc" },
+ { .compatible = "renesas,rzn1-rtc", .data = &rzn1_rtc_rzn1_data },
{},
};
MODULE_DEVICE_TABLE(of, rzn1_rtc_of_match);
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 16/17] rtc: rzn1: Drop trailing comma from OF match table sentinel
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (14 preceding siblings ...)
2026-08-21 13:56 ` [PATCH v5 15/17] rtc: rzn1: Add OF match data to gate SUBU " Prabhakar
@ 2026-08-21 13:56 ` Prabhakar
2026-08-21 14:07 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 17/17] rtc: rzn1: Add support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:56 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Drop the trailing comma from the final empty entry in the RZN1 RTC OF
match table and mark it explicitly as the sentinel.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Added Reviewed-by and Tested-by tag from Wolfram.
v3->v4:
- New patch
---
drivers/rtc/rtc-rzn1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index 35770bff129f..75713e7b045b 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -528,7 +528,7 @@ static const struct rzn1_rtc_data rzn1_rtc_rzn1_data = {
static const struct of_device_id rzn1_rtc_of_match[] = {
{ .compatible = "renesas,rzn1-rtc", .data = &rzn1_rtc_rzn1_data },
- {},
+ {}
};
MODULE_DEVICE_TABLE(of, rzn1_rtc_of_match);
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v5 17/17] rtc: rzn1: Add support for Renesas RZ/T2H and RZ/N2H SoCs
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (15 preceding siblings ...)
2026-08-21 13:56 ` [PATCH v5 16/17] rtc: rzn1: Drop trailing comma from OF match table sentinel Prabhakar
@ 2026-08-21 13:56 ` Prabhakar
2026-08-21 14:09 ` sashiko-bot
16 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-08-21 13:56 UTC (permalink / raw)
To: Alexandre Belloni, Miquel Raynal, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Magnus Damm, Wolfram Sang
Cc: linux-rtc, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Add support for the RTC block found on the Renesas RZ/T2H (R9A09G077)
and RZ/N2H (R9A09G087) SoCs.
These SoCs integrate a closely related variant of the RZ/N1 RTC IP, but
do not implement the RTCA0SUBU register. Use variant-specific match data
to disable SUBU support for these SoCs.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v4->v5:
- Renamed rzt2h_data to rzn1_rtc_rzt2h_data
- Added Reviewed-by and Tested-by tag from Wolfram.
v3->v4:
- Dropped RB tag from Wolfram.
- Added OF rzt2h_data
- Updated commit message.
v2->v3:
- No changes.
v1->v2:
- Updated commit message to drop reference about RTCA0TCR register.
- Added Reviewed-by tag.
---
drivers/rtc/rtc-rzn1.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index 75713e7b045b..fab8213c5244 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -522,11 +522,16 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
return devm_rtc_register_device(rtc->rtcdev);
}
+static const struct rzn1_rtc_data rzn1_rtc_rzt2h_data = {
+ .has_subu = false,
+};
+
static const struct rzn1_rtc_data rzn1_rtc_rzn1_data = {
.has_subu = true,
};
static const struct of_device_id rzn1_rtc_of_match[] = {
+ { .compatible = "renesas,r9a09g077-rtc", .data = &rzn1_rtc_rzt2h_data },
{ .compatible = "renesas,rzn1-rtc", .data = &rzn1_rtc_rzn1_data },
{}
};
--
2.43.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH v5 07/17] rtc: rzn1: Fix malformed MODULE_AUTHOR string
2026-08-21 13:55 ` [PATCH v5 07/17] rtc: rzn1: Fix malformed MODULE_AUTHOR string Prabhakar
@ 2026-08-21 14:01 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:01 UTC (permalink / raw)
To: Prabhakar
Cc: wsa+renesas, conor+dt, linux-rtc, devicetree, robh,
Alexandre Belloni
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Fix a malformed MODULE_AUTHOR macro in the rtc-rzn1 driver where a missing
> closing angle bracket on the second author entry creates an invalid format.
> Correct it to the standard "Name <email>" format.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=7
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 08/17] rtc: Kconfig: Broaden RTC_DRV_RZN1 dependency to ARCH_RENESAS
2026-08-21 13:55 ` [PATCH v5 08/17] rtc: Kconfig: Broaden RTC_DRV_RZN1 dependency to ARCH_RENESAS Prabhakar
@ 2026-08-21 14:02 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:02 UTC (permalink / raw)
To: Prabhakar
Cc: Alexandre Belloni, wsa+renesas, devicetree, linux-rtc, robh,
conor+dt
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Replace the ARCH_RZN1 dependency with ARCH_RENESAS for the RTC_DRV_RZN1
> config option to make the driver available across both ARM32 and ARM64
> Renesas architectures.
>
> The newer RZ/T2H and RZ/N2H ARM64 SoCs integrate a closely related variant
> of the RTC IP block found on the RZ/N1 SoCs. Update the build dependency
> and expand the Kconfig help text to allow this driver to be selected for
> these additional platforms.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=8
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 13/17] rtc: rzn1: Consistently use dev_err_probe()
2026-08-21 13:56 ` [PATCH v5 13/17] rtc: rzn1: Consistently use dev_err_probe() Prabhakar
@ 2026-08-21 14:03 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:03 UTC (permalink / raw)
To: Prabhakar
Cc: devicetree, Alexandre Belloni, wsa+renesas, robh, conor+dt,
linux-rtc
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Use dev_err_probe() in the IRQ request error path to make error handling
> consistent with the rest of rzn1_rtc_probe().
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=13
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 12/17] rtc: rzn1: Use temporary variable for struct device
2026-08-21 13:56 ` [PATCH v5 12/17] rtc: rzn1: Use temporary variable for struct device Prabhakar
@ 2026-08-21 14:05 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:05 UTC (permalink / raw)
To: Prabhakar
Cc: linux-rtc, Alexandre Belloni, robh, wsa+renesas, devicetree,
conor+dt
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Use a temporary variable for the struct device pointers to avoid
> dereferencing.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=12
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 11/17] rtc: rzn1: Dynamically calculate synchronization delay based on clock rate
2026-08-21 13:56 ` [PATCH v5 11/17] rtc: rzn1: Dynamically calculate synchronization delay based on clock rate Prabhakar
@ 2026-08-21 14:05 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:05 UTC (permalink / raw)
To: Prabhakar
Cc: Alexandre Belloni, linux-rtc, wsa+renesas, conor+dt, devicetree,
robh
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Replace the hardcoded hardware synchronization delays with a calculated
> time window derived from the operating sub-clock frequency.
>
> The driver currently hardcodes microsecond ranges assuming a fixed
> sub-clock frequency of 32.768 kHz. Newer SoC variants, such as the
> RZ/T2H, drive this hardware block using a much faster clock rate
> (~195.3 kHz). Hardcoding these wait windows forces faster blocks to
> over-sleep, introducing unnecessary delays during clock initialization
> and register configuration.
>
> Calculate the duration of the required clock cycles in microseconds based
> on the runtime clock rate, and store this value in the driver private
> structure to adjust the usleep_range() and readl_poll_timeout() boundaries
> dynamically.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=11
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 01/17] dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support
2026-08-21 13:55 ` [PATCH v5 01/17] dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support Prabhakar
@ 2026-08-21 14:05 ` sashiko-bot
2026-08-21 15:03 ` Wolfram Sang
0 siblings, 1 reply; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:05 UTC (permalink / raw)
To: Prabhakar
Cc: wsa+renesas, robh, Alexandre Belloni, conor+dt, devicetree,
linux-rtc
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The RZ/T2H variant introduces a clock provider capability (1Hz output), but the binding schema omits the mandatory `#clock-cells` property.
--
--- Patch [1]: [PATCH v5 01/17] dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support ---
commit 61200b5bfde6a5793e723c5af2c3129b5a618eae
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support
This commit adds compatible strings and clock requirements for the RTC
block on Renesas RZ/T2H and RZ/N2H SoCs. It also notes that the RZ/T2H
RTC variant supports a 1Hz output signal on the RTCAT1HZ pin.
> diff --git a/Documentation/devicetree/bindings/rtc/renesas,rzn1-rtc.yaml b/Documentation/devicetree/bindings/rtc/renesas,rzn1-rtc.yaml
> index 1860f0e4c31a2..ea7b039a91e77 100644
> --- a/Documentation/devicetree/bindings/rtc/renesas,rzn1-rtc.yaml
> +++ b/Documentation/devicetree/bindings/rtc/renesas,rzn1-rtc.yaml
[ ... ]
> @@ -54,6 +58,23 @@ required:
> - clock-names
> - power-domains
>
> +allOf:
> + - $ref: rtc.yaml#
> +
> + - if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - renesas,r9a09g077-rtc
> + - renesas,r9a09g087-rtc
> + then:
> + properties:
> + clocks:
> + minItems: 2
> + clock-names:
> + minItems: 2
[Severity: Medium]
The commit message mentions that the RZ/T2H variant supports a 1Hz
output signal, which acts as a clock provider. Should this conditional
block also define and require the #clock-cells property for this variant?
When a hardware variant adds a clock provider capability, the device tree
binding guidelines expect #clock-cells to be documented and constrained
(for example, #clock-cells: const: 0).
Since unevaluatedProperties is set to false in this binding, if a device
tree node attempts to expose and use this 1Hz output by providing
#clock-cells, will it fail schema validation?
> +
> unevaluatedProperties: false
>
> examples:
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=1
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 05/17] rtc: rzn1: Fix alarm range check truncation on 32-bit systems
2026-08-21 13:55 ` [PATCH v5 05/17] rtc: rzn1: Fix alarm range check truncation on 32-bit systems Prabhakar
@ 2026-08-21 14:06 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:06 UTC (permalink / raw)
To: Prabhakar
Cc: devicetree, conor+dt, Alexandre Belloni, linux-rtc, wsa+renesas,
robh
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> alarm and farest were declared as unsigned long, but
> rtc_tm_to_time64() returns time64_t (s64). On 32-bit systems where
> unsigned long is 32 bits, the assignment silently truncates the upper
> 32 bits of the timestamp.
>
> Fix by declaring alarm and farest as time64_t and replacing
> time_after() with a direct signed comparison, which is correct for
> time64_t values that will never realistically overflow.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=5
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 14/17] rtc: rzn1: use FIELD_PREP/FIELD_GET and GENMASK for register access
2026-08-21 13:56 ` [PATCH v5 14/17] rtc: rzn1: use FIELD_PREP/FIELD_GET and GENMASK for register access Prabhakar
@ 2026-08-21 14:06 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:06 UTC (permalink / raw)
To: Prabhakar
Cc: conor+dt, wsa+renesas, linux-rtc, robh, devicetree,
Alexandre Belloni
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Replace open-coded shift and mask operations with the bitfield API.
>
> Note that the weekday field is changed from an explicit 0x0f mask to
> an 8-bit field definition, matching the hardware manual. This does not
> change behaviour, as valid weekday values cannot exceed 7.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=14
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 02/17] rtc: rzn1: Handle EPROBE_DEFER for optional pps interrupt
2026-08-21 13:55 ` [PATCH v5 02/17] rtc: rzn1: Handle EPROBE_DEFER for optional pps interrupt Prabhakar
@ 2026-08-21 14:07 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:07 UTC (permalink / raw)
To: Prabhakar
Cc: devicetree, wsa+renesas, linux-rtc, conor+dt, Alexandre Belloni,
robh
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Check for -EPROBE_DEFER from platform_get_irq_byname_optional() and handle
> the deferred probe request properly.
>
> Although the "pps" interrupt is optional, an error code of -EPROBE_DEFER
> indicates that the interrupt subsystem is not yet ready. Intercept this
> specific error condition, assign it to the return value, and jump to the
> dis_runtime_pm label to avoid ignoring a valid probe deferral.
>
> Fixes: eea7791e00f33 ("rtc: rzn1: implement one-second accuracy for alarms")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=2
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 16/17] rtc: rzn1: Drop trailing comma from OF match table sentinel
2026-08-21 13:56 ` [PATCH v5 16/17] rtc: rzn1: Drop trailing comma from OF match table sentinel Prabhakar
@ 2026-08-21 14:07 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:07 UTC (permalink / raw)
To: Prabhakar
Cc: robh, Alexandre Belloni, conor+dt, devicetree, wsa+renesas,
linux-rtc
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The commit message claims to 'mark it explicitly as the sentinel', but no explicit marker (such as a `/* sentinel */` comment) is added to the code.
--
--- Patch [16]: [PATCH v5 16/17] rtc: rzn1: Drop trailing comma from OF match table sentinel ---
commit 6102085fc7a0622a82be53791f34e44f2573ec8b
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
rtc: rzn1: Drop trailing comma from OF match table sentinel
This commit drops the trailing comma from the final empty entry in the RZN1
RTC OF match table.
> diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
> index 35770bff129ff..75713e7b045b0 100644
> --- a/drivers/rtc/rtc-rzn1.c
> +++ b/drivers/rtc/rtc-rzn1.c
> @@ -528,7 +528,7 @@ static const struct rzn1_rtc_data rzn1_rtc_rzn1_data = {
>
> static const struct of_device_id rzn1_rtc_of_match[] = {
> { .compatible = "renesas,rzn1-rtc", .data = &rzn1_rtc_rzn1_data },
> - {},
> + {}
[Severity: Low]
This isn't a bug, but the commit message claims to mark it explicitly as the
sentinel. Should there be a /* sentinel */ comment added here to match the
description in the commit message?
> };
> MODULE_DEVICE_TABLE(of, rzn1_rtc_of_match);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=16
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 10/17] rtc: rzn1: Replace remove callback with devm_add_action_or_reset()
2026-08-21 13:56 ` [PATCH v5 10/17] rtc: rzn1: Replace remove callback with devm_add_action_or_reset() Prabhakar
@ 2026-08-21 14:07 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:07 UTC (permalink / raw)
To: Prabhakar
Cc: linux-rtc, devicetree, wsa+renesas, conor+dt, robh,
Alexandre Belloni
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Hardware interrupts are disabled after the IRQ handlers are freed during driver unbind, creating a window for spurious, unhandled interrupts.
--
--- Patch [10]: [PATCH v5 10/17] rtc: rzn1: Replace remove callback with devm_add_action_or_reset() ---
commit 473179016e2cef4b0d0185760b5e14362f0eadc1
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
rtc: rzn1: Replace remove callback with devm_add_action_or_reset()
This patch simplifies the driver teardown by replacing the explicit remove
callback and probe error paths with a managed cleanup action. It registers
rzn1_rtc_disable_hardware via devm_add_action_or_reset.
> diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
> index 6a434cb418cd0..02d720e95a7f9 100644
> --- a/drivers/rtc/rtc-rzn1.c
> +++ b/drivers/rtc/rtc-rzn1.c
> @@ -421,18 +432,19 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
> if (ret < 0)
> return ret;
>
> + ret = devm_add_action_or_reset(&pdev->dev, rzn1_rtc_disable_hardware, &pdev->dev);
> + if (ret)
> + return ret;
> +
[Severity: High]
Since devres executes teardown actions in LIFO order, will registering the
hardware disable action here early in rzn1_rtc_probe cause it to run last
during driver unbind?
[ ... ]
> @@ -468,14 +480,12 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
> ret = devm_request_irq(&pdev->dev, irq, rzn1_rtc_alarm_irq, 0, "RZN1 RTC Alarm", rtc);
> if (ret) {
> dev_err(&pdev->dev, "RTC alarm interrupt not available\n");
> - goto dis_runtime_pm;
> + return ret;
> }
[Severity: High]
If devm_request_irq is called after the hardware disable action is
registered, won't the IRQ handlers be freed before the hardware is disabled
during teardown?
If an RTC alarm or 1-second interrupt is active when the driver unbinds,
could an interrupt fire in the devres teardown window where the handler is
gone but the hardware is still active? This might trigger the generic IRQ
subsystem's spurious interrupt detector, which could permanently disable the
IRQ line.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=10
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 03/17] rtc: rzn1: Fix weekday underflow when alarm crosses month boundary
2026-08-21 13:55 ` [PATCH v5 03/17] rtc: rzn1: Fix weekday underflow when alarm crosses month boundary Prabhakar
@ 2026-08-21 14:08 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:08 UTC (permalink / raw)
To: Prabhakar
Cc: Alexandre Belloni, conor+dt, devicetree, robh, wsa+renesas,
linux-rtc
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> rzn1_rtc_set_alarm() calculates the alarm weekday from the difference
> between the alarm day and the current day of the month. When the alarm
> crosses a month boundary, this difference can become negative. Since
> days_ahead is unsigned, it underflows and results in an incorrect
> weekday being programmed into RZN1_RTC_ALW.
>
> The RTC core already provides a fully populated struct rtc_time for
> the alarm, including the correct tm_wday. Use tm->tm_wday directly
> instead of recalculating the weekday from the day-of-month.
>
> This avoids the underflow and ensures alarms scheduled across a month
> boundary use the correct weekday.
>
> Fixes: b5ad1bf00d2c4 ("rtc: rzn1: Add alarm support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=3
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 15/17] rtc: rzn1: Add OF match data to gate SUBU register access
2026-08-21 13:56 ` [PATCH v5 15/17] rtc: rzn1: Add OF match data to gate SUBU " Prabhakar
@ 2026-08-21 14:08 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:08 UTC (permalink / raw)
To: Prabhakar
Cc: devicetree, Alexandre Belloni, robh, wsa+renesas, linux-rtc,
conor+dt
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> The RZ/N1 RTC driver selects SCMP mode only when an optional xtal clock
> is provided at a valid rate other than 32768 Hz. Without an xtal clock,
> or when it runs at 32768 Hz, the driver uses SUBU mode.
>
> However, the RTCA0SUBU register used by SUBU mode is not present on all
> SoCs that integrate a similar variant of the RTC block. Allowing SUBU
> mode on those variants would expose RTC offset operations that access a
> non-existent register.
>
> Add OF match data to describe whether the RTC supports the SUBU register.
> Reject probe with -EOPNOTSUPP when SUBU mode would be selected on a
> variant without SUBU support.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=15
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 09/17] rtc: rzn1: Use pm_runtime_put_sync()
2026-08-21 13:56 ` [PATCH v5 09/17] rtc: rzn1: Use pm_runtime_put_sync() Prabhakar
@ 2026-08-21 14:08 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:08 UTC (permalink / raw)
To: Prabhakar
Cc: linux-rtc, conor+dt, wsa+renesas, Alexandre Belloni, robh,
devicetree
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> pm_runtime_put() may trigger the idle check after pm_runtime_disable()
> is run as part of devm_pm_runtime_enable()'s cleanup action, leaving
> runtime PM active.
>
> Use pm_runtime_put_sync() to ensure the idle check runs synchronously.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=9
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 17/17] rtc: rzn1: Add support for Renesas RZ/T2H and RZ/N2H SoCs
2026-08-21 13:56 ` [PATCH v5 17/17] rtc: rzn1: Add support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
@ 2026-08-21 14:09 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:09 UTC (permalink / raw)
To: Prabhakar
Cc: conor+dt, wsa+renesas, Alexandre Belloni, robh, linux-rtc,
devicetree
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Add support for the RTC block found on the Renesas RZ/T2H (R9A09G077)
> and RZ/N2H (R9A09G087) SoCs.
>
> These SoCs integrate a closely related variant of the RZ/N1 RTC IP, but
> do not implement the RTCA0SUBU register. Use variant-specific match data
> to disable SUBU support for these SoCs.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=17
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 04/17] rtc: rzn1: Handle unset alarm weekday in rzn1_rtc_read_alarm
2026-08-21 13:55 ` [PATCH v5 04/17] rtc: rzn1: Handle unset alarm weekday in rzn1_rtc_read_alarm Prabhakar
@ 2026-08-21 14:10 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:10 UTC (permalink / raw)
To: Prabhakar
Cc: wsa+renesas, devicetree, linux-rtc, robh, conor+dt,
Alexandre Belloni
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Medium] The RTC calibration offset cannot be reset to 0 once configured because `rzn1_rtc_set_offset()` returns early without updating the hardware.
--
--- Patch [4]: [PATCH v5 04/17] rtc: rzn1: Handle unset alarm weekday in rzn1_rtc_read_alarm ---
commit 03655d07aa4a099ff33de67c8c707b707a119002
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
rtc: rzn1: Handle unset alarm weekday in rzn1_rtc_read_alarm
This commit handles the case where the alarm weekday register is unset by
returning early to avoid fabricating an invalid alarm date. It also moves
the control register read before this check so that the enabled flag is
updated properly.
Cc: stable@vger.kernel.org
> diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
> --- a/drivers/rtc/rtc-rzn1.c
> +++ b/drivers/rtc/rtc-rzn1.c
[ ... ]
This is a pre-existing issue, but I noticed a potential logic flaw in the
RTC offset configuration while reviewing this file:
drivers/rtc/rtc-rzn1.c:rzn1_rtc_set_offset() {
...
if (stepsh >= -0x3E && stepsh <= 0x3E) {
/* 1017 ppb per step */
steps = stepsh;
subu |= RZN1_RTC_SUBU_DEV;
} else if (stepsl >= -0x3E && stepsl <= 0x3E) {
/* 3051 ppb per step */
steps = stepsl;
} else {
return -ERANGE;
}
if (!steps)
return 0;
...
}
[Severity: Medium]
Does this early return prevent the hardware register from being updated to
clear the calibration offset when steps evaluates to zero?
If a process attempts to reset the RTC offset to 0 ppb, this early return
prevents the hardware register (RZN1_RTC_SUBU) from being written. This
seems to leave the old calibration value applied in hardware, which would
result in persistent clock drift since the offset cannot be cleared.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 06/17] rtc: rzn1: Disable alarm interrupt before reprogramming alarm registers
2026-08-21 13:55 ` [PATCH v5 06/17] rtc: rzn1: Disable alarm interrupt before reprogramming alarm registers Prabhakar
@ 2026-08-21 14:10 ` sashiko-bot
0 siblings, 0 replies; 36+ messages in thread
From: sashiko-bot @ 2026-08-21 14:10 UTC (permalink / raw)
To: Prabhakar
Cc: wsa+renesas, Alexandre Belloni, robh, conor+dt, devicetree,
linux-rtc
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Concurrent lockless read and write of `rtc->tm_alarm` and a race with delayed IRQ handlers can cause a newly configured alarm to be silently disabled.
--
--- Patch [6]: [PATCH v5 06/17] rtc: rzn1: Disable alarm interrupt before reprogramming alarm registers ---
commit 6227942d78d91abfb1648a64bce64f0011716b61
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
rtc: rzn1: Disable alarm interrupt before reprogramming alarm registers
This commit updates rzn1_rtc_set_alarm() to disable the alarm interrupt
before reprogramming the alarm registers. This prevents the interrupt from
firing while the alarm registers contain a mixture of old and newly written
values.
> diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
> index 44e8db466cb78..09631a3a51345 100644
> --- a/drivers/rtc/rtc-rzn1.c
> +++ b/drivers/rtc/rtc-rzn1.c
> @@ -280,6 +280,11 @@ static int rzn1_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
> if (alarm > farest)
> return -ERANGE;
>
> + /* Disable alarm interrupts before reprogramming the alarm. */
> + ret = rzn1_rtc_alarm_irq_enable(dev, 0);
> + if (ret)
> + return ret;
> +
> writel(bin2bcd(tm->tm_min), rtc->base + RZN1_RTC_ALM);
> writel(bin2bcd(tm->tm_hour), rtc->base + RZN1_RTC_ALH);
> writel(BIT(tm->tm_wday), rtc->base + RZN1_RTC_ALW);
[Severity: High]
This is a pre-existing issue, but does this fully protect against a race
with a delayed IRQ handler?
If a previous alarm fires and the IRQ handler rzn1_rtc_alarm_irq() is
delayed on CPU1, and concurrently CPU0 runs rzn1_rtc_set_alarm():
CPU0 completes rzn1_rtc_set_alarm(), updating the lockless rtc->tm_alarm
and re-enabling the alarm by setting ALME in CTL1.
CPU1 then resumes in rzn1_rtc_alarm_irq():
if (rtc->tm_alarm.tm_sec == 0)
...
else
set_irq_bits = RZN1_RTC_CTL1_1SE;
guard(spinlock)(&rtc->ctl1_access_lock);
ctl1 = readl(rtc->base + RZN1_RTC_CTL1);
ctl1 &= ~RZN1_RTC_CTL1_ALME;
ctl1 |= set_irq_bits;
writel(ctl1, rtc->base + RZN1_RTC_CTL1);
Could CPU1 read the newly updated rtc->tm_alarm locklessly, and then
unconditionally clear ALME in CTL1? This sequence appears to silently
disable the newly configured alarm, which could result in missed wakeups.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821135608.275233-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=6
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v5 01/17] dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support
2026-08-21 14:05 ` sashiko-bot
@ 2026-08-21 15:03 ` Wolfram Sang
0 siblings, 0 replies; 36+ messages in thread
From: Wolfram Sang @ 2026-08-21 15:03 UTC (permalink / raw)
To: sashiko-reviews
Cc: Prabhakar, robh, Alexandre Belloni, conor+dt, devicetree,
linux-rtc
[-- Attachment #1: Type: text/plain, Size: 249 bytes --]
> Since unevaluatedProperties is set to false in this binding, if a device
> tree node attempts to expose and use this 1Hz output by providing
> #clock-cells, will it fail schema validation?
Binding will be updated once feature gets implemented.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2026-08-21 15:04 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21 13:55 [PATCH v5 00/17] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-08-21 13:55 ` [PATCH v5 01/17] dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support Prabhakar
2026-08-21 14:05 ` sashiko-bot
2026-08-21 15:03 ` Wolfram Sang
2026-08-21 13:55 ` [PATCH v5 02/17] rtc: rzn1: Handle EPROBE_DEFER for optional pps interrupt Prabhakar
2026-08-21 14:07 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 03/17] rtc: rzn1: Fix weekday underflow when alarm crosses month boundary Prabhakar
2026-08-21 14:08 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 04/17] rtc: rzn1: Handle unset alarm weekday in rzn1_rtc_read_alarm Prabhakar
2026-08-21 14:10 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 05/17] rtc: rzn1: Fix alarm range check truncation on 32-bit systems Prabhakar
2026-08-21 14:06 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 06/17] rtc: rzn1: Disable alarm interrupt before reprogramming alarm registers Prabhakar
2026-08-21 14:10 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 07/17] rtc: rzn1: Fix malformed MODULE_AUTHOR string Prabhakar
2026-08-21 14:01 ` sashiko-bot
2026-08-21 13:55 ` [PATCH v5 08/17] rtc: Kconfig: Broaden RTC_DRV_RZN1 dependency to ARCH_RENESAS Prabhakar
2026-08-21 14:02 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 09/17] rtc: rzn1: Use pm_runtime_put_sync() Prabhakar
2026-08-21 14:08 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 10/17] rtc: rzn1: Replace remove callback with devm_add_action_or_reset() Prabhakar
2026-08-21 14:07 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 11/17] rtc: rzn1: Dynamically calculate synchronization delay based on clock rate Prabhakar
2026-08-21 14:05 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 12/17] rtc: rzn1: Use temporary variable for struct device Prabhakar
2026-08-21 14:05 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 13/17] rtc: rzn1: Consistently use dev_err_probe() Prabhakar
2026-08-21 14:03 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 14/17] rtc: rzn1: use FIELD_PREP/FIELD_GET and GENMASK for register access Prabhakar
2026-08-21 14:06 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 15/17] rtc: rzn1: Add OF match data to gate SUBU " Prabhakar
2026-08-21 14:08 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 16/17] rtc: rzn1: Drop trailing comma from OF match table sentinel Prabhakar
2026-08-21 14:07 ` sashiko-bot
2026-08-21 13:56 ` [PATCH v5 17/17] rtc: rzn1: Add support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-08-21 14:09 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox