[PATCH v2 2/3] rtc: s3c: support for exynosautov9 on-chip RTC

Devang Tailor posted 3 patches 2 months, 4 weeks ago
There is a newer version of this series
[PATCH v2 2/3] rtc: s3c: support for exynosautov9 on-chip RTC
Posted by Devang Tailor 2 months, 4 weeks ago
The on-chip RTC of this SoC is almost similar to the previous
versions of SoC. Hence re-use the existing driver with platform specific
change to enable RTC.

This has been tested with 'hwclock' & 'date' utilities

Signed-off-by: Devang Tailor <dev.tailor@samsung.com>
---
 drivers/rtc/rtc-s3c.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 5dd575865adf..8db24b6360b8 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -384,6 +384,15 @@ static void s3c6410_rtc_disable(struct s3c_rtc *info)
 	writew(con, info->base + S3C2410_RTCCON);
 }
 
+static void exynosautov9_rtc_disable(struct s3c_rtc *info)
+{
+	unsigned int con;
+
+	con = readb(info->base + S3C2410_RTCCON);
+	con &= ~S3C2410_RTCCON_RTCEN;
+	writeb(con, info->base + S3C2410_RTCCON);
+}
+
 static void s3c_rtc_remove(struct platform_device *pdev)
 {
 	struct s3c_rtc *info = platform_get_drvdata(pdev);
@@ -574,6 +583,12 @@ static struct s3c_rtc_data const 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		= exynosautov9_rtc_disable,
+};
+
 static const __maybe_unused struct of_device_id s3c_rtc_dt_match[] = {
 	{
 		.compatible = "samsung,s3c2410-rtc",
@@ -590,6 +605,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
Re: [PATCH v2 2/3] rtc: s3c: support for exynosautov9 on-chip RTC
Posted by Henrik Grimler 1 month ago
Hi Devang,

On Thu, Jul 10, 2025 at 02:04:33PM +0530, Devang Tailor wrote:
> The on-chip RTC of this SoC is almost similar to the previous
> versions of SoC. Hence re-use the existing driver with platform specific
> change to enable RTC.

Could you please describe what the differences are to previous SoCs?
You write almost similar, please elaborate in what way in commit
message.

> This has been tested with 'hwclock' & 'date' utilities
> 
> Signed-off-by: Devang Tailor <dev.tailor@samsung.com>
> ---
> 
>  drivers/rtc/rtc-s3c.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 5dd575865adf..8db24b6360b8 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -384,6 +384,15 @@ static void s3c6410_rtc_disable(struct s3c_rtc *info)
>  	writew(con, info->base + S3C2410_RTCCON);
>  }
>  
> +static void exynosautov9_rtc_disable(struct s3c_rtc *info)
> +{
> +	unsigned int con;
> +
> +	con = readb(info->base + S3C2410_RTCCON);
> +	con &= ~S3C2410_RTCCON_RTCEN;
> +	writeb(con, info->base + S3C2410_RTCCON);
> +}

Rather than adding a new rtc_disable variant I think this could be
handled in existing s3c24xx_rtc_disable (and I think that is what
Krzysztof meant). How about adding a new bool to rtc_data that
describes if S3C2410_TICNT reg is supported or not, and checking it in
s3c24xx_rtc_disable?

Best regards,
Henrik Grimler

>  static void s3c_rtc_remove(struct platform_device *pdev)
>  {
>  	struct s3c_rtc *info = platform_get_drvdata(pdev);
> @@ -574,6 +583,12 @@ static struct s3c_rtc_data const 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		= exynosautov9_rtc_disable,
> +};
> +
>  static const __maybe_unused struct of_device_id s3c_rtc_dt_match[] = {
>  	{
>  		.compatible = "samsung,s3c2410-rtc",
> @@ -590,6 +605,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
> 
>
RE: [PATCH v2 2/3] rtc: s3c: support for exynosautov9 on-chip RTC
Posted by Devang Tailor 1 month ago
Hi,


> -----Original Message-----
> From: Henrik Grimler <henrik@grimler.se>
> Sent: 04 September 2025 00:51
> To: Devang Tailor <dev.tailor@samsung.com>
> Cc: robh@kernel.org; krzk+dt@kernel.org; conor+dt@kernel.org;
> alim.akhtar@samsung.com; alexandre.belloni@bootlin.com;
> devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> samsung-soc@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> rtc@vger.kernel.org; faraz.ata@samsung.com
> Subject: Re: [PATCH v2 2/3] rtc: s3c: support for exynosautov9 on-chip RTC
> 
> Hi Devang,
> 
> On Thu, Jul 10, 2025 at 02:04:33PM +0530, Devang Tailor wrote:
> > The on-chip RTC of this SoC is almost similar to the previous versions
> > of SoC. Hence re-use the existing driver with platform specific change
> > to enable RTC.
> 
> Could you please describe what the differences are to previous SoCs?
> You write almost similar, please elaborate in what way in commit message.

Ok. I will add in V3.

> 
> > This has been tested with 'hwclock' & 'date' utilities
> >
> > Signed-off-by: Devang Tailor <dev.tailor@samsung.com>
> > ---
> >
> >  drivers/rtc/rtc-s3c.c | 18 ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> >
> > diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index
> > 5dd575865adf..8db24b6360b8 100644
> > --- a/drivers/rtc/rtc-s3c.c
> > +++ b/drivers/rtc/rtc-s3c.c
> > @@ -384,6 +384,15 @@ static void s3c6410_rtc_disable(struct s3c_rtc
> *info)
> >  	writew(con, info->base + S3C2410_RTCCON);  }
> >
> > +static void exynosautov9_rtc_disable(struct s3c_rtc *info) {
> > +	unsigned int con;
> > +
> > +	con = readb(info->base + S3C2410_RTCCON);
> > +	con &= ~S3C2410_RTCCON_RTCEN;
> > +	writeb(con, info->base + S3C2410_RTCCON); }
> 
> Rather than adding a new rtc_disable variant I think this could be handled
in
> existing s3c24xx_rtc_disable (and I think that is what Krzysztof meant).
How
> about adding a new bool to rtc_data that describes if S3C2410_TICNT reg is
> supported or not, and checking it in s3c24xx_rtc_disable?

Ok. I will add bool 'use_s3c2410_ticnt´ to differentiate if any variant uses
TICNT or not, making it
'true' for existing RTC variants which are using s3c24xx_rtc_disable().

> 
> Best regards,
> Henrik Grimler
> 
> >  static void s3c_rtc_remove(struct platform_device *pdev)  {
> >  	struct s3c_rtc *info = platform_get_drvdata(pdev); @@ -574,6 +583,12
> > @@ static struct s3c_rtc_data const 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		= exynosautov9_rtc_disable,
> > +};
> > +
> >  static const __maybe_unused struct of_device_id s3c_rtc_dt_match[] = {
> >  	{
> >  		.compatible = "samsung,s3c2410-rtc", @@ -590,6 +605,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
> >
> >

RE: [PATCH v2 2/3] rtc: s3c: support for exynosautov9 on-chip RTC
Posted by Alim Akhtar 2 months, 1 week ago

> -----Original Message-----
> From: Devang Tailor <dev.tailor@samsung.com>
> Sent: Thursday, July 10, 2025 2:05 PM
> To: robh@kernel.org; krzk+dt@kernel.org; conor+dt@kernel.org;
> alim.akhtar@samsung.com; alexandre.belloni@bootlin.com;
> devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> samsung-soc@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> rtc@vger.kernel.org; faraz.ata@samsung.com
> Cc: Devang Tailor <dev.tailor@samsung.com>
> Subject: [PATCH v2 2/3] rtc: s3c: support for exynosautov9 on-chip RTC
> 
> The on-chip RTC of this SoC is almost similar to the previous versions of SoC.
> Hence re-use the existing driver with platform specific change to enable RTC.
> 
> This has been tested with 'hwclock' & 'date' utilities
> 
> Signed-off-by: Devang Tailor <dev.tailor@samsung.com>
> ---
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Re: [PATCH v2 2/3] rtc: s3c: support for exynosautov9 on-chip RTC
Posted by Krzysztof Kozlowski 2 months, 4 weeks ago
On Thu, Jul 10, 2025 at 02:04:33PM +0530, Devang Tailor wrote:
> The on-chip RTC of this SoC is almost similar to the previous
> versions of SoC. Hence re-use the existing driver with platform specific
> change to enable RTC.
> 
> This has been tested with 'hwclock' & 'date' utilities
> 
> Signed-off-by: Devang Tailor <dev.tailor@samsung.com>
> ---
>  drivers/rtc/rtc-s3c.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 5dd575865adf..8db24b6360b8 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -384,6 +384,15 @@ static void s3c6410_rtc_disable(struct s3c_rtc *info)
>  	writew(con, info->base + S3C2410_RTCCON);
>  }
>  
> +static void exynosautov9_rtc_disable(struct s3c_rtc *info)
> +{
> +	unsigned int con;
> +
> +	con = readb(info->base + S3C2410_RTCCON);
> +	con &= ~S3C2410_RTCCON_RTCEN;
> +	writeb(con, info->base + S3C2410_RTCCON);
> +}

Looks a lot like s3c24xx_rtc_disable()...

Anyway, if you keep ignoring the review, no point to provide reviews
here.

Best regards,
Krzysztof
RE: [PATCH v2 2/3] rtc: s3c: support for exynosautov9 on-chip RTC
Posted by Devang Tailor 2 months, 4 weeks ago
Hi Krzysztof,


> -----Original Message-----
> From: Krzysztof Kozlowski <krzk@kernel.org>
> Sent: 11 July 2025 12:51
> To: Devang Tailor <dev.tailor@samsung.com>
> Cc: robh@kernel.org; krzk+dt@kernel.org; conor+dt@kernel.org;
> alim.akhtar@samsung.com; alexandre.belloni@bootlin.com;
> devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> samsung-soc@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> rtc@vger.kernel.org; faraz.ata@samsung.com
> Subject: Re: [PATCH v2 2/3] rtc: s3c: support for exynosautov9 on-chip RTC
> 
> On Thu, Jul 10, 2025 at 02:04:33PM +0530, Devang Tailor wrote:
> > The on-chip RTC of this SoC is almost similar to the previous versions
> > of SoC. Hence re-use the existing driver with platform specific change
> > to enable RTC.
> >
> > This has been tested with 'hwclock' & 'date' utilities
> >
> > Signed-off-by: Devang Tailor <dev.tailor@samsung.com>
> > ---
> >  drivers/rtc/rtc-s3c.c | 18 ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> >
> > diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index
> > 5dd575865adf..8db24b6360b8 100644
> > --- a/drivers/rtc/rtc-s3c.c
> > +++ b/drivers/rtc/rtc-s3c.c
> > @@ -384,6 +384,15 @@ static void s3c6410_rtc_disable(struct s3c_rtc
> *info)
> >  	writew(con, info->base + S3C2410_RTCCON);  }
> >
> > +static void exynosautov9_rtc_disable(struct s3c_rtc *info) {
> > +	unsigned int con;
> > +
> > +	con = readb(info->base + S3C2410_RTCCON);
> > +	con &= ~S3C2410_RTCCON_RTCEN;
> > +	writeb(con, info->base + S3C2410_RTCCON); }
> 
> Looks a lot like s3c24xx_rtc_disable()...
> 
> Anyway, if you keep ignoring the review, no point to provide reviews here.
> 

I have removed the redundant code I had added in V1 considering your review comment for asymmetry code.
s3c24xx_rtc_disable() & s3c6410_rtc_disable() updates additional bit, which is not valid for ExynosAutov9 (only RTCCON[4:0] are valid), hence I added this and mentioned in V2 cover letter as well.
Please let me know if I am missing anything.

> Best regards,
> Krzysztof