All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org,
	 Geert Uytterhoeven <geert+renesas@glider.be>,
	 Alexandre Belloni <alexandre.belloni@bootlin.com>,
	 linux-rtc@vger.kernel.org
Subject: Re: [PATCH v2 3/3] rtc: rzn1: support input frequencies other than 32768Hz
Date: Mon, 26 May 2025 09:22:31 +0200	[thread overview]
Message-ID: <87frgr4z0o.fsf@bootlin.com> (raw)
In-Reply-To: <20250523150541.8390-4-wsa+renesas@sang-engineering.com> (Wolfram Sang's message of "Fri, 23 May 2025 17:05:40 +0200")

Hello Wolfram,

...

> @@ -357,22 +359,21 @@ static int rzn1_rtc_set_offset(struct device *dev, long offset)
>  	return 0;
>  }
>  
> -static const struct rtc_class_ops rzn1_rtc_ops = {
> +static struct rtc_class_ops rzn1_rtc_ops = {
>  	.read_time = rzn1_rtc_read_time,
>  	.set_time = rzn1_rtc_set_time,
>  	.read_alarm = rzn1_rtc_read_alarm,
>  	.set_alarm = rzn1_rtc_set_alarm,
>  	.alarm_irq_enable = rzn1_rtc_alarm_irq_enable,
> -	.read_offset = rzn1_rtc_read_offset,
> -	.set_offset = rzn1_rtc_set_offset,
>  };

...

> -	writel(RZN1_RTC_CTL0_CE | RZN1_RTC_CTL0_AMPM | RZN1_RTC_CTL0_SLSB_SUBU,
> -	       rtc->base + RZN1_RTC_CTL0);
> +	/* Set desired modes while leaving the controller disabled */
> +	writel(RZN1_RTC_CTL0_AMPM | scmp_val, rtc->base + RZN1_RTC_CTL0);
> +
> +	if (scmp_val) {
> +		writel(rate - 1, rtc->base + RZN1_RTC_SCMP);
> +	} else {
> +		rzn1_rtc_ops.read_offset = rzn1_rtc_read_offset;
> +		rzn1_rtc_ops.set_offset = rzn1_rtc_set_offset;

I guess this situation is not possible but let me ask. Do we care
about the very unlikely case where two RTCs are available and configured
differently? Because we are overwriting a static entry here. Maybe we
could have two static structures and pick the correct one during probe
instead.

> +	}
> +
> +	/* Enable controller finally */
> +	writel(RZN1_RTC_CTL0_CE | RZN1_RTC_CTL0_AMPM | scmp_val, rtc->base + RZN1_RTC_CTL0);
>  
>  	/* Disable all interrupts */
>  	writel(0, rtc->base + RZN1_RTC_CTL1);

Anyhow, I don't see this comment as a no-go so,

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

  reply	other threads:[~2025-05-26  7:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23 15:05 [PATCH v2 0/3] rtc: rzn1: support XTAL clk and SCMP method Wolfram Sang
2025-05-23 15:05 ` [PATCH v2 1/3] dt-bindings: rtc: rzn1: add optional second clock Wolfram Sang
2025-05-23 15:05 ` [PATCH v2 2/3] rtc: rzn1: Disable controller before initialization Wolfram Sang
2025-05-23 15:05 ` [PATCH v2 3/3] rtc: rzn1: support input frequencies other than 32768Hz Wolfram Sang
2025-05-26  7:22   ` Miquel Raynal [this message]
2025-05-26  7:38     ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87frgr4z0o.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.