All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Updates RTC driver for Samsung S3C64XX and newer SoCs
@ 2010-07-21  8:57 ` Kukjin Kim
  0 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel, linux-samsung-soc, rtc-linux
  Cc: ben-linux, p_gortmaker, a.zummo

This patch updates RTC driver for Samsung S3C64XX and newer SoCs.

NOTE: depends on previous RTC patch for clock enabling.

[PATCH 1/3] ARM: SAMSUNG: Updates RTC register for support Alarm IRQ and Time Tick.
[PATCH 2/3] rtc: rtc-s3c: Updates driver for S3C64XX and newer SoCs
[PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 0/3] Updates RTC driver for Samsung S3C64XX and newer SoCs
@ 2010-07-21  8:57 ` Kukjin Kim
  0 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates RTC driver for Samsung S3C64XX and newer SoCs.

NOTE: depends on previous RTC patch for clock enabling.

[PATCH 1/3] ARM: SAMSUNG: Updates RTC register for support Alarm IRQ and Time Tick.
[PATCH 2/3] rtc: rtc-s3c: Updates driver for S3C64XX and newer SoCs
[PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 1/3] ARM: SAMSUNG: Updates RTC register for support Alarm IRQ and Time Tick.
  2010-07-21  8:57 ` Kukjin Kim
@ 2010-07-21  8:57   ` Kukjin Kim
  -1 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel, linux-samsung-soc, rtc-linux
  Cc: ben-linux, p_gortmaker, a.zummo, Atul Dahiya, Taekgyun Ko, Kukjin Kim

From: Atul Dahiya <atul.dahiya@samsung.com>

This patch updates RTC registers for support Alarm IRQ and Time Tick.

Signed-off-by: Atul Dahiya <atul.dahiya@samsung.com>
Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index 65c190d..30b7cc1 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -14,6 +14,9 @@
 #define __ASM_ARCH_REGS_RTC_H __FILE__
 
 #define S3C2410_RTCREG(x) (x)
+#define S3C2410_INTP		S3C2410_RTCREG(0x30)
+#define S3C2410_INTP_ALM	(1 << 1)
+#define S3C2410_INTP_TIC	(1 << 0)
 
 #define S3C2410_RTCCON	      S3C2410_RTCREG(0x40)
 #define S3C2410_RTCCON_RTCEN  (1<<0)
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 1/3] ARM: SAMSUNG: Updates RTC register for support Alarm IRQ and Time Tick.
@ 2010-07-21  8:57   ` Kukjin Kim
  0 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel

From: Atul Dahiya <atul.dahiya@samsung.com>

This patch updates RTC registers for support Alarm IRQ and Time Tick.

Signed-off-by: Atul Dahiya <atul.dahiya@samsung.com>
Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index 65c190d..30b7cc1 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -14,6 +14,9 @@
 #define __ASM_ARCH_REGS_RTC_H __FILE__
 
 #define S3C2410_RTCREG(x) (x)
+#define S3C2410_INTP		S3C2410_RTCREG(0x30)
+#define S3C2410_INTP_ALM	(1 << 1)
+#define S3C2410_INTP_TIC	(1 << 0)
 
 #define S3C2410_RTCCON	      S3C2410_RTCREG(0x40)
 #define S3C2410_RTCCON_RTCEN  (1<<0)
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 2/3] rtc: rtc-s3c: Updates driver for S3C64XX and newer SoCs
  2010-07-21  8:57 ` Kukjin Kim
