linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	linux-rtc@vger.kernel.org
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/3] rtc: mv: add range
Date: Fri, 15 Mar 2019 14:49:40 +0100	[thread overview]
Message-ID: <87a7hwtfgr.fsf@FE-laptop> (raw)
In-Reply-To: <20190315133513.9909-3-alexandre.belloni@bootlin.com>

Hi Alexandre,
 
 On ven., mars 15 2019, Alexandre Belloni <alexandre.belloni@bootlin.com> wrote:

> This RTC handles time from 2000-01-01 00:00:00 to 2099-12-31 23:59:59 with
> a weird rollover to 2000-06-23 00:00:00.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>

on Armada XP GP

Thanks,

Gregory

> ---
>  drivers/rtc/rtc-mv.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
> index ef704aef8663..e357a0b3f612 100644
> --- a/drivers/rtc/rtc-mv.c
> +++ b/drivers/rtc/rtc-mv.c
> @@ -57,7 +57,7 @@ static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm)
>  
>  	rtc_reg = (bin2bcd(tm->tm_mday) << RTC_MDAY_OFFS) |
>  		(bin2bcd(tm->tm_mon + 1) << RTC_MONTH_OFFS) |
> -		(bin2bcd(tm->tm_year % 100) << RTC_YEAR_OFFS);
> +		(bin2bcd(tm->tm_year - 100) << RTC_YEAR_OFFS);
>  	writel(rtc_reg, ioaddr + RTC_DATE_REG_OFFS);
>  
>  	return 0;
> @@ -156,7 +156,7 @@ static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
>  			<< RTC_MONTH_OFFS;
>  
>  	if (alm->time.tm_year >= 0)
> -		rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year % 100))
> +		rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year - 100))
>  			<< RTC_YEAR_OFFS;
>  
>  	writel(rtc_reg, ioaddr + RTC_ALARM_DATE_REG_OFFS);
> @@ -277,6 +277,9 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
>  		pdata->rtc->ops = &mv_rtc_ops;
>  	}
>  
> +	pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
> +	pdata->rtc->range_max = RTC_TIMESTAMP_END_2099;
> +
>  	ret = rtc_register_device(pdata->rtc);
>  	if (!ret)
>  		return 0;
> -- 
> 2.20.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-03-15 13:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-15 13:35 [PATCH 1/3] rtc: mv: convert to SPDX identifier Alexandre Belloni
2019-03-15 13:35 ` [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device Alexandre Belloni
2019-03-15 13:42   ` Gregory CLEMENT
2019-03-15 13:35 ` [PATCH 3/3] rtc: mv: add range Alexandre Belloni
2019-03-15 13:49   ` Gregory CLEMENT [this message]
2019-03-15 13:35 ` [PATCH 1/3] rtc: mv: convert to SPDX identifier Alexandre Belloni
2019-03-15 13:35 ` [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device Alexandre Belloni
2019-03-15 13:41 ` [PATCH 1/3] rtc: mv: convert to SPDX identifier Gregory CLEMENT

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=87a7hwtfgr.fsf@FE-laptop \
    --to=gregory.clement@bootlin.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rtc@vger.kernel.org \
    /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).