All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	linux-renesas-soc@vger.kernel.org,
	Magnus Damm <magnus.damm@gmail.com>,
	Gareth Williams <gareth.williams.jx@renesas.com>,
	Phil Edworthy <phil.edworthy@renesas.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	linux-clk@vger.kernel.org,
	Milan Stevanovic <milan.stevanovic@se.com>,
	Jimmy Lalande <jimmy.lalande@se.com>,
	Pascal Eberhard <pascal.eberhard@se.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Herve Codina <herve.codina@bootlin.com>,
	Clement Leger <clement.leger@bootlin.com>,
	linux-rtc@vger.kernel.org,
	Michel Pollet <michel.pollet@bp.renesas.com>
Subject: Re: [PATCH 3/7] rtc: rzn1: Add new RTC driver
Date: Wed, 13 Apr 2022 17:48:45 +0200	[thread overview]
Message-ID: <Ylbw3bEc+QK4m9hX@mail.local> (raw)
In-Reply-To: <20220413172327.73d1fcc1@xps13>

Hi Miquèl,

On 13/04/2022 17:23:27+0200, Miquel Raynal wrote:
> > > +static int rzn1_rtc_probe(struct platform_device *pdev)
> > > +{
> > > +	struct rzn1_rtc *rtc;
> > > +	int ret;
> > > +
> > > +	rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
> > > +	if (!rtc)
> > > +		return -ENOMEM;
> > > +
> > > +	platform_set_drvdata(pdev, rtc);
> > > +
> > > +	rtc->clk = devm_clk_get(&pdev->dev, "hclk");
> > > +	if (IS_ERR(rtc->clk))
> > > +		return dev_err_probe(&pdev->dev, PTR_ERR(rtc->clk), "Missing hclk\n");
> > > +
> > > +	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");
> > > +
> > > +	rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
> > > +	if (IS_ERR(rtc->rtcdev))
> > > +		return PTR_ERR(rtc);
> > > +
> > > +	rtc->rtcdev->range_max = 3178591199UL; /* 100 years */  
> > 
> > I'm not sure how you came to this value, this is 2070-09-22T05:59:59.
> > I'm pretty sure the RTC will not fail at that time. Also, the comment
> > seems fishy.
> 
> The RTC itself as no "starting point", but just a counter that can
> count up to 100. So the max range is start-year + 100 years. But at
> this point I don't yet have access to the start-year value. What's
> your advise?

The question is why is this limited to 100 years? My guess is that it
doesn't handle leap years properly if this is the case, there is only
one range that works, this is 2000-01-01 to 2099-12-31 like many other
RTCs.

You can run rtc-range from rtc-tools after removing range_max to find
out.

Cheers

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2022-04-13 15:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 18:47 [PATCH 0/7] RZN1 RTC support Miquel Raynal
2022-04-05 18:47 ` [PATCH 1/7] dt-bindings: rtc: rzn1: Describe the RZN1 RTC Miquel Raynal
2022-04-07  7:37   ` Krzysztof Kozlowski
2022-04-07  9:21     ` Miquel Raynal
2022-04-05 18:47 ` [PATCH 2/7] soc: renesas: rzn1-sysc: Export a function to enable/disable the RTC Miquel Raynal
2022-04-06  7:00   ` Thomas Petazzoni
2022-04-06  7:43     ` Miquel Raynal
2022-04-06  8:32   ` Alexandre Belloni
2022-04-05 18:47 ` [PATCH 3/7] rtc: rzn1: Add new RTC driver Miquel Raynal
2022-04-06  8:50   ` Alexandre Belloni
2022-04-13 15:23     ` Miquel Raynal
2022-04-13 15:48       ` Alexandre Belloni [this message]
2022-04-14 11:19         ` Miquel Raynal
2022-04-05 18:47 ` [PATCH 4/7] rtc: rzn1: Add alarm support Miquel Raynal
2022-04-06  9:10   ` Alexandre Belloni
2022-04-05 18:47 ` [PATCH 5/7] rtc: rzn1: Add oscillator offset support Miquel Raynal
2022-04-05 18:47 ` [PATCH 6/7] MAINTAINERS: Add myself as maintainer of the RZN1 RTC driver Miquel Raynal
2022-04-11 15:22   ` Geert Uytterhoeven
2022-04-05 18:47 ` [PATCH 7/7] ARM: dts: r9a06g032: Describe the RTC Miquel Raynal
2022-04-11 15:32   ` Geert Uytterhoeven

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=Ylbw3bEc+QK4m9hX@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=clement.leger@bootlin.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gareth.williams.jx@renesas.com \
    --cc=geert@linux-m68k.org \
    --cc=herve.codina@bootlin.com \
    --cc=jimmy.lalande@se.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=michel.pollet@bp.renesas.com \
    --cc=milan.stevanovic@se.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mturquette@baylibre.com \
    --cc=pascal.eberhard@se.com \
    --cc=phil.edworthy@renesas.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=thomas.petazzoni@bootlin.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.