@ 2010-07-21  8:57   ` Kukjin Kim
  -1 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel, linux-samsung-soc, rtc-linux
  Cc: ben-linux, p_gortmaker, a.zummo, Atul Dahiya, Taekgyun Ko, Kukjin Kim

From: Atul Dahiya <atul.dahiya@samsung.com>

This Patch does followings.
1) Enables support for alarm and time tick pending register
   for periodic interrupt generation.
2) Changes writeb to writew beacuse the macro S3C64XX_RTCCON_TICEN
   (Tick Timer Enable) is 9th bit of register.
3) Changes writeb to writel as max_user_freq used in s3c64xx is 32768 and
   requires 15 bits to update the Tick Count Register.

Signed-off-by: Atul Dahiya <atul.dahiya@samsung.com>
Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 drivers/rtc/rtc-s3c.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index c032a15..2040017 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -57,6 +57,10 @@ static irqreturn_t s3c_rtc_alarmirq(int irq, void *id)
 	struct rtc_device *rdev = id;
 
 	rtc_update_irq(rdev, 1, RTC_AF | RTC_IRQF);
+
+	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+		writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP);
+
 	return IRQ_HANDLED;
 }
 
@@ -65,6 +69,10 @@ static irqreturn_t s3c_rtc_tickirq(int irq, void *id)
 	struct rtc_device *rdev = id;
 
 	rtc_update_irq(rdev, 1, RTC_PF | RTC_IRQF);
+
+	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+		writeb(S3C2410_INTP_TIC, s3c_rtc_base + S3C2410_INTP);
+
 	return IRQ_HANDLED;
 }
 
@@ -98,7 +106,7 @@ static int s3c_rtc_setpie(struct device *dev, int enabled)
 		if (enabled)
 			tmp |= S3C64XX_RTCCON_TICEN;
 
-		writeb(tmp, s3c_rtc_base + S3C2410_RTCCON);
+		writew(tmp, s3c_rtc_base + S3C2410_RTCCON);
 	} else {
 		tmp = readb(s3c_rtc_base + S3C2410_TICNT);
 		tmp &= ~S3C2410_TICNT_ENABLE;
@@ -132,7 +140,7 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
 
 	tmp |= (rtc_dev->max_user_freq / freq)-1;
 
-	writeb(tmp, s3c_rtc_base + S3C2410_TICNT);
+	writel(tmp, s3c_rtc_base + S3C2410_TICNT);
 	spin_unlock_irq(&s3c_rtc_pie_lock);
 
 	return 0;
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 2/3] rtc: rtc-s3c: Updates driver for S3C64XX and newer SoCs
@ 2010-07-21  8:57   ` Kukjin Kim
  0 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel

From: Atul Dahiya <atul.dahiya@samsung.com>

This Patch does followings.
1) Enables support for alarm and time tick pending register
   for periodic interrupt generation.
2) Changes writeb to writew beacuse the macro S3C64XX_RTCCON_TICEN
   (Tick Timer Enable) is 9th bit of register.
3) Changes writeb to writel as max_user_freq used in s3c64xx is 32768 and
   requires 15 bits to update the Tick Count Register.

Signed-off-by: Atul Dahiya <atul.dahiya@samsung.com>
Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 drivers/rtc/rtc-s3c.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index c032a15..2040017 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -57,6 +57,10 @@ static irqreturn_t s3c_rtc_alarmirq(int irq, void *id)
 	struct rtc_device *rdev = id;
 
 	rtc_update_irq(rdev, 1, RTC_AF | RTC_IRQF);
+
+	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+		writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP);
+
 	return IRQ_HANDLED;
 }
 
@@ -65,6 +69,10 @@ static irqreturn_t s3c_rtc_tickirq(int irq, void *id)
 	struct rtc_device *rdev = id;
 
 	rtc_update_irq(rdev, 1, RTC_PF | RTC_IRQF);
+
+	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+		writeb(S3C2410_INTP_TIC, s3c_rtc_base + S3C2410_INTP);
+
 	return IRQ_HANDLED;
 }
 
@@ -98,7 +106,7 @@ static int s3c_rtc_setpie(struct device *dev, int enabled)
 		if (enabled)
 			tmp |= S3C64XX_RTCCON_TICEN;
 
-		writeb(tmp, s3c_rtc_base + S3C2410_RTCCON);
+		writew(tmp, s3c_rtc_base + S3C2410_RTCCON);
 	} else {
 		tmp = readb(s3c_rtc_base + S3C2410_TICNT);
 		tmp &= ~S3C2410_TICNT_ENABLE;
@@ -132,7 +140,7 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
 
 	tmp |= (rtc_dev->max_user_freq / freq)-1;
 
-	writeb(tmp, s3c_rtc_base + S3C2410_TICNT);
+	writel(tmp, s3c_rtc_base + S3C2410_TICNT);
 	spin_unlock_irq(&s3c_rtc_pie_lock);
 
 	return 0;
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
  2010-07-21  8:57 ` Kukjin Kim
@ 2010-07-21  8:57   ` Kukjin Kim
  -1 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel, linux-samsung-soc, rtc-linux
  Cc: ben-linux, p_gortmaker, a.zummo, Taekgyun Ko, Kukjin Kim

From: Taekgyun Ko <taeggyun.ko@samsung.com>

RTC needs to be initialized when BCD registers have invalid value.

Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 2040017..e96e109 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 
 	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
 
-	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+	if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
 		rtc->max_user_freq = 32768;
-	else
+
+		/* Check RTC Time */
+
+		for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
+			tmp = readb(s3c_rtc_base + i);
+
+			if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) > 0x9))
+				writeb(0, s3c_rtc_base + i);
+		}
+	} else {
 		rtc->max_user_freq = 128;
+	}
 
 	platform_set_drvdata(pdev, rtc);
 
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
@ 2010-07-21  8:57   ` Kukjin Kim
  0 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel

From: Taekgyun Ko <taeggyun.ko@samsung.com>

RTC needs to be initialized when BCD registers have invalid value.

Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 2040017..e96e109 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 
 	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
 
-	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+	if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
 		rtc->max_user_freq = 32768;
-	else
+
+		/* Check RTC Time */
+
+		for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
+			tmp = readb(s3c_rtc_base + i);
+
+			if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) > 0x9))
+				writeb(0, s3c_rtc_base + i);
+		}
+	} else {
 		rtc->max_user_freq = 128;
+	}
 
 	platform_set_drvdata(pdev, rtc);
 
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
  2010-07-21  8:57   ` Kukjin Kim
