linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Lukasz Majewski <lukma@denx.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: Add support for century bits to m41t62 (rv4162) RTC devices
Date: Thu, 3 Oct 2019 13:48:31 +0200	[thread overview]
Message-ID: <20191003114831.GR4106@piout.net> (raw)
In-Reply-To: <20190911154803.15969-1-lukma@denx.de>

Hello,

On 11/09/2019 17:48:03+0200, Lukasz Majewski wrote:
> This change adds support for 'century bits' on 4162 family of RTC devices
> (from ST or microcrystal), which allow storing time beyond year 2099.
> 
> For rv4162 century bits - CB1[7]:CB0[6] are stored in reg6 - 0x6 (MONTH):
> CB1  CB0
>  0    0      (year 2000 - 2099)
>  0    1      (year 2100 - 2199)
>  1    0      (year 2200 - 2299)
>  1    1      (year 2300 - 2399)
> 
> The driver has been also adjusted to allow setting time up to year 2399
> if the M41T80_FEATURE_CB is set in its DTS/I2C data.
> 
> There shall be no functional changes for devices not supporting this
> feature. However, other devices - like m41t80 - have different approaches
> to handle century information.
> 

This does not work because the RTC doesn't handle leap years on century
properly. This means that if you do that, then there is no guarantee the
date will be the correct after 2099. As far as the m41t62 and rv4162
are concerned, there is no way to make the century bits useful.

See the datasheet:

"During any year which is a multiple of 4, the RV-4162 RTC will
automatically insert leap day, February 29.  Therefore, the application
software must correct for this during the exception years (2100, 2200,
etc.) as noted above."

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

  parent reply	other threads:[~2019-10-03 11:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11 15:48 [PATCH] rtc: Add support for century bits to m41t62 (rv4162) RTC devices Lukasz Majewski
2019-09-30  7:56 ` Lukasz Majewski
2019-10-03 11:48 ` Alexandre Belloni [this message]
2019-10-03 12:21   ` Lukasz Majewski
2019-10-03 12:35     ` Alexandre Belloni
2019-10-03 13:14       ` Lukasz Majewski
2019-10-03 13:43         ` Alexandre Belloni
2019-10-03 14:10           ` Lukasz Majewski
2019-10-03 14:23             ` Alexandre Belloni
2019-10-03 14:49               ` Lukasz Majewski
2019-10-03 21:34                 ` Alexandre Belloni

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=20191003114831.GR4106@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=lukma@denx.de \
    /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 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).