diff mbox

[U-Boot,v2,07/11] rtc: Fix rtc_reset() on s3c24x0_rtc

Message ID 1347643742-19966-8-git-send-email-jose.goncalves@inov.pt
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

José Miguel Gonçalves Sept. 14, 2012, 5:28 p.m. UTC
rtc_reset() must set the RTC date to the UNIX Epoch.

Signed-off-by: José Miguel Gonçalves <jose.goncalves@inov.pt>
---
Changes for v2:
   - New patch
---
 drivers/rtc/s3c24x0_rtc.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Comments

Marek Vasut Sept. 14, 2012, 6:07 p.m. UTC | #1
Dear José Miguel Gonçalves,

> rtc_reset() must set the RTC date to the UNIX Epoch.

Acked-by: Marek Vasut <marex@denx.de>

> Signed-off-by: José Miguel Gonçalves <jose.goncalves@inov.pt>
> ---
> Changes for v2:
>    - New patch
> ---
>  drivers/rtc/s3c24x0_rtc.c |   15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/rtc/s3c24x0_rtc.c b/drivers/rtc/s3c24x0_rtc.c
> index 7d04b74..54bf6e3 100644
> --- a/drivers/rtc/s3c24x0_rtc.c
> +++ b/drivers/rtc/s3c24x0_rtc.c
> @@ -167,10 +167,17 @@ int rtc_set(struct rtc_time *tmp)
> 
>  void rtc_reset(void)
>  {
> -	struct s3c24x0_rtc *rtc = s3c24x0_get_base_rtc();
> -
> -	writeb((readb(&rtc->rtccon) & ~0x06) | 0x08, &rtc->rtccon);
> -	writeb(readb(&rtc->rtccon) & ~(0x08 | 0x01), &rtc->rtccon);
> +	static struct rtc_time tmp = {
> +		.tm_year = 1970,
> +		.tm_mon = 1,
> +		.tm_mday = 1,
> +		.tm_wday = 4,
> +		.tm_hour = 0,
> +		.tm_min = 0,
> +		.tm_sec = 0,
> +	};
> +
> +	rtc_set(&tmp);
>  }
> 
>  #endif

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/drivers/rtc/s3c24x0_rtc.c b/drivers/rtc/s3c24x0_rtc.c
index 7d04b74..54bf6e3 100644
--- a/drivers/rtc/s3c24x0_rtc.c
+++ b/drivers/rtc/s3c24x0_rtc.c
@@ -167,10 +167,17 @@  int rtc_set(struct rtc_time *tmp)
 
 void rtc_reset(void)
 {
-	struct s3c24x0_rtc *rtc = s3c24x0_get_base_rtc();
-
-	writeb((readb(&rtc->rtccon) & ~0x06) | 0x08, &rtc->rtccon);
-	writeb(readb(&rtc->rtccon) & ~(0x08 | 0x01), &rtc->rtccon);
+	static struct rtc_time tmp = {
+		.tm_year = 1970,
+		.tm_mon = 1,
+		.tm_mday = 1,
+		.tm_wday = 4,
+		.tm_hour = 0,
+		.tm_min = 0,
+		.tm_sec = 0,
+	};
+
+	rtc_set(&tmp);
 }
 
 #endif