@ 2010-07-21 14:42     ` Sergei Shtylyov
  -1 siblings, 0 replies; 24+ messages in thread
From: Sergei Shtylyov @ 2010-07-21 14:42 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: linux-arm-kernel, linux-samsung-soc, rtc-linux, p_gortmaker,
	Taekgyun Ko, ben-linux, a.zummo

Hello.

Kukjin Kim wrote:

> From: Taekgyun Ko <taeggyun.ko@samsung.com>

> RTC needs to be initialized when BCD registers have invalid value.

> Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
[...]
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 2040017..e96e109 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>  
>  	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
>  
> -	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
> +	if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
>  		rtc->max_user_freq = 32768;
> -	else
> +
> +		/* Check RTC Time */
> +
> +		for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
> +			tmp = readb(s3c_rtc_base + i);
> +
> +			if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) > 0x9))

   There is no need to have parens around > operations.

WBR, Sergei

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
@ 2010-07-21 14:42     ` Sergei Shtylyov
  0 siblings, 0 replies; 24+ messages in thread
From: Sergei Shtylyov @ 2010-07-21 14:42 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

Kukjin Kim wrote:

> From: Taekgyun Ko <taeggyun.ko@samsung.com>

> RTC needs to be initialized when BCD registers have invalid value.

> Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
[...]
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 2040017..e96e109 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>  
>  	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
>  
> -	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
> +	if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
>  		rtc->max_user_freq = 32768;
> -	else
> +
> +		/* Check RTC Time */
> +
> +		for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
> +			tmp = readb(s3c_rtc_base + i);
> +
> +			if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) > 0x9))

   There is no need to have parens around > operations.

WBR, Sergei

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [rtc-linux] [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
  2010-07-21  8:57   ` Kukjin Kim
@ 2010-07-22  1:50     ` Wan ZongShun
  -1 siblings, 0 replies; 24+ messages in thread
From: Wan ZongShun @ 2010-07-22  1:50 UTC (permalink / raw)
  To: rtc-linux, Andrew Morton
  Cc: linux-arm-kernel, linux-samsung-soc, ben-linux, p_gortmaker,
	a.zummo, Taekgyun Ko, Kukjin Kim

2010/7/21 Kukjin Kim <kgene.kim@samsung.com>:
> From: Taekgyun Ko <taeggyun.ko@samsung.com>
>
> RTC needs to be initialized when BCD registers have invalid value.

Do you mean that the hardware register does not have default value?
Any results if no initialized value here?

>
> Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
>  drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
>  1 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 2040017..e96e109 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>
>        s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
>
> -       if (s3c_rtc_cpu_type == TYPE_S3C64XX)
> +       if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
>                rtc->max_user_freq = 32768;
> -       else
> +
> +               /* Check RTC Time */
> +
> +               for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
> +                       tmp = readb(s3c_rtc_base + i);
> +
> +                       if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) > 0x9))
> +                               writeb(0, s3c_rtc_base + i);
> +               }
> +       } else {
>                rtc->max_user_freq = 128;
> +       }
>
>        platform_set_drvdata(pdev, rtc);
>
> --
> 1.6.2.5
>
> --
> 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.



