* [PATCH v3 0/3] On-chip RTC support for ExynosAutov9 [not found] <CGME20250905105708epcas5p159281b73f87fae88e824b97889908649@epcas5p1.samsung.com> @ 2025-09-05 11:05 ` Devang Tailor [not found] ` <CGME20250905105710epcas5p10516745944f09e262f41a5e5dcfce5f8@epcas5p1.samsung.com> ` (3 more replies) 0 siblings, 4 replies; 6+ messages in thread From: Devang Tailor @ 2025-09-05 11:05 UTC (permalink / raw) To: alexandre.belloni, robh, krzk+dt, conor+dt, alim.akhtar, linux-rtc, devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel, henrik, faraz.ata Cc: Devang Tailor Enable on-chip RTC support. The on-chip RTC of this SoC is similar to the previous version of Samsung SoCs except for TICNT tick time counter. So re-use the existing RTC driver with applicable call-backs for initialization and IRQ handling without accessing TICNT counter. As suggested in review comment, instead of adding separate disable() call-back, re-used the existing s3c24xx_rtc_disable() by adding a new bool 'use_s3c2410_ticnt' in rtc_data to avoid accessing TICNT counter which is not valid for RTC of ExynosAutov9. Setting and getting hardware clock has been tested using 'hwclock' and 'date' utilities. Alarm interrupt has been checked with incrementing interrupt count via "cat /proc/interrupts | grep rtc" for 10sec wakeup time via "echo +10 > /sys/class/rtc/rtc0/wakealarm" changelog --- Changes in v3: - 1/3 : Added Tag 'Reviewed-by' - 2/3 : Fixed the review comment of v2 to re-use the existing disable() instead of adding new one. : Not adding Tag 'Reviewed-by' from V2 since the patch has been changed - 3/3 : Added Tag 'Reviewed-by' link for v2 : https://lore.kernel.org/linux-rtc/20250710083434.1821671-1-dev.tailor@samsung.com/ Changes in v2: - Fixed the review comment of v1 for mis-aligmnent & asymmetry bit logic. - link for v1 : https://lore.kernel.org/linux-rtc/20250702052426.2404256-1-dev.tailor@samsung.com/ Devang Tailor (3): dt-bindings: rtc: s3c-rtc: add compatible for exynosautov9 rtc: s3c: support for exynosautov9 on-chip RTC arm64: dts: exynosautov9: add RTC DT node .../devicetree/bindings/rtc/s3c-rtc.yaml | 1 + .../boot/dts/exynos/exynosautov9-sadk.dts | 4 ++++ arch/arm64/boot/dts/exynos/exynosautov9.dtsi | 10 +++++++++ drivers/rtc/rtc-s3c.c | 21 ++++++++++++++++--- 4 files changed, 33 insertions(+), 3 deletions(-) base-commit: 4ac65880ebca1b68495bd8704263b26c050ac010 -- 2.34.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CGME20250905105710epcas5p10516745944f09e262f41a5e5dcfce5f8@epcas5p1.samsung.com>]
* [PATCH v3 1/3] dt-bindings: rtc: s3c-rtc: add compatible for exynosautov9 [not found] ` <CGME20250905105710epcas5p10516745944f09e262f41a5e5dcfce5f8@epcas5p1.samsung.com> @ 2025-09-05 11:05 ` Devang Tailor 0 siblings, 0 replies; 6+ messages in thread From: Devang Tailor @ 2025-09-05 11:05 UTC (permalink / raw) To: alexandre.belloni, robh, krzk+dt, conor+dt, alim.akhtar, linux-rtc, devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel, henrik, faraz.ata Cc: Devang Tailor, Krzysztof Kozlowski Add "samsung,exynosautov9-rtc" dedicated compatible for on-chip RTC found in ExynosAutov9 SoC. Signed-off-by: Devang Tailor <dev.tailor@samsung.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> --- Documentation/devicetree/bindings/rtc/s3c-rtc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/rtc/s3c-rtc.yaml b/Documentation/devicetree/bindings/rtc/s3c-rtc.yaml index bf4e11d6dffb..5daee2a5f866 100644 --- a/Documentation/devicetree/bindings/rtc/s3c-rtc.yaml +++ b/Documentation/devicetree/bindings/rtc/s3c-rtc.yaml @@ -13,6 +13,7 @@ properties: compatible: oneOf: - enum: + - samsung,exynosautov9-rtc - samsung,s3c2410-rtc - samsung,s3c2416-rtc - samsung,s3c2443-rtc -- 2.34.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <CGME20250905105712epcas5p35b5f24b8570c050b7ee675cb26f8ce43@epcas5p3.samsung.com>]
* [PATCH v3 2/3] rtc: s3c: support for exynosautov9 on-chip RTC [not found] ` <CGME20250905105712epcas5p35b5f24b8570c050b7ee675cb26f8ce43@epcas5p3.samsung.com> @ 2025-09-05 11:05 ` Devang Tailor 2025-09-05 14:03 ` Henrik Grimler 0 siblings, 1 reply; 6+ messages in thread From: Devang Tailor @ 2025-09-05 11:05 UTC (permalink / raw) To: alexandre.belloni, robh, krzk+dt, conor+dt, alim.akhtar, linux-rtc, devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel, henrik, faraz.ata Cc: Devang Tailor The on-chip RTC of this SoC is almost similar to the previous version of SoCs except for S3C2410_TICNT tick time counter, which is used in this driver but not applicable for exynosautov9. So re-use the existing driver skipping disablement of S3C2410_TICNT in s3c24xx_rtc_disable() callback via a new boolean member of s3c_rtc_data. This has been tested with 'hwclock' & 'date' utilities Suggested-by: Henrik Grimler <henrik@grimler.se> Signed-off-by: Devang Tailor <dev.tailor@samsung.com> --- drivers/rtc/rtc-s3c.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 79b2a16f15ad..8fc5b4582b6d 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -48,6 +48,7 @@ struct s3c_rtc { struct s3c_rtc_data { bool needs_src_clk; + bool use_s3c2410_ticnt; void (*irq_handler) (struct s3c_rtc *info, int mask); void (*enable) (struct s3c_rtc *info); @@ -369,9 +370,11 @@ static void s3c24xx_rtc_disable(struct s3c_rtc *info) con &= ~S3C2410_RTCCON_RTCEN; writew(con, info->base + S3C2410_RTCCON); - con = readb(info->base + S3C2410_TICNT); - con &= ~S3C2410_TICNT_ENABLE; - writeb(con, info->base + S3C2410_TICNT); + if (info->data->use_s3c2410_ticnt) { + con = readb(info->base + S3C2410_TICNT); + con &= ~S3C2410_TICNT_ENABLE; + writeb(con, info->base + S3C2410_TICNT); + } } static void s3c6410_rtc_disable(struct s3c_rtc *info) @@ -550,18 +553,21 @@ static void s3c6410_rtc_irq(struct s3c_rtc *info, int mask) } static const struct s3c_rtc_data s3c2410_rtc_data = { + .use_s3c2410_ticnt = true, .irq_handler = s3c24xx_rtc_irq, .enable = s3c24xx_rtc_enable, .disable = s3c24xx_rtc_disable, }; static const struct s3c_rtc_data s3c2416_rtc_data = { + .use_s3c2410_ticnt = true, .irq_handler = s3c24xx_rtc_irq, .enable = s3c24xx_rtc_enable, .disable = s3c24xx_rtc_disable, }; static const struct s3c_rtc_data s3c2443_rtc_data = { + .use_s3c2410_ticnt = true, .irq_handler = s3c24xx_rtc_irq, .enable = s3c24xx_rtc_enable, .disable = s3c24xx_rtc_disable, @@ -574,6 +580,12 @@ static const struct s3c_rtc_data s3c6410_rtc_data = { .disable = s3c6410_rtc_disable, }; +static const struct s3c_rtc_data exynosautov9_rtc_data = { + .irq_handler = s3c6410_rtc_irq, + .enable = s3c24xx_rtc_enable, + .disable = s3c24xx_rtc_disable, +}; + static const __maybe_unused struct of_device_id s3c_rtc_dt_match[] = { { .compatible = "samsung,s3c2410-rtc", @@ -590,6 +602,9 @@ static const __maybe_unused struct of_device_id s3c_rtc_dt_match[] = { }, { .compatible = "samsung,exynos3250-rtc", .data = &s3c6410_rtc_data, + }, { + .compatible = "samsung,exynosautov9-rtc", + .data = &exynosautov9_rtc_data, }, { /* sentinel */ }, }; -- 2.34.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/3] rtc: s3c: support for exynosautov9 on-chip RTC 2025-09-05 11:05 ` [PATCH v3 2/3] rtc: s3c: support for exynosautov9 on-chip RTC Devang Tailor @ 2025-09-05 14:03 ` Henrik Grimler 0 siblings, 0 replies; 6+ messages in thread From: Henrik Grimler @ 2025-09-05 14:03 UTC (permalink / raw) To: Devang Tailor Cc: alexandre.belloni, robh, krzk+dt, conor+dt, alim.akhtar, linux-rtc, devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel, faraz.ata Hi Devang, On Fri, Sep 05, 2025 at 04:35:53PM +0530, Devang Tailor wrote: > The on-chip RTC of this SoC is almost similar to the previous version of > SoCs except for S3C2410_TICNT tick time counter, which is used in this > driver but not applicable for exynosautov9. So re-use the existing driver > skipping disablement of S3C2410_TICNT in s3c24xx_rtc_disable() callback > via a new boolean member of s3c_rtc_data. > > This has been tested with 'hwclock' & 'date' utilities > > Suggested-by: Henrik Grimler <henrik@grimler.se> > Signed-off-by: Devang Tailor <dev.tailor@samsung.com> Reviewed-by: Henrik Grimler <henrik@grimler.se> Thank you, looks good! Best regards, Henrik Grimler > --- > drivers/rtc/rtc-s3c.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c > index 79b2a16f15ad..8fc5b4582b6d 100644 > --- a/drivers/rtc/rtc-s3c.c > +++ b/drivers/rtc/rtc-s3c.c > @@ -48,6 +48,7 @@ struct s3c_rtc { > > struct s3c_rtc_data { > bool needs_src_clk; > + bool use_s3c2410_ticnt; > > void (*irq_handler) (struct s3c_rtc *info, int mask); > void (*enable) (struct s3c_rtc *info); > @@ -369,9 +370,11 @@ static void s3c24xx_rtc_disable(struct s3c_rtc *info) > con &= ~S3C2410_RTCCON_RTCEN; > writew(con, info->base + S3C2410_RTCCON); > > - con = readb(info->base + S3C2410_TICNT); > - con &= ~S3C2410_TICNT_ENABLE; > - writeb(con, info->base + S3C2410_TICNT); > + if (info->data->use_s3c2410_ticnt) { > + con = readb(info->base + S3C2410_TICNT); > + con &= ~S3C2410_TICNT_ENABLE; > + writeb(con, info->base + S3C2410_TICNT); > + } > } > > static void s3c6410_rtc_disable(struct s3c_rtc *info) > @@ -550,18 +553,21 @@ static void s3c6410_rtc_irq(struct s3c_rtc *info, int mask) > } > > static const struct s3c_rtc_data s3c2410_rtc_data = { > + .use_s3c2410_ticnt = true, > .irq_handler = s3c24xx_rtc_irq, > .enable = s3c24xx_rtc_enable, > .disable = s3c24xx_rtc_disable, > }; > > static const struct s3c_rtc_data s3c2416_rtc_data = { > + .use_s3c2410_ticnt = true, > .irq_handler = s3c24xx_rtc_irq, > .enable = s3c24xx_rtc_enable, > .disable = s3c24xx_rtc_disable, > }; > > static const struct s3c_rtc_data s3c2443_rtc_data = { > + .use_s3c2410_ticnt = true, > .irq_handler = s3c24xx_rtc_irq, > .enable = s3c24xx_rtc_enable, > .disable = s3c24xx_rtc_disable, > @@ -574,6 +580,12 @@ static const struct s3c_rtc_data s3c6410_rtc_data = { > .disable = s3c6410_rtc_disable, > }; > > +static const struct s3c_rtc_data exynosautov9_rtc_data = { > + .irq_handler = s3c6410_rtc_irq, > + .enable = s3c24xx_rtc_enable, > + .disable = s3c24xx_rtc_disable, > +}; > + > static const __maybe_unused struct of_device_id s3c_rtc_dt_match[] = { > { > .compatible = "samsung,s3c2410-rtc", > @@ -590,6 +602,9 @@ static const __maybe_unused struct of_device_id s3c_rtc_dt_match[] = { > }, { > .compatible = "samsung,exynos3250-rtc", > .data = &s3c6410_rtc_data, > + }, { > + .compatible = "samsung,exynosautov9-rtc", > + .data = &exynosautov9_rtc_data, > }, > { /* sentinel */ }, > }; > -- > 2.34.1 > ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CGME20250905105714epcas5p4bb26e232702a9dff37e87dfd07da3946@epcas5p4.samsung.com>]
* [PATCH v3 3/3] arm64: dts: exynosautov9: add RTC DT node [not found] ` <CGME20250905105714epcas5p4bb26e232702a9dff37e87dfd07da3946@epcas5p4.samsung.com> @ 2025-09-05 11:05 ` Devang Tailor 0 siblings, 0 replies; 6+ messages in thread From: Devang Tailor @ 2025-09-05 11:05 UTC (permalink / raw) To: alexandre.belloni, robh, krzk+dt, conor+dt, alim.akhtar, linux-rtc, devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel, henrik, faraz.ata Cc: Devang Tailor Add DT node for on-chip RTC for ExynosAutov9 Signed-off-by: Devang Tailor <dev.tailor@samsung.com> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> --- arch/arm64/boot/dts/exynos/exynosautov9-sadk.dts | 4 ++++ arch/arm64/boot/dts/exynos/exynosautov9.dtsi | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/exynosautov9-sadk.dts b/arch/arm64/boot/dts/exynos/exynosautov9-sadk.dts index de2c1de51a76..5f5167571f7a 100644 --- a/arch/arm64/boot/dts/exynos/exynosautov9-sadk.dts +++ b/arch/arm64/boot/dts/exynos/exynosautov9-sadk.dts @@ -106,6 +106,10 @@ &pwm { status = "okay"; }; +&rtc { + status = "okay"; +}; + &serial_0 { pinctrl-0 = <&uart0_bus_dual>; status = "okay"; diff --git a/arch/arm64/boot/dts/exynos/exynosautov9.dtsi b/arch/arm64/boot/dts/exynos/exynosautov9.dtsi index 66628cb32776..afa6b258153c 100644 --- a/arch/arm64/boot/dts/exynos/exynosautov9.dtsi +++ b/arch/arm64/boot/dts/exynos/exynosautov9.dtsi @@ -1633,6 +1633,16 @@ pwm: pwm@103f0000 { clock-names = "timers"; status = "disabled"; }; + + rtc: rtc@10540000 { + compatible = "samsung,exynosautov9-rtc"; + reg = <0x10540000 0x100>; + interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&xtcxo>; + clock-names = "rtc"; + status = "disabled"; + }; }; }; -- 2.34.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/3] On-chip RTC support for ExynosAutov9 2025-09-05 11:05 ` [PATCH v3 0/3] On-chip RTC support for ExynosAutov9 Devang Tailor ` (2 preceding siblings ...) [not found] ` <CGME20250905105714epcas5p4bb26e232702a9dff37e87dfd07da3946@epcas5p4.samsung.com> @ 2025-10-05 21:42 ` Alexandre Belloni 3 siblings, 0 replies; 6+ messages in thread From: Alexandre Belloni @ 2025-10-05 21:42 UTC (permalink / raw) To: Devang Tailor Cc: robh, krzk+dt, conor+dt, alim.akhtar, linux-rtc, devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel, henrik, faraz.ata On 05/09/2025 16:35:51+0530, Devang Tailor wrote: > Enable on-chip RTC support. The on-chip RTC of this SoC is similar > to the previous version of Samsung SoCs except for TICNT tick time > counter. So re-use the existing RTC driver with applicable call-backs > for initialization and IRQ handling without accessing TICNT counter. > > As suggested in review comment, instead of adding separate disable() > call-back, re-used the existing s3c24xx_rtc_disable() by adding a new > bool 'use_s3c2410_ticnt' in rtc_data to avoid accessing TICNT counter > which is not valid for RTC of ExynosAutov9. > > Setting and getting hardware clock has been tested using 'hwclock' > and 'date' utilities. > > Alarm interrupt has been checked with incrementing interrupt > count via "cat /proc/interrupts | grep rtc" for 10sec > wakeup time via "echo +10 > /sys/class/rtc/rtc0/wakealarm" > > changelog > --- > Changes in v3: > - 1/3 : Added Tag 'Reviewed-by' > - 2/3 : Fixed the review comment of v2 to re-use the existing disable() > instead of adding new one. > : Not adding Tag 'Reviewed-by' from V2 since the patch has been > changed > - 3/3 : Added Tag 'Reviewed-by' > link for v2 : https://lore.kernel.org/linux-rtc/20250710083434.1821671-1-dev.tailor@samsung.com/ > > > Changes in v2: > - Fixed the review comment of v1 for mis-aligmnent & asymmetry bit logic. > - link for v1 : https://lore.kernel.org/linux-rtc/20250702052426.2404256-1-dev.tailor@samsung.com/ > > > Devang Tailor (3): > dt-bindings: rtc: s3c-rtc: add compatible for exynosautov9 > rtc: s3c: support for exynosautov9 on-chip RTC > arm64: dts: exynosautov9: add RTC DT node > > .../devicetree/bindings/rtc/s3c-rtc.yaml | 1 + > .../boot/dts/exynos/exynosautov9-sadk.dts | 4 ++++ > arch/arm64/boot/dts/exynos/exynosautov9.dtsi | 10 +++++++++ > drivers/rtc/rtc-s3c.c | 21 ++++++++++++++++--- > 4 files changed, 33 insertions(+), 3 deletions(-) > > > base-commit: 4ac65880ebca1b68495bd8704263b26c050ac010 You should rebase on top of rtc-next as s3c2410 support has been removed. -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-05 21:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20250905105708epcas5p159281b73f87fae88e824b97889908649@epcas5p1.samsung.com>
2025-09-05 11:05 ` [PATCH v3 0/3] On-chip RTC support for ExynosAutov9 Devang Tailor
[not found] ` <CGME20250905105710epcas5p10516745944f09e262f41a5e5dcfce5f8@epcas5p1.samsung.com>
2025-09-05 11:05 ` [PATCH v3 1/3] dt-bindings: rtc: s3c-rtc: add compatible for exynosautov9 Devang Tailor
[not found] ` <CGME20250905105712epcas5p35b5f24b8570c050b7ee675cb26f8ce43@epcas5p3.samsung.com>
2025-09-05 11:05 ` [PATCH v3 2/3] rtc: s3c: support for exynosautov9 on-chip RTC Devang Tailor
2025-09-05 14:03 ` Henrik Grimler
[not found] ` <CGME20250905105714epcas5p4bb26e232702a9dff37e87dfd07da3946@epcas5p4.samsung.com>
2025-09-05 11:05 ` [PATCH v3 3/3] arm64: dts: exynosautov9: add RTC DT node Devang Tailor
2025-10-05 21:42 ` [PATCH v3 0/3] On-chip RTC support for ExynosAutov9 Alexandre Belloni
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).