rtc: rtc-s3c: Fix RTC bugs for RTC-S3C
Subsystems (2)
cover rtc: rtc-s3c: Fix RTC bugs for RTC-S3C
This patch fixes on bugs of rtc-s3c.
However, each patch is independent.
This includes the following patches.
[PATCH 1/5] rtc: rtc-s3c: Fix access unit from byte to word on RTCCON [PATCH 2/5] rtc: rtc-s3c: Fix setting missing field of getalarm [PATCH 3/5] rtc: rtc-s3c: Fix on support RTC Alarm
[PATCH 4/5] rtc: rtc-s3c: Fix on RTC initialization method [PATCH 5/5] rtc: rtc-s3c: Fix debug message format on RTC
PATCH 1/5 rtc: rtc-s3c: Fix access unit from byte to word on RTCCON
From: Changhwan Youn <[email protected]>
S3C2410_RTCCON of TYPE_S3C64XX RTC should be read/written by readw and writew, because TYPE_S3C64XX RTC uses bit8 and bit9.
--- drivers/rtc/rtc-s3c.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/rtc/rtc-s3c.c +9 -9
@@ -100,7 +100,7 @@ static int s3c_rtc_setpie(struct device *dev, int enabled)spin_lock_irq (&s3c_rtc_pie_lock);if (s3c_rtc_cpu_type ==TYPE_S3C64XX ) { - tmp =readb (s3c_rtc_base +S3C2410_RTCCON ); + tmp =readw (s3c_rtc_base +S3C2410_RTCCON ); tmp &= ~S3C64XX_RTCCON_TICEN ;if (enabled)
@@ -323,7 +323,7 @@ static int s3c_rtc_proc(struct device *dev, struct seq_file *seq)unsigned int ticnt;if (s3c_rtc_cpu_type ==TYPE_S3C64XX ) { - ticnt =readb (s3c_rtc_base +S3C2410_RTCCON ); + ticnt =readw (s3c_rtc_base +S3C2410_RTCCON ); ticnt &=S3C64XX_RTCCON_TICEN ; }else { ticnt =readb (s3c_rtc_base +S3C2410_TICNT );
@@ -396,11 +396,11 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en)return ;if (!en) { - tmp =readb (base +S3C2410_RTCCON ); + tmp =readw (base +S3C2410_RTCCON );if (s3c_rtc_cpu_type ==TYPE_S3C64XX ) tmp &= ~S3C64XX_RTCCON_TICEN ; tmp &= ~S3C2410_RTCCON_RTCEN ; -writeb (tmp, base +S3C2410_RTCCON ); +writew (tmp, base +S3C2410_RTCCON );if (s3c_rtc_cpu_type ==TYPE_S3C2410 ) { tmp =readb (base +S3C2410_TICNT );
@@ -519,8 +519,8 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)s3c_rtc_enable (pdev,1 ); -pr_debug ("s3c2410_rtc: RTCCON=%02x\n" , -readb (s3c_rtc_base +S3C2410_RTCCON )); +pr_debug ("s3c2410_rtc: RTCCON=%02x\n" , +readw (s3c_rtc_base +S3C2410_RTCCON ));device_init_wakeup (&pdev->dev,1 );
@@ -583,7 +583,7 @@ static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state)/* save TICNT for anyone using periodic interrupts */ ticnt_save =readb (s3c_rtc_base +S3C2410_TICNT );if (s3c_rtc_cpu_type ==TYPE_S3C64XX ) { - ticnt_en_save =readb (s3c_rtc_base +S3C2410_RTCCON ); + ticnt_en_save =readw (s3c_rtc_base +S3C2410_RTCCON ); ticnt_en_save &=S3C64XX_RTCCON_TICEN ; }s3c_rtc_enable (pdev,0 );
@@ -597,8 +597,8 @@ static int s3c_rtc_resume(struct platform_device *pdev)s3c_rtc_enable (pdev,1 );writeb (ticnt_save, s3c_rtc_base +S3C2410_TICNT );if (s3c_rtc_cpu_type ==TYPE_S3C64XX && ticnt_en_save) { - tmp =readb (s3c_rtc_base +S3C2410_RTCCON ); -writeb (tmp | ticnt_en_save, s3c_rtc_base +S3C2410_RTCCON ); + tmp =readw (s3c_rtc_base +S3C2410_RTCCON ); +writew (tmp | ticnt_en_save, s3c_rtc_base +S3C2410_RTCCON ); }return 0 ; }
Signature · 1 line
1.6.2.5
PATCH 1/5 rtc: rtc-s3c: Fix access unit from byte to word on RTCCON
Quoted 8 lines · Kukjin Kim
From: Changhwan Youn <[email protected]>
S3C2410_RTCCONofTYPE_S3C64XXRTC should be read/written by readw and writew, becauseTYPE_S3C64XXRTC uses bit8 and bit9.Signed-off-by Changhwan Youn <[email protected]>Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>
Anyone else tried this on s3c24xx?
PATCH 2/5 rtc: rtc-s3c: Fix setting missing field of getalarm
In reply to Kukjin KimFrom: Changhwan Youn <[email protected]>
Current s3c_rtc_getalarm() sets missing field of alarm time with 0xff. But this value should be -1 according to drivers/rtc/interface.c.
--- drivers/rtc/rtc-s3c.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/rtc/rtc-s3c.c +6 -6
@@ -242,34 +242,34 @@ static int s3c_rtc_getalarm(struct device *dev, struct rtc_wkalrm *alrm)if (alm_en &S3C2410_RTCALM_SECEN ) alm_tm->tm_sec =bcd2bin (alm_tm->tm_sec);else - alm_tm->tm_sec =0xff ; + alm_tm->tm_sec =-1 ;if (alm_en &S3C2410_RTCALM_MINEN ) alm_tm->tm_min =bcd2bin (alm_tm->tm_min);else - alm_tm->tm_min =0xff ; + alm_tm->tm_min =-1 ;if (alm_en &S3C2410_RTCALM_HOUREN ) alm_tm->tm_hour =bcd2bin (alm_tm->tm_hour);else - alm_tm->tm_hour =0xff ; + alm_tm->tm_hour =-1 ;if (alm_en &S3C2410_RTCALM_DAYEN ) alm_tm->tm_mday =bcd2bin (alm_tm->tm_mday);else - alm_tm->tm_mday =0xff ; + alm_tm->tm_mday =-1 ;if (alm_en &S3C2410_RTCALM_MONEN ) { alm_tm->tm_mon =bcd2bin (alm_tm->tm_mon); alm_tm->tm_mon -=1 ; }else { - alm_tm->tm_mon =0xff ; + alm_tm->tm_mon =-1 ; }if (alm_en &S3C2410_RTCALM_YEAREN ) alm_tm->tm_year =bcd2bin (alm_tm->tm_year);else - alm_tm->tm_year =0xffff ; + alm_tm->tm_year =-1 ;return 0 ; }
Signature · 1 line
1.6.2.5
PATCH 2/5 rtc: rtc-s3c: Fix setting missing field of getalarm
Quoted 4 lines · Kukjin Kim
From: Changhwan Youn <[email protected]>
Current
s3c_rtc_getalarm()sets missing field of alarm time with0xff. But this value should be -1 according todrivers/rtc/interface.c.
Never noticed a problem, but then this call isn't the most used call.
Quoted 3 lines
Signed-off-by Changhwan Youn <[email protected]>Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>
PATCH 3/5 rtc: rtc-s3c: Fix on support RTC Alarm
In reply to Kukjin KimFrom: Changhwan Youn <[email protected]>
The alarm_irq_enable function should be implemented to support RTC alarm. And fixes tab instead of white space abound proc field.
--- drivers/rtc/rtc-s3c.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/rtc/rtc-s3c.c +2 -1
@@ -384,7 +384,8 @@ static const struct rtc_class_ops s3c_rtcops = { .set_alarm = s3c_rtc_setalarm, .irq_set_freq = s3c_rtc_setfreq, .irq_set_state = s3c_rtc_setpie, - .proc = s3c_rtc_proc, + .proc = s3c_rtc_proc, + .alarm_irq_enable = s3c_rtc_setaie, };static void s3c_rtc_enable (struct platform_device *pdev,int en)
Signature · 1 line
1.6.2.5
PATCH 3/5 rtc: rtc-s3c: Fix on support RTC Alarm
Quoted 8 lines · Kukjin Kim
From: Changhwan Youn <[email protected]>
The
alarm_irq_enablefunction should be implemented to support RTC alarm. And fixes tab instead of white space abound proc field.Signed-off-by Changhwan Youn <[email protected]>Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>
oops. wonder how long that's been broken for.
PATCH 4/5 rtc: rtc-s3c: Fix on RTC initialization method
In reply to Kukjin KimFrom: Changhwan Youn <[email protected]>
This patch changes RTC initialization method on probe() as per Wan ZongShun's suggestion. The 'rtc_valid_tm(tm)' can check whether RTC BCD is valid or not.
And should be changed the method of check because previous method cannot validate RTC BCD registers properly.
--- drivers/rtc/rtc-s3c.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-)
drivers/rtc/rtc-s3c.c +11 -5
@@ -458,8 +458,8 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)static int __devinit s3c_rtc_probe (struct platform_device *pdev) {struct rtc_device *rtc; +struct rtc_time rtc_tm;struct resource *res; -unsigned int tmp, i;int ret;pr_debug ("%s: probe=%p\n" , __func__, pdev);
@@ -540,11 +540,17 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)/* Check RTC Time */ -for (i =S3C2410_RTCSEC ; i <=S3C2410_RTCYEAR ; i +=0x4 ) { - tmp =readb (s3c_rtc_base + i); +s3c_rtc_gettime (NULL , &rtc_tm); -if ((tmp &0xf ) >0x9 || ((tmp >>4 ) &0xf ) >0x9 ) -writeb (0 , s3c_rtc_base + i); +if (rtc_valid_tm (&rtc_tm)) { + rtc_tm.tm_year =100 ; + rtc_tm.tm_mon =0 ; + rtc_tm.tm_mday =1 ; + rtc_tm.tm_hour =0 ; + rtc_tm.tm_min =0 ; + rtc_tm.tm_sec =0 ; + +s3c_rtc_settime (NULL , &rtc_tm); }if (s3c_rtc_cpu_type ==TYPE_S3C64XX )
Signature · 1 line
1.6.2.5
PATCH 4/5 rtc: rtc-s3c: Fix on RTC initialization method
Quoted 35 lines · Kukjin Kim
From: Changhwan Youn <[email protected]>
This patch changes RTC initialization method on
probe()as per Wan ZongShun's suggestion. The 'rtc_valid_tm(tm)' can check whether RTC BCD is valid or not.And should be changed the method of check because previous method cannot validate RTC BCD registers properly.
Signed-off-by Changhwan Youn <[email protected]>Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>Cc Wan ZongShun <[email protected]>---
?drivers/rtc/rtc-s3c.c | ? 16 +++++++++++----- ?1 files changed, 11 insertions(+), 5 deletions(-)drivers/rtc/rtc-s3c.c +1
-1@@ -458,8 +458,8 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) ?static int __devinit s3c_rtc_probe(struct platform_device *pdev) ?{ ? ? ? ?struct rtc_device *rtc; + ? ? ? struct rtc_time rtc_tm; ? ? ? ?struct resource *res; - ? ? ? unsigned int tmp, i; ? ? ? ?int ret; ? ? ? ?pr_debug("%s: probe=%p\n", __func__, pdev);@@ -540,11 +540,17 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)? ? ? ?/* Check RTC Time */
Quoted 7 lines
- ? ? ? for (i =
S3C2410_RTCSEC; i <=S3C2410_RTCYEAR; i +=0x4) {
- ? ? ? ? ? ? ? tmp =readb(s3c_rtc_base + i);
+ ? ? ?s3c_rtc_gettime(NULL, &rtc_tm);- ? ? ? ? ? ? ? if ((tmp &
0xf) >0x9|| ((tmp >> 4) &0xf) >0x9)
- ? ? ? ? ? ? ? ? ? ? ?writeb(0, s3c_rtc_base + i);
+ ? ? ? if (rtc_valid_tm(&rtc_tm)) {
instead of !rtc_valid_tm(&rtc_tm) ???
Quoted 19 lines
+ ? ? ? ? ? ? ? rtc_tm.tm_year ?= 100;
+ ? ? ? ? ? ? ? rtc_tm.tm_mon ? = 0;
+ ? ? ? ? ? ? ? rtc_tm.tm_mday ?= 1;
+ ? ? ? ? ? ? ? rtc_tm.tm_hour ?= 0;
+ ? ? ? ? ? ? ? rtc_tm.tm_min ? = 0;
+ ? ? ? ? ? ? ? rtc_tm.tm_sec ? = 0;
+
+ ? ? ? ? ? ? ?s3c_rtc_settime(NULL, &rtc_tm);
? ? ? ?}? ? ? ?if (
s3c_rtc_cpu_type==TYPE_S3C64XX)
--
1.6.2.5--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html
PATCH 4/5 rtc: rtc-s3c: Fix on RTC initialization method
In reply to Kukjin KimQuoted 40 lines · Kukjin Kim
From: Changhwan Youn <[email protected]>
This patch changes RTC initialization method on
probe()as per Wan ZongShun's suggestion. The 'rtc_valid_tm(tm)' can check whether RTC BCD is valid or not.And should be changed the method of check because previous method cannot validate RTC BCD registers properly.
Signed-off-by Changhwan Youn <[email protected]>Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>Cc Wan ZongShun <[email protected]>--- drivers/rtc/rtc-s3c.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-)drivers/rtc/rtc-s3c.c +2
-4@@ -458,8 +458,8 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)static int __devinit s3c_rtc_probe (struct platform_device *pdev) {struct rtc_device *rtc; +struct rtc_time rtc_tm;struct resource *res; -unsigned int tmp, i;int ret;pr_debug ("%s: probe=%p\n" , __func__, pdev);@@ -540,11 +540,17 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)/* Check RTC Time */ -for (i =S3C2410_RTCSEC ; i <=S3C2410_RTCYEAR ; i +=0x4 ) { - tmp =readb (s3c_rtc_base + i); +s3c_rtc_gettime (NULL , &rtc_tm); -if ((tmp &0xf ) >0x9 || ((tmp >>4 ) &0xf ) >0x9 )
drivers/rtc/rtc-s3c.c static int __devinit s3c_rtc_probe(struct platform_device *pdev) · line 553
Quoted 10 lines
drivers/rtc/rtc-s3c.c +9
-1-writeb (0 , s3c_rtc_base + i); +if (rtc_valid_tm (&rtc_tm)) { + rtc_tm.tm_year =100 ; + rtc_tm.tm_mon =0 ; + rtc_tm.tm_mday =1 ; + rtc_tm.tm_hour =0 ; + rtc_tm.tm_min =0 ; + rtc_tm.tm_sec =0 ; + +s3c_rtc_settime (NULL , &rtc_tm);
I think a dev_warn() in this path is good to alert the user to bad things happening, esp if the system should have a valid time, it marks he posibility the rtc battery has gone.
PATCH 4/5 rtc: rtc-s3c: Fix on RTC initialization method
2010/9/8 Ben Dooks <[email protected]>:
Quoted 7 lines · Kukjin Kim
Quoted 6 lines
From: Changhwan Youn <[email protected]>
This patch changes RTC initialization method on
probe()as per Wan ZongShun's suggestion. The 'rtc_valid_tm(tm)' can check whether RTC BCD is valid or not.
Hi Kukjin,
I think you misunderstood my meaning.
You only need add the ''rtc_valid_tm' checking in s3c_rtc_gettime() function as following patch.
--- drivers/rtc/rtc-s3c.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/rtc/rtc-s3c.c +0 -0
@@ -185,7 +185,7 @@ static int s3c_rtc_gettime(struct device *dev,
struct rtc_time *rtc_tm)
rtc_tm->tm_year += 100;
rtc_tm->tm_mon -= 1;
- return 0;
+ return rtc_valid_tm(rtc_tm);
}
static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
Signature · 1 line
1.6.3.3
Quoted 50 lines
Quoted 33 lines
And should be changed the method of check because previous method cannot validate RTC BCD registers properly.
Signed-off-by Changhwan Youn <[email protected]>Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>Cc Wan ZongShun <[email protected]>---
?drivers/rtc/rtc-s3c.c | ? 16 +++++++++++----- ?1 files changed, 11 insertions(+), 5 deletions(-)drivers/rtc/rtc-s3c.c +1
-1@@ -458,8 +458,8 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) ?static int __devinit s3c_rtc_probe(struct platform_device *pdev) ?{ ? ? ? struct rtc_device *rtc; + ? ? struct rtc_time rtc_tm; ? ? ? struct resource *res; - ? ? unsigned int tmp, i; ? ? ? int ret; ? ? ? pr_debug("%s: probe=%p\n", __func__, pdev);@@ -540,11 +540,17 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)? ? ? /* Check RTC Time */
- ? ? for (i =
S3C2410_RTCSEC; i <=S3C2410_RTCYEAR; i +=0x4) {
- ? ? ? ? ? ? tmp =readb(s3c_rtc_base + i);
+ ? ?s3c_rtc_gettime(NULL, &rtc_tm);Quoted 11 lines
- ? ? ? ? ? ? if ((tmp &
0xf) >0x9|| ((tmp >> 4) &0xf) >0x9)
- ? ? ? ? ? ? ? ? ? ?writeb(0, s3c_rtc_base + i);
+ ? ? if (rtc_valid_tm(&rtc_tm)) {
+ ? ? ? ? ? ? rtc_tm.tm_year ?= 100;
+ ? ? ? ? ? ? rtc_tm.tm_mon ? = 0;
+ ? ? ? ? ? ? rtc_tm.tm_mday ?= 1;
+ ? ? ? ? ? ? rtc_tm.tm_hour ?= 0;
+ ? ? ? ? ? ? rtc_tm.tm_min ? = 0;
+ ? ? ? ? ? ? rtc_tm.tm_sec ? = 0;
+
+ ? ? ? ? ? ?s3c_rtc_settime(NULL, &rtc_tm);I think a
dev_warn()in this path is good to alert the user to bad things happening, esp if the system should have a valid time, it marks he posibility the rtc battery has gone.
Signature · 10 lines
*linux-arm-kernel mailing list mail addr:linux-arm-kernel at lists.infradead.org you can subscribe by: http://lists.infradead.org/mailman/listinfo/linux-arm-kernel * linux-arm-NUC900 mailing list mail addr:NUC900 at googlegroups.com main web: https://groups.google.com/group/NUC900 you can subscribe it by sending me mail: mcuos.com at gmail.com
PATCH 4/5 rtc: rtc-s3c: Fix on RTC initialization method
Quoted 12 lines · Wan ZongShun
2010/9/8 Ben Dooks <[email protected]>:
Quoted 7 lines · Kukjin Kim
Quoted 6 lines
From: Changhwan Youn <[email protected]>
This patch changes RTC initialization method on
probe()as per Wan ZongShun's suggestion. The 'rtc_valid_tm(tm)' can check whether RTC BCD is valid or not.Hi Kukjin,
Hi ;-)
Quoted 1 line
I think you misunderstood my meaning.
Oh, ok...
Quoted 2 lines
You only need add the ''
rtc_valid_tm' checking ins3c_rtc_gettime()function as following patch.
Ok..will check it also.
Thanks.
Anyway, need to check validation of RTC BCD in probe().
Previous RTC check patch is for avoiding RTC stopping. But it has some hole... i.e., 82hour, RTC works well without stopping even though BCD registers have invalid value.
So this patch can fix both RTC stopping and invalid RTC BCD.
Quoted 77 lines
--- drivers/rtc/rtc-s3c.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/rtc/rtc-s3c.c +1
-1@@ -185,7 +185,7 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) rtc_tm->tm_year += 100; rtc_tm->tm_mon -=1 ; -return 0 ; +return rtc_valid_tm (rtc_tm); }static int
s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
--
1.6.3.3Quoted 11 lines
Quoted 11 lines
And should be changed the method of check because previous method cannot validate RTC BCD registers properly.
Signed-off-by Changhwan Youn <[email protected]>Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>Cc Wan ZongShun <[email protected]>--- drivers/rtc/rtc-s3c.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-)Quoted 5 lines
drivers/rtc/rtc-s3c.c static int __devexit s3c_rtc_remove(struct
Quoted 5 lines
drivers/rtc/rtc-s3c.c +0
-0@@ -458,8 +458,8 @@ static int __devexit s3c_rtc_remove(struct
platform_device*dev)Quoted 10 lines
drivers/rtc/rtc-s3c.c static int __devinit s3c_rtc_probe(struct
Quoted 10 lines
drivers/rtc/rtc-s3c.c +1
-1static int __devinit s3c_rtc_probe (struct platform_device *pdev) {struct rtc_device *rtc; +struct rtc_time rtc_tm;struct resource *res; -unsigned int tmp, i;int ret;pr_debug ("%s: probe=%p\n" , __func__, pdev);@@ -540,11 +540,17 @@ static int __devinit s3c_rtc_probe(struct
platform_device*pdev)Quoted 19 lines
Quoted 8 lines
drivers/rtc/rtc-s3c.c +1
-3/* Check RTC Time */ -for (i =S3C2410_RTCSEC ; i <=S3C2410_RTCYEAR ; i +=0x4 ) { - tmp =readb (s3c_rtc_base + i); +s3c_rtc_gettime (NULL , &rtc_tm); -if ((tmp &0xf ) >0x9 || ((tmp >>4 ) &0xf ) >0x9 )drivers/rtc/rtc-s3c.c static int __devinit s3c_rtc_probe(struct · line 552
Quoted 10 lines
drivers/rtc/rtc-s3c.c +9
-1-writeb (0 , s3c_rtc_base + i); +if (rtc_valid_tm (&rtc_tm)) { + rtc_tm.tm_year =100 ; + rtc_tm.tm_mon =0 ; + rtc_tm.tm_mday =1 ; + rtc_tm.tm_hour =0 ; + rtc_tm.tm_min =0 ; + rtc_tm.tm_sec =0 ; + +s3c_rtc_settime (NULL , &rtc_tm);Quoted 5 lines
I think a
dev_warn()in this path is good to alert the user to bad things happening, esp if the system should have a valid time, it marks he posibility the rtc battery has gone.
Quoted 1 line
--
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
PATCH 4/5 rtc: rtc-s3c: Fix on RTC initialization method
In reply to Ben DooksQuoted 43 lines · Ben Dooks
drivers/rtc/rtc-s3c.c static int __devexit s3c_rtc_remove(struct
Quoted 22 lines · Kukjin Kim
From: Changhwan Youn <[email protected]>
This patch changes RTC initialization method on
probe()as per Wan ZongShun's suggestion. The 'rtc_valid_tm(tm)' can check whether RTC BCD is valid or not.And should be changed the method of check because previous method cannot validate RTC BCD registers properly.
Signed-off-by Changhwan Youn <[email protected]>Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>Cc Wan ZongShun <[email protected]>--- drivers/rtc/rtc-s3c.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-)drivers/rtc/rtc-s3c.c +0
-0@@ -458,8 +458,8 @@ static int __devexit s3c_rtc_remove(struct
platform_device*dev)drivers/rtc/rtc-s3c.c static int __devinit s3c_rtc_probe(struct
Quoted 10 lines
drivers/rtc/rtc-s3c.c +1
-1static int __devinit s3c_rtc_probe (struct platform_device *pdev) {struct rtc_device *rtc; +struct rtc_time rtc_tm;struct resource *res; -unsigned int tmp, i;int ret;pr_debug ("%s: probe=%p\n" , __func__, pdev);@@ -540,11 +540,17 @@ static int __devinit s3c_rtc_probe(struct
platform_device*pdev)Quoted 7 lines
drivers/rtc/rtc-s3c.c +1
-2/* Check RTC Time */ -for (i =S3C2410_RTCSEC ; i <=S3C2410_RTCYEAR ; i +=0x4 ) { - tmp =readb (s3c_rtc_base + i); +s3c_rtc_gettime (NULL , &rtc_tm);
Quoted 15 lines
drivers/rtc/rtc-s3c.c static int __devinit s3c_rtc_probe(struct platform_device *pdev) · line 553
Quoted 11 lines
drivers/rtc/rtc-s3c.c +9
-2-if ((tmp &0xf ) >0x9 || ((tmp >>4 ) &0xf ) >0x9 ) -writeb (0 , s3c_rtc_base + i); +if (rtc_valid_tm (&rtc_tm)) { + rtc_tm.tm_year =100 ; + rtc_tm.tm_mon =0 ; + rtc_tm.tm_mday =1 ; + rtc_tm.tm_hour =0 ; + rtc_tm.tm_min =0 ; + rtc_tm.tm_sec =0 ; + +s3c_rtc_settime (NULL , &rtc_tm);I think a
dev_warn()in this path is good to alert the user to bad things happening, esp if the system should have a valid time, it marks he posibility the rtc battery has gone.
Ok...will address comment from you.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
PATCH 5/5 rtc: rtc-s3c: Fix debug message format on RTC
In reply to Kukjin KimThis patch fixes debug message format on rtc-s3c.
--- drivers/rtc/rtc-s3c.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/rtc/rtc-s3c.c +9 -9
@@ -171,8 +171,8 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) goto retry_get_time; } -pr_debug ("read time %02x.%02x.%02x %02x/%02x/%02x\n" , - rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday, +pr_debug ("read time %04d.%02d.%02d %02d:%02d:%02d\n" , +1900 + rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday, rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec); rtc_tm->tm_sec =bcd2bin (rtc_tm->tm_sec);
@@ -193,8 +193,8 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)void __iomem *base = s3c_rtc_base;int year = tm->tm_year -100 ; -pr_debug ("set time %02d.%02d.%02d %02d/%02d/%02d\n" , - tm->tm_year, tm->tm_mon, tm->tm_mday, +pr_debug ("set time %04d.%02d.%02d %02d:%02d:%02d\n" , +1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);/* we get around y2k by simply not supporting it */
@@ -231,9 +231,9 @@ static int s3c_rtc_getalarm(struct device *dev, struct rtc_wkalrm *alrm) alrm->enabled = (alm_en &S3C2410_RTCALM_ALMEN ) ?1 :0 ; -pr_debug ("read alarm %02x %02x.%02x.%02x %02x/%02x/%02x\n" , +pr_debug ("read alarm %d, %04d.%02d.%02d %02d:%02d:%02d\n" , alm_en, - alm_tm->tm_year, alm_tm->tm_mon, alm_tm->tm_mday, +1900 + alm_tm->tm_year, alm_tm->tm_mon, alm_tm->tm_mday, alm_tm->tm_hour, alm_tm->tm_min, alm_tm->tm_sec);
@@ -280,10 +280,10 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)void __iomem *base = s3c_rtc_base;unsigned int alrm_en; -pr_debug ("s3c_rtc_setalarm: %d, %02x/%02x/%02x %02x.%02x.%02x\n" , +pr_debug ("s3c_rtc_setalarm: %d, %04d.%02d.%02d %02d:%02d:%02d\n" , alrm->enabled, - tm->tm_mday &0xff , tm->tm_mon &0xff , tm->tm_year &0xff , - tm->tm_hour &0xff , tm->tm_min &0xff , tm->tm_sec); +1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); alrm_en =readb (base +S3C2410_RTCALM ) &S3C2410_RTCALM_ALMEN ;
Signature · 1 line
1.6.2.5
PATCH 5/5 rtc: rtc-s3c: Fix debug message format on RTC
Quoted 8 lines · Kukjin Kim
This patch fixes debug message format on rtc-s3c.
Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>--- drivers/rtc/rtc-s3c.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
how long has this lot been broken for?
PATCH 5/5 rtc: rtc-s3c: Fix debug message format on RTC
Quoted 4 lines · Ben Dooks
Quoted 2 lines · Kukjin Kim
This patch fixes debug message format on rtc-s3c.
Quoted 9 lines
Quoted 6 lines
Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>--- drivers/rtc/rtc-s3c.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)how long has this lot been broken for?
Haha...we don't know :-)
Quoted 1 line
Acked-by Ben Dooks <[email protected]>
Thanks for your ack...so...
Hi Alessandro Zummo,
Is it possible to send this to upstream through your tree? Or which tree is better to care this.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
[rtc-linux] RE: [PATCH 5/5] rtc: rtc-s3c: Fix debug message format on RTC
2010/9/9 Kukjin Kim <[email protected]>:
Quoted 16 lines
Quoted 4 lines · Ben Dooks
Quoted 2 lines · Kukjin Kim
This patch fixes debug message format on rtc-s3c.
Quoted 9 lines
Quoted 6 lines
Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>---
?drivers/rtc/rtc-s3c.c | ? 18 +++++++++---------
?1 files changed, 9 insertions(+), 9 deletions(-)how long has this lot been broken for?
Haha...we don't know :-)
Quoted 7 lines
Quoted 1 line
Acked-by Ben Dooks <[email protected]>Thanks for your ack...so...
Hi Alessandro Zummo,
Is it possible to send this to upstream through your tree? Or which tree is better to care this.
Please get help from Andrew.
Quoted 14 lines
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.--
You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
Signature · 10 lines
*linux-arm-kernel mailing list mail addr:linux-arm-kernel at lists.infradead.org you can subscribe by: http://lists.infradead.org/mailman/listinfo/linux-arm-kernel * linux-arm-NUC900 mailing list mail addr:NUC900 at googlegroups.com main web: https://groups.google.com/group/NUC900 you can subscribe it by sending me mail: mcuos.com at gmail.com
[rtc-linux] RE: [PATCH 5/5] rtc: rtc-s3c: Fix debug message format on RTC
Quoted 20 lines · Wan ZongShun
2010/9/9 Kukjin Kim <[email protected]>:
Quoted 18 lines
Quoted 4 lines · Ben Dooks
Quoted 2 lines · Kukjin Kim
This patch fixes debug message format on rtc-s3c.
Quoted 9 lines
Quoted 6 lines
Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>--- drivers/rtc/rtc-s3c.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)how long has this lot been broken for?
Haha...we don't know :-)
Quoted 1 line
Acked-by Ben Dooks <[email protected]>
Quoted 9 lines
Quoted 5 lines
Thanks for your ack...so...
Hi Alessandro Zummo,
Is it possible to send this to upstream through your tree? Or which tree is better to care this.Please get help from Andrew.
Ok ;-)
Hello Andrew,
Could you please handle following items which have been got Ben's ack?
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/025387.html
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/025388.html
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/025391.html
And it's available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git next-rtc-s3c
If any problems, please let me know.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
[rtc-linux] RE: [PATCH 5/5] rtc: rtc-s3c: Fix debug message format on RTC
Quoted 36 lines · On Fri, 10 Sep 2010 20:38:39 +0900 Kukjin Kim <[email protected]> wrote:
Quoted 20 lines · Wan ZongShun
2010/9/9 Kukjin Kim <[email protected]>:
Quoted 18 lines
Quoted 4 lines · Ben Dooks
Quoted 2 lines · Kukjin Kim
This patch fixes debug message format on rtc-s3c.
Quoted 9 lines
Quoted 6 lines
Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>--- drivers/rtc/rtc-s3c.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)how long has this lot been broken for?
Haha...we don't know :-)
Quoted 1 line
Acked-by Ben Dooks <[email protected]>Quoted 9 lines
Quoted 5 lines
Thanks for your ack...so...
Hi Alessandro Zummo,
Is it possible to send this to upstream through your tree? Or which tree is better to care this.Please get help from Andrew.
Ok ;-)
Hello Andrew,
Could you please handle following items which have been got Ben's ack?
Quoted 9 lines
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/025387.html
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/025388.html
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/025391.htmlAnd it's available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.gitnext-rtc-s3cIf any problems, please let me know.
I'd prefer to handle the whole series rather than cherrypick a subset of it.
Patch 1/5 has a question from Ben which hasn't been responded to yet.
Patch 4/5 is due to be updated.
So please let's fix those things up, resend the entire series and cc me on the emails?
[rtc-linux] RE: [PATCH 5/5] rtc: rtc-s3c: Fix debug message format on RTC
Quoted 34 lines · Andrew Morton
Quoted 30 lines · On Fri, 10 Sep 2010 20:38:39 +0900 Kukjin Kim <[email protected]> wrote:
Quoted 29 lines · Wan ZongShun
2010/9/9 Kukjin Kim <[email protected]>:
Quoted 16 lines
Quoted 4 lines · Ben Dooks
Quoted 2 lines · Kukjin Kim
This patch fixes debug message format on rtc-s3c.
Quoted 9 lines
Quoted 6 lines
Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>--- drivers/rtc/rtc-s3c.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)how long has this lot been broken for?
Haha...we don't know :-)
Quoted 7 lines
Quoted 1 line
Acked-by Ben Dooks <[email protected]>Thanks for your ack...so...
Hi Alessandro Zummo,
Is it possible to send this to upstream through your tree? Or which tree is better to care this.Please get help from Andrew.
Quoted 7 lines
Quoted 7 lines
Ok ;-)
Hello Andrew,
Could you please handle following items which have been got Ben's ack?
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/025387.
html
Quoted 1 line
Quoted 1 line
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/025388.
html
Quoted 1 line
Quoted 1 line
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/025391.
html
Quoted 3 lines
Quoted 3 lines
And it's available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
next-rtc-
Quoted 8 lines
s3c
Quoted 3 lines
If any problems, please let me know.
I'd prefer to handle the whole series rather than cherrypick a subset of it.
Quoted 6 lines
Patch 1/5 has a question from Ben which hasn't been responded to yet.
Patch 4/5 is due to be updated.
So please let's fix those things up, resend the entire series and cc me on the emails?
Sure, will do it.
Have a nice weekend ;-)
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
[rtc-linux] RE: [PATCH 5/5] rtc: rtc-s3c: Fix debug message format on RTC
In reply to Andrew MortonQuoted 34 lines · Andrew Morton
Quoted 30 lines · On Fri, 10 Sep 2010 20:38:39 +0900 Kukjin Kim <[email protected]> wrote:
Quoted 29 lines · Wan ZongShun
2010/9/9 Kukjin Kim <[email protected]>:
Quoted 16 lines
Quoted 4 lines · Ben Dooks
Quoted 2 lines · Kukjin Kim
This patch fixes debug message format on rtc-s3c.
Quoted 9 lines
Quoted 6 lines
Signed-off-by Kukjin Kim <[email protected]>Cc Ben Dooks <[email protected]>--- drivers/rtc/rtc-s3c.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)how long has this lot been broken for?
Haha...we don't know :-)
Quoted 7 lines
Quoted 1 line
Acked-by Ben Dooks <[email protected]>Thanks for your ack...so...
Hi Alessandro Zummo,
Is it possible to send this to upstream through your tree? Or which tree is better to care this.Please get help from Andrew.
Quoted 7 lines
Quoted 7 lines
Ok ;-)
Hello Andrew,
Could you please handle following items which have been got Ben's ack?
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/025387.
html
Quoted 1 line
Quoted 1 line
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/025388.
html
Quoted 1 line
Quoted 1 line
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/025391.
html
Quoted 3 lines
Quoted 3 lines
And it's available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
next-rtc-
Quoted 8 lines
s3c
Quoted 3 lines
If any problems, please let me know.
I'd prefer to handle the whole series rather than cherrypick a subset of it.
Quoted 6 lines
Patch 1/5 has a question from Ben which hasn't been responded to yet.
Patch 4/5 is due to be updated.
So please let's fix those things up, resend the entire series and cc me on the emails?
Hi Andrew,
Sorry for late response.
Updated patch 1/5 has been tested on S3C24XX and its working fine. Its remained issue is that Ben was wondering its working on S3C24XX.
And about the patch 4/5, I did address comments from Ben Dooks and Wan ZongShun.
So could you please handle this series?
If any problems, please kindly let me know.
They are since commit cb655d0f3d57c23db51b981648e452988c0223f9:
Linux 2.6.36-rc7 (2010-10-06 13:39:52 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
next-rtc-s3c
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
[rtc-linux] RE: [PATCH 5/5] rtc: rtc-s3c: Fix debug message format on RTC
Quoted 5 lines · On Fri, 08 Oct 2010 08:16:44 +0900 Kukjin Kim <[email protected]> wrote:
Updated patch 1/5 has been tested on S3C24XX and its working fine. Its remained issue is that Ben was wondering its working on S3C24XX.
And about the patch 4/5, I did address comments from Ben Dooks and Wan ZongShun.
ok...
Quoted 9 lines
So could you please handle this series?
If any problems, please kindly let me know.They are since commit
cb655d0f3d57c23db51b981648e452988c0223f9:
Linux 2.6.36-rc7 (2010-10-06 13:39:52 -0700)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
next-rtc-s3c
Can you please email them all out in the old-fashioned way? Because a) I don't manage patches with git and b) that way people will actually look at the code.
Thanks.
[rtc-linux] RE: [PATCH 5/5] rtc: rtc-s3c: Fix debug message format on RTC
Quoted 18 lines · Andrew Morton
Quoted 5 lines · On Fri, 08 Oct 2010 08:16:44 +0900 Kukjin Kim <[email protected]> wrote:
Updated patch 1/5 has been tested on S3C24XX and its working fine. Its remained issue is that Ben was wondering its working on S3C24XX.
And about the patch 4/5, I did address comments from Ben Dooks and Wan ZongShun.
ok...
Quoted 6 lines
So could you please handle this series?
If any problems, please kindly let me know.They are since commit
cb655d0f3d57c23db51b981648e452988c0223f9:
Linux 2.6.36-rc7 (2010-10-06 13:39:52 -0700)
Quoted 8 lines
Quoted 3 lines
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
next-rtc-s3cCan you please email them all out in the old-fashioned way? Because a) I don't manage patches with git and b) that way people will actually look at the code.
Sure...it's no problem.
You mean...old-fashioned way is re-sending patches to mailinglist including Cc'ed you?
Quoted 1 line
Thanks.
Thanks :-)
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.