-- 
*linux-arm-kernel mailing list
mail addr:linux-arm-kernel@lists.infradead.org
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:NUC900@googlegroups.com
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuos.com@gmail.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [rtc-linux] [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
@ 2010-07-22  1:50     ` Wan ZongShun
  0 siblings, 0 replies; 24+ messages in thread
From: Wan ZongShun @ 2010-07-22  1:50 UTC (permalink / raw)
  To: linux-arm-kernel

2010/7/21 Kukjin Kim <kgene.kim@samsung.com>:
> From: Taekgyun Ko <taeggyun.ko@samsung.com>
>
> RTC needs to be initialized when BCD registers have invalid value.

Do you mean that the hardware register does not have default value?
Any results if no initialized value here?

>
> Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
> ?drivers/rtc/rtc-s3c.c | ? 14 ++++++++++++--
> ?1 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 2040017..e96e109 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>
> ? ? ? ?s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
>
> - ? ? ? if (s3c_rtc_cpu_type == TYPE_S3C64XX)
> + ? ? ? if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
> ? ? ? ? ? ? ? ?rtc->max_user_freq = 32768;
> - ? ? ? else
> +
> + ? ? ? ? ? ? ? /* Check RTC Time */
> +
> + ? ? ? ? ? ? ? for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
> + ? ? ? ? ? ? ? ? ? ? ? tmp = readb(s3c_rtc_base + i);
> +
> + ? ? ? ? ? ? ? ? ? ? ? if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) > 0x9))
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? writeb(0, s3c_rtc_base + i);
> + ? ? ? ? ? ? ? }
> + ? ? ? } else {
> ? ? ? ? ? ? ? ?rtc->max_user_freq = 128;
> + ? ? ? }
>
> ? ? ? ?platform_set_drvdata(pdev, rtc);
>
> --
> 1.6.2.5
>
> --
> 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.



-- 
*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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* RE: [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
  2010-07-21 14:42     ` Sergei Shtylyov
@ 2010-07-23  7:04       ` Kukjin Kim
  -1 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-23  7:04 UTC (permalink / raw)
  To: 'Sergei Shtylyov'
  Cc: linux-arm-kernel, linux-samsung-soc, rtc-linux, p_gortmaker,
	'Taekgyun Ko',
	ben-linux, a.zummo

Sergei Shtylyov wrote:
> 
> Hello.
> 
Hi :-)

> Kukjin Kim wrote:
> 
> > From: Taekgyun Ko <taeggyun.ko@samsung.com>
> 
> > RTC needs to be initialized when BCD registers have invalid value.
> 
> > Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> [...]
> > diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> > index 2040017..e96e109 100644
> > --- a/drivers/rtc/rtc-s3c.c
> > +++ b/drivers/rtc/rtc-s3c.c
> > @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct
> platform_device *pdev)
> >
> >  	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
> >
> > -	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
> > +	if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
> >  		rtc->max_user_freq = 32768;
> > -	else
> > +
> > +		/* Check RTC Time */
> > +
> > +		for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
> > +			tmp = readb(s3c_rtc_base + i);
> > +
> > +			if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) >
0x9))
> 
>    There is no need to have parens around > operations.
> 
Ok...you're right. will fix it.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
@ 2010-07-23  7:04       ` Kukjin Kim
  0 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-23  7:04 UTC (permalink / raw)
  To: linux-arm-kernel

Sergei Shtylyov wrote:
> 
> Hello.
> 
Hi :-)

> Kukjin Kim wrote:
> 
> > From: Taekgyun Ko <taeggyun.ko@samsung.com>
> 
> > RTC needs to be initialized when BCD registers have invalid value.
> 
> > Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> [...]
> > diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> > index 2040017..e96e109 100644
> > --- a/drivers/rtc/rtc-s3c.c
> > +++ b/drivers/rtc/rtc-s3c.c
> > @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct
> platform_device *pdev)
> >
> >  	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
> >
> > -	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
> > +	if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
> >  		rtc->max_user_freq = 32768;
> > -	else
> > +
> > +		/* Check RTC Time */
> > +
> > +		for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
> > +			tmp = readb(s3c_rtc_base + i);
> > +
> > +			if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) >
0x9))
> 
>    There is no need to have parens around > operations.
> 
Ok...you're right. will fix it.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* RE: [rtc-linux] [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
  2010-07-22  1:50     ` Wan ZongShun
@ 2010-07-23  7:34       ` Kukjin Kim
  -1 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-23  7:34 UTC (permalink / raw)
  To: 'Wan ZongShun', rtc-linux, 'Andrew Morton'
  Cc: linux-arm-kernel, linux-samsung-soc, ben-linux, p_gortmaker,
	a.zummo, 'Taekgyun Ko'

Wan ZongShun wrote:
> 
> 2010/7/21 Kukjin Kim <kgene.kim@samsung.com>:
> > From: Taekgyun Ko <taeggyun.ko@samsung.com>
> >
> > RTC needs to be initialized when BCD registers have invalid value.
> 
> Do you mean that the hardware register does not have default value?
> Any results if no initialized value here?
> 
Hi,

Yes..I mean that it has no default value.
As you know, it has to be keep the previous time value after reset..and the reset value is not defined.

So added check that functionality, because if it has no valid BCD value, RTC time does not move on.
Of course, if we set time at that time, RTC works well...I mean just need initialize that.

> >
> > Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> > ---
> >  drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
> >  1 files changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> > index 2040017..e96e109 100644
> > --- a/drivers/rtc/rtc-s3c.c
> > +++ b/drivers/rtc/rtc-s3c.c
> > @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct
> platform_device *pdev)
> >
> >        s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
> >
> > -       if (s3c_rtc_cpu_type == TYPE_S3C64XX)
> > +       if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
> >                rtc->max_user_freq = 32768;
> > -       else
> > +
> > +               /* Check RTC Time */
> > +
> > +               for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
> > +                       tmp = readb(s3c_rtc_base + i);
> > +
> > +                       if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) > 0x9))
> > +                               writeb(0, s3c_rtc_base + i);
> > +               }
> > +       } else {
> >                rtc->max_user_freq = 128;
> > +       }
> >
> >        platform_set_drvdata(pdev, rtc);
> >
> > --
> > 1.6.2.5
> >


Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [rtc-linux] [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
@ 2010-07-23  7:34       ` Kukjin Kim
  0 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-23  7:34 UTC (permalink / raw)
  To: linux-arm-kernel

Wan ZongShun wrote:
> 
> 2010/7/21 Kukjin Kim <kgene.kim@samsung.com>:
> > From: Taekgyun Ko <taeggyun.ko@samsung.com>
> >
> > RTC needs to be initialized when BCD registers have invalid value.
> 
> Do you mean that the hardware register does not have default value?
> Any results if no initialized value here?
> 
Hi,

Yes..I mean that it has no default value.
As you know, it has to be keep the previous time value after reset..and the reset value is not defined.

So added check that functionality, because if it has no valid BCD value, RTC time does not move on.
Of course, if we set time at that time, RTC works well...I mean just need initialize that.

> >
> > Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> > ---
> >  drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
> >  1 files changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> > index 2040017..e96e109 100644
> > --- a/drivers/rtc/rtc-s3c.c
> > +++ b/drivers/rtc/rtc-s3c.c
> > @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct
> platform_device *pdev)
> >
> >        s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
> >
> > -       if (s3c_rtc_cpu_type == TYPE_S3C64XX)
> > +       if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
> >                rtc->max_user_freq = 32768;
> > -       else
> > +
> > +               /* Check RTC Time */
> > +
> > +               for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
> > +                       tmp = readb(s3c_rtc_base + i);
> > +
> > +                       if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) > 0x9))
> > +                               writeb(0, s3c_rtc_base + i);
> > +               }
> > +       } else {
> >                rtc->max_user_freq = 128;
> > +       }
> >
> >        platform_set_drvdata(pdev, rtc);
> >
> > --
> > 1.6.2.5
> >


Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [rtc-linux] [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
  2010-07-23  7:34       ` Kukjin Kim
@ 2010-07-23  9:28         ` Wan ZongShun
  -1 siblings, 0 replies; 24+ messages in thread
From: Wan ZongShun @ 2010-07-23  9:28 UTC (permalink / raw)
  To: rtc-linux
  Cc: Andrew Morton, linux-arm-kernel, linux-samsung-soc, ben-linux,
	p_gortmaker, a.zummo, Taekgyun Ko

2010/7/23 Kukjin Kim <kgene.kim@samsung.com>:
> Wan ZongShun wrote:
>>
>> 2010/7/21 Kukjin Kim <kgene.kim@samsung.com>:
>> > From: Taekgyun Ko <taeggyun.ko@samsung.com>
>> >
>> > RTC needs to be initialized when BCD registers have invalid value.
>>
>> Do you mean that the hardware register does not have default value?
>> Any results if no initialized value here?
>>
> Hi,
>
> Yes..I mean that it has no default value.
> As you know, it has to be keep the previous time value after reset..and the reset value is not defined.
>

So, reset is no use to this RTC BCD registers, it still keep previous
time value.

> So added check that functionality, because if it has no valid BCD value, RTC time does not move on.
> Of course, if we set time at that time, RTC works well...I mean just need initialize that.
>

Okay,good patch.:)

In addtion,For making sure to get valid value, it is much better to
use also 'rtc_valid_tm(tm)' to check returning time value in your
s3c_rtc_gettime() and s3c_rtc_getalarm(() functions.


>> >
>> > Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
>> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
>> > ---
>> >  drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
>> >  1 files changed, 12 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
>> > index 2040017..e96e109 100644
>> > --- a/drivers/rtc/rtc-s3c.c
>> > +++ b/drivers/rtc/rtc-s3c.c
>> > @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct
>> platform_device *pdev)
>> >
>> >        s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
>> >
>> > -       if (s3c_rtc_cpu_type == TYPE_S3C64XX)
>> > +       if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
>> >                rtc->max_user_freq = 32768;
>> > -       else
>> > +
>> > +               /* Check RTC Time */
>> > +
>> > +               for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
>> > +                       tmp = readb(s3c_rtc_base + i);
>> > +
>> > +                       if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) > 0x9))
>> > +                               writeb(0, s3c_rtc_base + i);
>> > +               }
>> > +       } else {
>> >                rtc->max_user_freq = 128;
>> > +       }
>> >
>> >        platform_set_drvdata(pdev, rtc);
>> >
>> > --
>> > 1.6.2.5
>> >
>
>
> Thanks.
>
> Best regards,
> Kgene.
> --
> Kukjin Kim <kgene.kim@samsung.com>, 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.



-- 
*linux-arm-kernel mailing list
mail addr:linux-arm-kernel@lists.infradead.org
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:NUC900@googlegroups.com
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuos.com@gmail.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [rtc-linux] [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
@ 2010-07-23  9:28         ` Wan ZongShun
  0 siblings, 0 replies; 24+ messages in thread
From: Wan ZongShun @ 2010-07-23  9:28 UTC (permalink / raw)
  To: linux-arm-kernel

2010/7/23 Kukjin Kim <kgene.kim@samsung.com>:
> Wan ZongShun wrote:
>>
>> 2010/7/21 Kukjin Kim <kgene.kim@samsung.com>:
>> > From: Taekgyun Ko <taeggyun.ko@samsung.com>
>> >
>> > RTC needs to be initialized when BCD registers have invalid value.
>>
>> Do you mean that the hardware register does not have default value?
>> Any results if no initialized value here?
>>
> Hi,
>
> Yes..I mean that it has no default value.
> As you know, it has to be keep the previous time value after reset..and the reset value is not defined.
>

So, reset is no use to this RTC BCD registers, it still keep previous
time value.

> So added check that functionality, because if it has no valid BCD value, RTC time does not move on.
> Of course, if we set time at that time, RTC works well...I mean just need initialize that.
>

Okay,good patch.:)

In addtion,For making sure to get valid value, it is much better to
use also 'rtc_valid_tm(tm)' to check returning time value in your
s3c_rtc_gettime() and s3c_rtc_getalarm(() functions.


>> >
>> > Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
>> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
>> > ---
>> > ?drivers/rtc/rtc-s3c.c | ? 14 ++++++++++++--
>> > ?1 files changed, 12 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
>> > index 2040017..e96e109 100644
>> > --- a/drivers/rtc/rtc-s3c.c
>> > +++ b/drivers/rtc/rtc-s3c.c
>> > @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct
>> platform_device *pdev)
>> >
>> > ? ? ? ?s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
>> >
>> > - ? ? ? if (s3c_rtc_cpu_type == TYPE_S3C64XX)
>> > + ? ? ? if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
>> > ? ? ? ? ? ? ? ?rtc->max_user_freq = 32768;
>> > - ? ? ? else
>> > +
>> > + ? ? ? ? ? ? ? /* Check RTC Time */
>> > +
>> > + ? ? ? ? ? ? ? for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
>> > + ? ? ? ? ? ? ? ? ? ? ? tmp = readb(s3c_rtc_base + i);
>> > +
>> > + ? ? ? ? ? ? ? ? ? ? ? if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) > 0x9))
>> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? writeb(0, s3c_rtc_base + i);
>> > + ? ? ? ? ? ? ? }
>> > + ? ? ? } else {
>> > ? ? ? ? ? ? ? ?rtc->max_user_freq = 128;
>> > + ? ? ? }
>> >
>> > ? ? ? ?platform_set_drvdata(pdev, rtc);
>> >
>> > --
>> > 1.6.2.5
>> >
>
>
> Thanks.
>
> Best regards,
> Kgene.
> --
> Kukjin Kim <kgene.kim@samsung.com>, 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.



-- 
*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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* RE: [rtc-linux] [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
  2010-07-23  9:28         ` Wan ZongShun
@ 2010-07-27 13:11           ` Kukjin Kim
  -1 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-27 13:11 UTC (permalink / raw)
  To: 'Wan ZongShun', rtc-linux
  Cc: p_gortmaker, linux-samsung-soc, a.zummo, 'Taekgyun Ko',
	ben-linux, 'Andrew Morton',
	linux-arm-kernel

Wan ZongShun wrote:

> 
> 2010/7/23 Kukjin Kim <kgene.kim@samsung.com>:
> > Wan ZongShun wrote:
> >>
> >> 2010/7/21 Kukjin Kim <kgene.kim@samsung.com>:
> >> > From: Taekgyun Ko <taeggyun.ko@samsung.com>
> >> >
> >> > RTC needs to be initialized when BCD registers have invalid value.
> >>
> >> Do you mean that the hardware register does not have default value?
> >> Any results if no initialized value here?
> >>
> > Hi,
> >
> > Yes..I mean that it has no default value.
> > As you know, it has to be keep the previous time value after reset..and the reset
> value is not defined.
> >
> 
> So, reset is no use to this RTC BCD registers, it still keep previous
> time value.
> 
> > So added check that functionality, because if it has no valid BCD value, RTC
> time does not move on.
> > Of course, if we set time at that time, RTC works well...I mean just need initialize
> that.
> >
> 
> Okay,good patch.:)
> 
Thanks ;-)

> In addtion,For making sure to get valid value, it is much better to
> use also 'rtc_valid_tm(tm)' to check returning time value in your
> s3c_rtc_gettime() and s3c_rtc_getalarm(() functions.
> 
Ok..will do it later as per your suggestion.

> 
> >> >
> >> > Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> >> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> >> > ---
> >> >  drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
> >> >  1 files changed, 12 insertions(+), 2 deletions(-)
> >> >
(snip)


Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [rtc-linux] [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
@ 2010-07-27 13:11           ` Kukjin Kim
  0 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-27 13:11 UTC (permalink / raw)
  To: linux-arm-kernel

Wan ZongShun wrote:

> 
> 2010/7/23 Kukjin Kim <kgene.kim@samsung.com>:
> > Wan ZongShun wrote:
> >>
> >> 2010/7/21 Kukjin Kim <kgene.kim@samsung.com>:
> >> > From: Taekgyun Ko <taeggyun.ko@samsung.com>
> >> >
> >> > RTC needs to be initialized when BCD registers have invalid value.
> >>
> >> Do you mean that the hardware register does not have default value?
> >> Any results if no initialized value here?
> >>
> > Hi,
> >
> > Yes..I mean that it has no default value.
> > As you know, it has to be keep the previous time value after reset..and the reset
> value is not defined.
> >
> 
> So, reset is no use to this RTC BCD registers, it still keep previous
> time value.
> 
> > So added check that functionality, because if it has no valid BCD value, RTC
> time does not move on.
> > Of course, if we set time at that time, RTC works well...I mean just need initialize
> that.
> >
> 
> Okay,good patch.:)
> 
Thanks ;-)

> In addtion,For making sure to get valid value, it is much better to
> use also 'rtc_valid_tm(tm)' to check returning time value in your
> s3c_rtc_gettime() and s3c_rtc_getalarm(() functions.
> 
Ok..will do it later as per your suggestion.

> 
> >> >
> >> > Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> >> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> >> > ---
> >> >  drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
> >> >  1 files changed, 12 insertions(+), 2 deletions(-)
> >> >
(snip)


Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
  2010-07-21  8:57   ` Kukjin Kim
@ 2010-07-28 18:17     ` Ben Dooks
  -1 siblings, 0 replies; 24+ messages in thread
From: Ben Dooks @ 2010-07-28 18:17 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: linux-arm-kernel, linux-samsung-soc, rtc-linux, p_gortmaker,
	Taekgyun Ko, ben-linux, a.zummo

On 21/07/10 09:57, Kukjin Kim wrote:
> From: Taekgyun Ko <taeggyun.ko@samsung.com>
> 
> RTC needs to be initialized when BCD registers have invalid value.
> 
> Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
>  drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
>  1 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 2040017..e96e109 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>  
>  	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
>  
> -	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
> +	if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
>  		rtc->max_user_freq = 32768;
> -	else
> +
> +		/* Check RTC Time */
> +
> +		for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
> +			tmp = readb(s3c_rtc_base + i);
> +
> +			if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) > 0x9))
> +				writeb(0, s3c_rtc_base + i);

This is something we should probably do for all SoCs.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
@ 2010-07-28 18:17     ` Ben Dooks
  0 siblings, 0 replies; 24+ messages in thread
From: Ben Dooks @ 2010-07-28 18:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 21/07/10 09:57, Kukjin Kim wrote:
> From: Taekgyun Ko <taeggyun.ko@samsung.com>
> 
> RTC needs to be initialized when BCD registers have invalid value.
> 
> Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
>  drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
>  1 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 2040017..e96e109 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>  
>  	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
>  
> -	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
> +	if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
>  		rtc->max_user_freq = 32768;
> -	else
> +
> +		/* Check RTC Time */
> +
> +		for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
> +			tmp = readb(s3c_rtc_base + i);
> +
> +			if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) > 0x9))
> +				writeb(0, s3c_rtc_base + i);

This is something we should probably do for all SoCs.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* RE: [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
  2010-07-28 18:17     ` Ben Dooks
@ 2010-07-29  1:55       ` Kukjin Kim
  -1 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-29  1:55 UTC (permalink / raw)
  To: 'Ben Dooks'
  Cc: p_gortmaker, linux-samsung-soc, rtc-linux, a.zummo,
	'Taekgyun Ko',
	ben-linux, linux-arm-kernel

Ben Dooks wrote:
> 
> On 21/07/10 09:57, Kukjin Kim wrote:
> > From: Taekgyun Ko <taeggyun.ko@samsung.com>
> >
> > RTC needs to be initialized when BCD registers have invalid value.
> >
> > Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> > ---
> >  drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
> >  1 files changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> > index 2040017..e96e109 100644
> > --- a/drivers/rtc/rtc-s3c.c
> > +++ b/drivers/rtc/rtc-s3c.c
> > @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct
> platform_device *pdev)
> >
> >  	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
> >
> > -	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
> > +	if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
> >  		rtc->max_user_freq = 32768;
> > -	else
> > +
> > +		/* Check RTC Time */
> > +
> > +		for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
> > +			tmp = readb(s3c_rtc_base + i);
> > +
> > +			if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) >
0x9))
> > +				writeb(0, s3c_rtc_base + i);
> 
> This is something we should probably do for all SoCs.

Yeah...ok...will move it.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes
@ 2010-07-29  1:55       ` Kukjin Kim
  0 siblings, 0 replies; 24+ messages in thread
From: Kukjin Kim @ 2010-07-29  1:55 UTC (permalink / raw)
  To: linux-arm-kernel

Ben Dooks wrote:
> 
> On 21/07/10 09:57, Kukjin Kim wrote:
> > From: Taekgyun Ko <taeggyun.ko@samsung.com>
> >
> > RTC needs to be initialized when BCD registers have invalid value.
> >
> > Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> > ---
> >  drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
> >  1 files changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> > index 2040017..e96e109 100644
> > --- a/drivers/rtc/rtc-s3c.c
> > +++ b/drivers/rtc/rtc-s3c.c
> > @@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct
> platform_device *pdev)
> >
> >  	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
> >
> > -	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
> > +	if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
> >  		rtc->max_user_freq = 32768;
> > -	else
> > +
> > +		/* Check RTC Time */
> > +
> > +		for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
> > +			tmp = readb(s3c_rtc_base + i);
> > +
> > +			if (((tmp & 0xf) > 0x9) || (((tmp >> 4) & 0xf) >
0x9))
> > +				writeb(0, s3c_rtc_base + i);
> 
> This is something we should probably do for all SoCs.

Yeah...ok...will move it.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2010-07-29  1:55 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-21  8:57 [PATCH 0/3] Updates RTC driver for Samsung S3C64XX and newer SoCs Kukjin Kim
2010-07-21  8:57 ` Kukjin Kim
2010-07-21  8:57 ` [PATCH 1/3] ARM: SAMSUNG: Updates RTC register for support Alarm IRQ and Time Tick Kukjin Kim
2010-07-21  8:57   ` Kukjin Kim
2010-07-21  8:57 ` [PATCH 2/3] rtc: rtc-s3c: Updates driver for S3C64XX and newer SoCs Kukjin Kim
2010-07-21  8:57   ` Kukjin Kim
2010-07-21  8:57 ` [PATCH 3/3] rtc: rtc-s3c: Add BCD register initialization codes Kukjin Kim
2010-07-21  8:57   ` Kukjin Kim
2010-07-21 14:42   ` Sergei Shtylyov
2010-07-21 14:42     ` Sergei Shtylyov
2010-07-23  7:04     ` Kukjin Kim
2010-07-23  7:04       ` Kukjin Kim
2010-07-22  1:50   ` [rtc-linux] " Wan ZongShun
2010-07-22  1:50     ` Wan ZongShun
2010-07-23  7:34     ` Kukjin Kim
2010-07-23  7:34       ` Kukjin Kim
2010-07-23  9:28       ` Wan ZongShun
2010-07-23  9:28         ` Wan ZongShun
2010-07-27 13:11         ` Kukjin Kim
2010-07-27 13:11           ` Kukjin Kim
2010-07-28 18:17   ` Ben Dooks
2010-07-28 18:17     ` Ben Dooks
2010-07-29  1:55     ` Kukjin Kim
2010-07-29  1:55       ` Kukjin Kim

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.