All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] Implement RTC support for S3C2443/S3C2416/S3C2450
@ 2011-12-21  9:14 ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2011-12-21  9:14 UTC (permalink / raw)
  To: Kukjin Kim, ben-linux, a.zummo
  Cc: linux-samsung-soc, linux-arm-kernel, rtc-linux, Heiko Stübner

Similar to the ADC the RTC of S3C2443 and S3C2416/2450 has some slight
variances when compared to the existing types.

This series adds support for those SoCs.

As with the ADC patches, these changes where tested on S3C2416 hardware.
The S3C2443 quirks are a subset of those and are done according to the
datasheet, but not tested on real hardware (as I do not own a S3C2443 device).

changes since v2:
remove obsolete constants in register cleanup

changes since v1:
address comments from Thomas Abraham, reducing number of ifdefs and
duplicate code

Heiko Stuebner (2):
  ARM: SAMSUNG: cleanup of rtc register definitions
  rtc-s3c: make room for more variants in devicetree block
  rtc-s3c: add variants for S3C2443 and S3C2416
  ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices

 arch/arm/mach-s3c2416/s3c2416.c               |    2 +
 arch/arm/mach-s3c2443/s3c2443.c               |    2 +
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   81 +++++++++++++------------
 arch/arm/plat-samsung/include/plat/rtc-core.h |   27 ++++++++
 drivers/rtc/rtc-s3c.c                         |   74 +++++++++++++++++++----
 5 files changed, 134 insertions(+), 52 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/rtc-core.h

-- 
1.7.5.4

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

* [PATCH v3 0/4] Implement RTC support for S3C2443/S3C2416/S3C2450
@ 2011-12-21  9:14 ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2011-12-21  9:14 UTC (permalink / raw)
  To: linux-arm-kernel

Similar to the ADC the RTC of S3C2443 and S3C2416/2450 has some slight
variances when compared to the existing types.

This series adds support for those SoCs.

As with the ADC patches, these changes where tested on S3C2416 hardware.
The S3C2443 quirks are a subset of those and are done according to the
datasheet, but not tested on real hardware (as I do not own a S3C2443 device).

changes since v2:
remove obsolete constants in register cleanup

changes since v1:
address comments from Thomas Abraham, reducing number of ifdefs and
duplicate code

Heiko Stuebner (2):
  ARM: SAMSUNG: cleanup of rtc register definitions
  rtc-s3c: make room for more variants in devicetree block
  rtc-s3c: add variants for S3C2443 and S3C2416
  ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices

 arch/arm/mach-s3c2416/s3c2416.c               |    2 +
 arch/arm/mach-s3c2443/s3c2443.c               |    2 +
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   81 +++++++++++++------------
 arch/arm/plat-samsung/include/plat/rtc-core.h |   27 ++++++++
 drivers/rtc/rtc-s3c.c                         |   74 +++++++++++++++++++----
 5 files changed, 134 insertions(+), 52 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/rtc-core.h

-- 
1.7.5.4

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

* [PATCH 1/4] ARM: SAMSUNG: cleanup of rtc register definitions
  2011-12-21  9:14 ` Heiko Stübner
@ 2011-12-21  9:16   ` Heiko Stübner
  -1 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2011-12-21  9:16 UTC (permalink / raw)
  To: Kukjin Kim, ben-linux, a.zummo
  Cc: linux-samsung-soc, linux-arm-kernel, rtc-linux

regs-rtc.h uses a mixture of tabs and spaces and also (x<<y)
to format bits. So, before adding new stuff clean up the formatting
and also add spaces to the bit definitions (i.e. (x << y) )

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   78 ++++++++++---------------
 1 files changed, 32 insertions(+), 46 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index 30b7cc1..a7d944f 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -18,51 +18,37 @@
 #define S3C2410_INTP_ALM	(1 << 1)
 #define S3C2410_INTP_TIC	(1 << 0)
 
-#define S3C2410_RTCCON	      S3C2410_RTCREG(0x40)
-#define S3C2410_RTCCON_RTCEN  (1<<0)
-#define S3C2410_RTCCON_CLKSEL (1<<1)
-#define S3C2410_RTCCON_CNTSEL (1<<2)
-#define S3C2410_RTCCON_CLKRST (1<<3)
-#define S3C64XX_RTCCON_TICEN  (1<<8)
-
-#define S3C64XX_RTCCON_TICMSK (0xF<<7)
-#define S3C64XX_RTCCON_TICSHT (7)
-
-#define S3C2410_TICNT	      S3C2410_RTCREG(0x44)
-#define S3C2410_TICNT_ENABLE  (1<<7)
-
-#define S3C2410_RTCALM	      S3C2410_RTCREG(0x50)
-#define S3C2410_RTCALM_ALMEN  (1<<6)
-#define S3C2410_RTCALM_YEAREN (1<<5)
-#define S3C2410_RTCALM_MONEN  (1<<4)
-#define S3C2410_RTCALM_DAYEN  (1<<3)
-#define S3C2410_RTCALM_HOUREN (1<<2)
-#define S3C2410_RTCALM_MINEN  (1<<1)
-#define S3C2410_RTCALM_SECEN  (1<<0)
-
-#define S3C2410_RTCALM_ALL \
-  S3C2410_RTCALM_ALMEN | S3C2410_RTCALM_YEAREN | S3C2410_RTCALM_MONEN |\
-  S3C2410_RTCALM_DAYEN | S3C2410_RTCALM_HOUREN | S3C2410_RTCALM_MINEN |\
-  S3C2410_RTCALM_SECEN
-
-
-#define S3C2410_ALMSEC	      S3C2410_RTCREG(0x54)
-#define S3C2410_ALMMIN	      S3C2410_RTCREG(0x58)
-#define S3C2410_ALMHOUR	      S3C2410_RTCREG(0x5c)
-
-#define S3C2410_ALMDATE	      S3C2410_RTCREG(0x60)
-#define S3C2410_ALMMON	      S3C2410_RTCREG(0x64)
-#define S3C2410_ALMYEAR	      S3C2410_RTCREG(0x68)
-
-#define S3C2410_RTCRST	      S3C2410_RTCREG(0x6c)
-
-#define S3C2410_RTCSEC	      S3C2410_RTCREG(0x70)
-#define S3C2410_RTCMIN	      S3C2410_RTCREG(0x74)
-#define S3C2410_RTCHOUR	      S3C2410_RTCREG(0x78)
-#define S3C2410_RTCDATE	      S3C2410_RTCREG(0x7c)
-#define S3C2410_RTCDAY	      S3C2410_RTCREG(0x80)
-#define S3C2410_RTCMON	      S3C2410_RTCREG(0x84)
-#define S3C2410_RTCYEAR	      S3C2410_RTCREG(0x88)
-
+#define S3C2410_RTCCON		S3C2410_RTCREG(0x40)
+#define S3C2410_RTCCON_RTCEN	(1 << 0)
+#define S3C2410_RTCCON_CNTSEL	(1 << 2)
+#define S3C2410_RTCCON_CLKRST	(1 << 3)
+#define S3C64XX_RTCCON_TICEN	(1 << 8)
+
+#define S3C2410_TICNT		S3C2410_RTCREG(0x44)
+#define S3C2410_TICNT_ENABLE	(1 << 7)
+
+#define S3C2410_RTCALM		S3C2410_RTCREG(0x50)
+#define S3C2410_RTCALM_ALMEN	(1 << 6)
+#define S3C2410_RTCALM_YEAREN	(1 << 5)
+#define S3C2410_RTCALM_MONEN	(1 << 4)
+#define S3C2410_RTCALM_DAYEN	(1 << 3)
+#define S3C2410_RTCALM_HOUREN	(1 << 2)
+#define S3C2410_RTCALM_MINEN	(1 << 1)
+#define S3C2410_RTCALM_SECEN	(1 << 0)
+
+#define S3C2410_ALMSEC		S3C2410_RTCREG(0x54)
+#define S3C2410_ALMMIN		S3C2410_RTCREG(0x58)
+#define S3C2410_ALMHOUR		S3C2410_RTCREG(0x5c)
+
+#define S3C2410_ALMDATE		S3C2410_RTCREG(0x60)
+#define S3C2410_ALMMON		S3C2410_RTCREG(0x64)
+#define S3C2410_ALMYEAR		S3C2410_RTCREG(0x68)
+
+#define S3C2410_RTCSEC		S3C2410_RTCREG(0x70)
+#define S3C2410_RTCMIN		S3C2410_RTCREG(0x74)
+#define S3C2410_RTCHOUR		S3C2410_RTCREG(0x78)
+#define S3C2410_RTCDATE		S3C2410_RTCREG(0x7c)
+#define S3C2410_RTCMON		S3C2410_RTCREG(0x84)
+#define S3C2410_RTCYEAR		S3C2410_RTCREG(0x88)
 
 #endif /* __ASM_ARCH_REGS_RTC_H */
-- 
1.7.5.4

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

* [PATCH 1/4] ARM: SAMSUNG: cleanup of rtc register definitions
@ 2011-12-21  9:16   ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2011-12-21  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

regs-rtc.h uses a mixture of tabs and spaces and also (x<<y)
to format bits. So, before adding new stuff clean up the formatting
and also add spaces to the bit definitions (i.e. (x << y) )

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   78 ++++++++++---------------
 1 files changed, 32 insertions(+), 46 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index 30b7cc1..a7d944f 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -18,51 +18,37 @@
 #define S3C2410_INTP_ALM	(1 << 1)
 #define S3C2410_INTP_TIC	(1 << 0)
 
-#define S3C2410_RTCCON	      S3C2410_RTCREG(0x40)
-#define S3C2410_RTCCON_RTCEN  (1<<0)
-#define S3C2410_RTCCON_CLKSEL (1<<1)
-#define S3C2410_RTCCON_CNTSEL (1<<2)
-#define S3C2410_RTCCON_CLKRST (1<<3)
-#define S3C64XX_RTCCON_TICEN  (1<<8)
-
-#define S3C64XX_RTCCON_TICMSK (0xF<<7)
-#define S3C64XX_RTCCON_TICSHT (7)
-
-#define S3C2410_TICNT	      S3C2410_RTCREG(0x44)
-#define S3C2410_TICNT_ENABLE  (1<<7)
-
-#define S3C2410_RTCALM	      S3C2410_RTCREG(0x50)
-#define S3C2410_RTCALM_ALMEN  (1<<6)
-#define S3C2410_RTCALM_YEAREN (1<<5)
-#define S3C2410_RTCALM_MONEN  (1<<4)
-#define S3C2410_RTCALM_DAYEN  (1<<3)
-#define S3C2410_RTCALM_HOUREN (1<<2)
-#define S3C2410_RTCALM_MINEN  (1<<1)
-#define S3C2410_RTCALM_SECEN  (1<<0)
-
-#define S3C2410_RTCALM_ALL \
-  S3C2410_RTCALM_ALMEN | S3C2410_RTCALM_YEAREN | S3C2410_RTCALM_MONEN |\
-  S3C2410_RTCALM_DAYEN | S3C2410_RTCALM_HOUREN | S3C2410_RTCALM_MINEN |\
-  S3C2410_RTCALM_SECEN
-
-
-#define S3C2410_ALMSEC	      S3C2410_RTCREG(0x54)
-#define S3C2410_ALMMIN	      S3C2410_RTCREG(0x58)
-#define S3C2410_ALMHOUR	      S3C2410_RTCREG(0x5c)
-
-#define S3C2410_ALMDATE	      S3C2410_RTCREG(0x60)
-#define S3C2410_ALMMON	      S3C2410_RTCREG(0x64)
-#define S3C2410_ALMYEAR	      S3C2410_RTCREG(0x68)
-
-#define S3C2410_RTCRST	      S3C2410_RTCREG(0x6c)
-
-#define S3C2410_RTCSEC	      S3C2410_RTCREG(0x70)
-#define S3C2410_RTCMIN	      S3C2410_RTCREG(0x74)
-#define S3C2410_RTCHOUR	      S3C2410_RTCREG(0x78)
-#define S3C2410_RTCDATE	      S3C2410_RTCREG(0x7c)
-#define S3C2410_RTCDAY	      S3C2410_RTCREG(0x80)
-#define S3C2410_RTCMON	      S3C2410_RTCREG(0x84)
-#define S3C2410_RTCYEAR	      S3C2410_RTCREG(0x88)
-
+#define S3C2410_RTCCON		S3C2410_RTCREG(0x40)
+#define S3C2410_RTCCON_RTCEN	(1 << 0)
+#define S3C2410_RTCCON_CNTSEL	(1 << 2)
+#define S3C2410_RTCCON_CLKRST	(1 << 3)
+#define S3C64XX_RTCCON_TICEN	(1 << 8)
+
+#define S3C2410_TICNT		S3C2410_RTCREG(0x44)
+#define S3C2410_TICNT_ENABLE	(1 << 7)
+
+#define S3C2410_RTCALM		S3C2410_RTCREG(0x50)
+#define S3C2410_RTCALM_ALMEN	(1 << 6)
+#define S3C2410_RTCALM_YEAREN	(1 << 5)
+#define S3C2410_RTCALM_MONEN	(1 << 4)
+#define S3C2410_RTCALM_DAYEN	(1 << 3)
+#define S3C2410_RTCALM_HOUREN	(1 << 2)
+#define S3C2410_RTCALM_MINEN	(1 << 1)
+#define S3C2410_RTCALM_SECEN	(1 << 0)
+
+#define S3C2410_ALMSEC		S3C2410_RTCREG(0x54)
+#define S3C2410_ALMMIN		S3C2410_RTCREG(0x58)
+#define S3C2410_ALMHOUR		S3C2410_RTCREG(0x5c)
+
+#define S3C2410_ALMDATE		S3C2410_RTCREG(0x60)
+#define S3C2410_ALMMON		S3C2410_RTCREG(0x64)
+#define S3C2410_ALMYEAR		S3C2410_RTCREG(0x68)
+
+#define S3C2410_RTCSEC		S3C2410_RTCREG(0x70)
+#define S3C2410_RTCMIN		S3C2410_RTCREG(0x74)
+#define S3C2410_RTCHOUR		S3C2410_RTCREG(0x78)
+#define S3C2410_RTCDATE		S3C2410_RTCREG(0x7c)
+#define S3C2410_RTCMON		S3C2410_RTCREG(0x84)
+#define S3C2410_RTCYEAR		S3C2410_RTCREG(0x88)
 
 #endif /* __ASM_ARCH_REGS_RTC_H */
-- 
1.7.5.4

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

* [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
  2011-12-21  9:14 ` Heiko Stübner
@ 2011-12-21  9:16   ` Heiko Stübner
  -1 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2011-12-21  9:16 UTC (permalink / raw)
  To: Kukjin Kim, ben-linux, a.zummo
  Cc: linux-samsung-soc, linux-arm-kernel, rtc-linux

Use the data field of of_device_id to hold the type for
s3c_cpu_type.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
---
 drivers/rtc/rtc-s3c.c |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 175067a..2885b25 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -428,6 +428,20 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)
 	return 0;
 }
 
+static const struct of_device_id s3c_rtc_dt_match[];
+
+static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
+{
+#ifdef CONFIG_OF
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
+		return match->data;
+	}
+#endif
+	return platform_get_device_id(pdev)->driver_data;
+}
+
 static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 {
 	struct rtc_device *rtc;
@@ -508,13 +522,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 		goto err_nortc;
 	}
 
-#ifdef CONFIG_OF
-	if (pdev->dev.of_node)
-		s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node,
-			"samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410;
-	else
-#endif
-		s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
+	s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev);
 
 	/* Check RTC Time */
 
@@ -638,8 +646,13 @@ static int s3c_rtc_resume(struct platform_device *pdev)
 
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_rtc_dt_match[] = {
-	{ .compatible = "samsung,s3c2410-rtc" },
-	{ .compatible = "samsung,s3c6410-rtc" },
+	{
+		.compatible = "samsung,s3c2410-rtc"
+		.data = TYPE_S3C2410,
+	}, {
+		.compatible = "samsung,s3c6410-rtc"
+		.data = TYPE_S3C64XX,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);
-- 
1.7.5.4

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

* [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
@ 2011-12-21  9:16   ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2011-12-21  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

Use the data field of of_device_id to hold the type for
s3c_cpu_type.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
---
 drivers/rtc/rtc-s3c.c |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 175067a..2885b25 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -428,6 +428,20 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)
 	return 0;
 }
 
+static const struct of_device_id s3c_rtc_dt_match[];
+
+static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
+{
+#ifdef CONFIG_OF
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
+		return match->data;
+	}
+#endif
+	return platform_get_device_id(pdev)->driver_data;
+}
+
 static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 {
 	struct rtc_device *rtc;
@@ -508,13 +522,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 		goto err_nortc;
 	}
 
-#ifdef CONFIG_OF
-	if (pdev->dev.of_node)
-		s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node,
-			"samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410;
-	else
-#endif
-		s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
+	s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev);
 
 	/* Check RTC Time */
 
@@ -638,8 +646,13 @@ static int s3c_rtc_resume(struct platform_device *pdev)
 
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_rtc_dt_match[] = {
-	{ .compatible = "samsung,s3c2410-rtc" },
-	{ .compatible = "samsung,s3c6410-rtc" },
+	{
+		.compatible = "samsung,s3c2410-rtc"
+		.data = TYPE_S3C2410,
+	}, {
+		.compatible = "samsung,s3c6410-rtc"
+		.data = TYPE_S3C64XX,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);
-- 
1.7.5.4

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

* [PATCH 3/4] rtc-s3c: add variants for S3C2443 and S3C2416
  2011-12-21  9:14 ` Heiko Stübner
@ 2011-12-21  9:17   ` Heiko Stübner
  -1 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2011-12-21  9:17 UTC (permalink / raw)
  To: Kukjin Kim, ben-linux, a.zummo
  Cc: linux-samsung-soc, linux-arm-kernel, rtc-linux

Especially the TICNT registers are different from the two rtc types
that currently exists.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   17 ++++++++++
 drivers/rtc/rtc-s3c.c                         |   43 ++++++++++++++++++++++--
 2 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index a7d944f..0f8263e 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -22,11 +22,28 @@
 #define S3C2410_RTCCON_RTCEN	(1 << 0)
 #define S3C2410_RTCCON_CNTSEL	(1 << 2)
 #define S3C2410_RTCCON_CLKRST	(1 << 3)
+#define S3C2443_RTCCON_TICSEL	(1 << 4)
 #define S3C64XX_RTCCON_TICEN	(1 << 8)
 
 #define S3C2410_TICNT		S3C2410_RTCREG(0x44)
 #define S3C2410_TICNT_ENABLE	(1 << 7)
 
+/* S3C2443: tick count is 15 bit wide
+ * TICNT[6:0] contains upper 7 bits
+ * TICNT1[7:0] contains lower 8 bits
+ */
+#define S3C2443_TICNT_PART(x)	((x & 0x7f00) >> 8)
+#define S3C2443_TICNT1		S3C2410_RTCREG(0x4C)
+#define S3C2443_TICNT1_PART(x)	(x & 0xff)
+
+/* S3C2416: tick count is 32 bit wide
+ * TICNT[6:0] contains bits [14:8]
+ * TICNT1[7:0] contains lower 8 bits
+ * TICNT2[16:0] contains upper 17 bits
+ */
+#define S3C2416_TICNT2		S3C2410_RTCREG(0x48)
+#define S3C2416_TICNT2_PART(x)	((x & 0xffff8000) >> 15)
+
 #define S3C2410_RTCALM		S3C2410_RTCREG(0x50)
 #define S3C2410_RTCALM_ALMEN	(1 << 6)
 #define S3C2410_RTCALM_YEAREN	(1 << 5)
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 2885b25..4498053 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -35,6 +35,8 @@
 
 enum s3c_cpu_type {
 	TYPE_S3C2410,
+	TYPE_S3C2443,
+	TYPE_S3C2416,
 	TYPE_S3C64XX,
 };
 
@@ -132,6 +134,7 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct rtc_device *rtc_dev = platform_get_drvdata(pdev);
 	unsigned int tmp = 0;
+	int val;
 
 	if (!is_power_of_2(freq))
 		return -EINVAL;
@@ -139,12 +142,24 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
 	clk_enable(rtc_clk);
 	spin_lock_irq(&s3c_rtc_pie_lock);
 
-	if (s3c_rtc_cpu_type == TYPE_S3C2410) {
+	if (s3c_rtc_cpu_type != TYPE_S3C64XX) {
 		tmp = readb(s3c_rtc_base + S3C2410_TICNT);
 		tmp &= S3C2410_TICNT_ENABLE;
 	}
 
-	tmp |= (rtc_dev->max_user_freq / freq)-1;
+	val = (rtc_dev->max_user_freq / freq) - 1;
+
+	if (s3c_rtc_cpu_type == TYPE_S3C2443 ||
+	    s3c_rtc_cpu_type == TYPE_S3C2416) {
+		tmp |= S3C2443_TICNT_PART(val);
+		writel(S3C2443_TICNT1_PART(val),
+		       s3c_rtc_base + S3C2443_TICNT1);
+		if (s3c_rtc_cpu_type == TYPE_S3C2416)
+			writel(S3C2416_TICNT2_PART(val),
+			       s3c_rtc_base + S3C2416_TICNT2);
+	} else {
+		tmp |= val;
+	}
 
 	writel(tmp, s3c_rtc_base + S3C2410_TICNT);
 	spin_unlock_irq(&s3c_rtc_pie_lock);
@@ -371,7 +386,7 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en)
 		tmp &= ~S3C2410_RTCCON_RTCEN;
 		writew(tmp, base + S3C2410_RTCCON);
 
-		if (s3c_rtc_cpu_type == TYPE_S3C2410) {
+		if (s3c_rtc_cpu_type != TYPE_S3C64XX) {
 			tmp = readb(base + S3C2410_TICNT);
 			tmp &= ~S3C2410_TICNT_ENABLE;
 			writeb(tmp, base + S3C2410_TICNT);
@@ -448,6 +463,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 	struct rtc_time rtc_tm;
 	struct resource *res;
 	int ret;
+	int tmp;
 
 	pr_debug("%s: probe=%p\n", __func__, pdev);
 
@@ -541,11 +557,18 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 		dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n");
 	}
 
-	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+	if (s3c_rtc_cpu_type != TYPE_S3C2410)
 		rtc->max_user_freq = 32768;
 	else
 		rtc->max_user_freq = 128;
 
+	if (s3c_rtc_cpu_type == TYPE_S3C2443 ||
+	     s3c_rtc_cpu_type == TYPE_S3C2416) {
+		tmp = readw(s3c_rtc_base + S3C2410_RTCCON);
+		tmp |= S3C2443_RTCCON_TICSEL;
+		writew(tmp, s3c_rtc_base + S3C2410_RTCCON);
+	}
+
 	platform_set_drvdata(pdev, rtc);
 
 	s3c_rtc_setfreq(&pdev->dev, 1);
@@ -650,6 +673,12 @@ static const struct of_device_id s3c_rtc_dt_match[] = {
 		.compatible = "samsung,s3c2410-rtc"
 		.data = TYPE_S3C2410,
 	}, {
+		.compatible = "samsung,s3c2443-rtc"
+		.data = TYPE_S3C2443,
+	}, {
+		.compatible = "samsung,s3c2416-rtc"
+		.data = TYPE_S3C2416,
+	}, {
 		.compatible = "samsung,s3c6410-rtc"
 		.data = TYPE_S3C64XX,
 	},
@@ -665,6 +694,12 @@ static struct platform_device_id s3c_rtc_driver_ids[] = {
 		.name		= "s3c2410-rtc",
 		.driver_data	= TYPE_S3C2410,
 	}, {
+		.name		= "s3c2443-rtc",
+		.driver_data	= TYPE_S3C2443,
+	}, {
+		.name		= "s3c2416-rtc",
+		.driver_data	= TYPE_S3C2416,
+	}, {
 		.name		= "s3c64xx-rtc",
 		.driver_data	= TYPE_S3C64XX,
 	},
-- 
1.7.5.4

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

* [PATCH 3/4] rtc-s3c: add variants for S3C2443 and S3C2416
@ 2011-12-21  9:17   ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2011-12-21  9:17 UTC (permalink / raw)
  To: linux-arm-kernel

Especially the TICNT registers are different from the two rtc types
that currently exists.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   17 ++++++++++
 drivers/rtc/rtc-s3c.c                         |   43 ++++++++++++++++++++++--
 2 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index a7d944f..0f8263e 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -22,11 +22,28 @@
 #define S3C2410_RTCCON_RTCEN	(1 << 0)
 #define S3C2410_RTCCON_CNTSEL	(1 << 2)
 #define S3C2410_RTCCON_CLKRST	(1 << 3)
+#define S3C2443_RTCCON_TICSEL	(1 << 4)
 #define S3C64XX_RTCCON_TICEN	(1 << 8)
 
 #define S3C2410_TICNT		S3C2410_RTCREG(0x44)
 #define S3C2410_TICNT_ENABLE	(1 << 7)
 
+/* S3C2443: tick count is 15 bit wide
+ * TICNT[6:0] contains upper 7 bits
+ * TICNT1[7:0] contains lower 8 bits
+ */
+#define S3C2443_TICNT_PART(x)	((x & 0x7f00) >> 8)
+#define S3C2443_TICNT1		S3C2410_RTCREG(0x4C)
+#define S3C2443_TICNT1_PART(x)	(x & 0xff)
+
+/* S3C2416: tick count is 32 bit wide
+ * TICNT[6:0] contains bits [14:8]
+ * TICNT1[7:0] contains lower 8 bits
+ * TICNT2[16:0] contains upper 17 bits
+ */
+#define S3C2416_TICNT2		S3C2410_RTCREG(0x48)
+#define S3C2416_TICNT2_PART(x)	((x & 0xffff8000) >> 15)
+
 #define S3C2410_RTCALM		S3C2410_RTCREG(0x50)
 #define S3C2410_RTCALM_ALMEN	(1 << 6)
 #define S3C2410_RTCALM_YEAREN	(1 << 5)
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 2885b25..4498053 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -35,6 +35,8 @@
 
 enum s3c_cpu_type {
 	TYPE_S3C2410,
+	TYPE_S3C2443,
+	TYPE_S3C2416,
 	TYPE_S3C64XX,
 };
 
@@ -132,6 +134,7 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct rtc_device *rtc_dev = platform_get_drvdata(pdev);
 	unsigned int tmp = 0;
+	int val;
 
 	if (!is_power_of_2(freq))
 		return -EINVAL;
@@ -139,12 +142,24 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
 	clk_enable(rtc_clk);
 	spin_lock_irq(&s3c_rtc_pie_lock);
 
-	if (s3c_rtc_cpu_type == TYPE_S3C2410) {
+	if (s3c_rtc_cpu_type != TYPE_S3C64XX) {
 		tmp = readb(s3c_rtc_base + S3C2410_TICNT);
 		tmp &= S3C2410_TICNT_ENABLE;
 	}
 
-	tmp |= (rtc_dev->max_user_freq / freq)-1;
+	val = (rtc_dev->max_user_freq / freq) - 1;
+
+	if (s3c_rtc_cpu_type == TYPE_S3C2443 ||
+	    s3c_rtc_cpu_type == TYPE_S3C2416) {
+		tmp |= S3C2443_TICNT_PART(val);
+		writel(S3C2443_TICNT1_PART(val),
+		       s3c_rtc_base + S3C2443_TICNT1);
+		if (s3c_rtc_cpu_type == TYPE_S3C2416)
+			writel(S3C2416_TICNT2_PART(val),
+			       s3c_rtc_base + S3C2416_TICNT2);
+	} else {
+		tmp |= val;
+	}
 
 	writel(tmp, s3c_rtc_base + S3C2410_TICNT);
 	spin_unlock_irq(&s3c_rtc_pie_lock);
@@ -371,7 +386,7 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en)
 		tmp &= ~S3C2410_RTCCON_RTCEN;
 		writew(tmp, base + S3C2410_RTCCON);
 
-		if (s3c_rtc_cpu_type == TYPE_S3C2410) {
+		if (s3c_rtc_cpu_type != TYPE_S3C64XX) {
 			tmp = readb(base + S3C2410_TICNT);
 			tmp &= ~S3C2410_TICNT_ENABLE;
 			writeb(tmp, base + S3C2410_TICNT);
@@ -448,6 +463,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 	struct rtc_time rtc_tm;
 	struct resource *res;
 	int ret;
+	int tmp;
 
 	pr_debug("%s: probe=%p\n", __func__, pdev);
 
@@ -541,11 +557,18 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 		dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n");
 	}
 
-	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+	if (s3c_rtc_cpu_type != TYPE_S3C2410)
 		rtc->max_user_freq = 32768;
 	else
 		rtc->max_user_freq = 128;
 
+	if (s3c_rtc_cpu_type == TYPE_S3C2443 ||
+	     s3c_rtc_cpu_type == TYPE_S3C2416) {
+		tmp = readw(s3c_rtc_base + S3C2410_RTCCON);
+		tmp |= S3C2443_RTCCON_TICSEL;
+		writew(tmp, s3c_rtc_base + S3C2410_RTCCON);
+	}
+
 	platform_set_drvdata(pdev, rtc);
 
 	s3c_rtc_setfreq(&pdev->dev, 1);
@@ -650,6 +673,12 @@ static const struct of_device_id s3c_rtc_dt_match[] = {
 		.compatible = "samsung,s3c2410-rtc"
 		.data = TYPE_S3C2410,
 	}, {
+		.compatible = "samsung,s3c2443-rtc"
+		.data = TYPE_S3C2443,
+	}, {
+		.compatible = "samsung,s3c2416-rtc"
+		.data = TYPE_S3C2416,
+	}, {
 		.compatible = "samsung,s3c6410-rtc"
 		.data = TYPE_S3C64XX,
 	},
@@ -665,6 +694,12 @@ static struct platform_device_id s3c_rtc_driver_ids[] = {
 		.name		= "s3c2410-rtc",
 		.driver_data	= TYPE_S3C2410,
 	}, {
+		.name		= "s3c2443-rtc",
+		.driver_data	= TYPE_S3C2443,
+	}, {
+		.name		= "s3c2416-rtc",
+		.driver_data	= TYPE_S3C2416,
+	}, {
 		.name		= "s3c64xx-rtc",
 		.driver_data	= TYPE_S3C64XX,
 	},
-- 
1.7.5.4

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

* [PATCH 4/4] ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices
  2011-12-21  9:14 ` Heiko Stübner
@ 2011-12-21  9:18   ` Heiko Stübner
  -1 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2011-12-21  9:18 UTC (permalink / raw)
  To: Kukjin Kim, ben-linux, a.zummo
  Cc: linux-samsung-soc, linux-arm-kernel, rtc-linux

As the S3C24xx SoCs use the same rtc device a renaming capability like in
the adc driver is necessary.

This patch adds a s3c_rtc_setname function and names the rtc devices for
S3C2443 and S3C2416 accordingly.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/mach-s3c2416/s3c2416.c               |    2 +
 arch/arm/mach-s3c2443/s3c2443.c               |    2 +
 arch/arm/plat-samsung/include/plat/rtc-core.h |   27 +++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/rtc-core.h

diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c
index ee214bc..604cf98 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c2416/s3c2416.c
@@ -61,6 +61,7 @@
 #include <plat/fb-core.h>
 #include <plat/nand-core.h>
 #include <plat/adc-core.h>
+#include <plat/rtc-core.h>
 
 static struct map_desc s3c2416_iodesc[] __initdata = {
 	IODESC_ENT(WATCHDOG),
@@ -99,6 +100,7 @@ int __init s3c2416_init(void)
 	s3c_fb_setname("s3c2443-fb");
 
 	s3c_adc_setname("s3c2416-adc");
+	s3c_rtc_setname("s3c2416-rtc");
 
 #ifdef CONFIG_PM
 	register_syscore_ops(&s3c2416_pm_syscore_ops);
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c
index a22b771..9e6be20 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c2443/s3c2443.c
@@ -42,6 +42,7 @@
 #include <plat/fb-core.h>
 #include <plat/nand-core.h>
 #include <plat/adc-core.h>
+#include <plat/rtc-core.h>
 
 static struct map_desc s3c2443_iodesc[] __initdata = {
 	IODESC_ENT(WATCHDOG),
@@ -72,6 +73,7 @@ int __init s3c2443_init(void)
 	s3c_fb_setname("s3c2443-fb");
 
 	s3c_adc_setname("s3c2443-adc");
+	s3c_rtc_setname("s3c2443-rtc");
 
 	/* change WDT IRQ number */
 	s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
diff --git a/arch/arm/plat-samsung/include/plat/rtc-core.h b/arch/arm/plat-samsung/include/plat/rtc-core.h
new file mode 100644
index 0000000..21d8594
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/rtc-core.h
@@ -0,0 +1,27 @@
+/* linux/arch/arm/plat-samsung/include/plat/rtc-core.h
+ *
+ * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de>
+ *
+ * Samsung RTC Controller core functions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_PLAT_RTC_CORE_H
+#define __ASM_PLAT_RTC_CORE_H __FILE__
+
+/* These functions are only for use with the core support code, such as
+ * the cpu specific initialisation code
+ */
+
+/* re-define device name depending on support. */
+static inline void s3c_rtc_setname(char *name)
+{
+#if defined(CONFIG_SAMSUNG_DEV_RTC) || defined(CONFIG_PLAT_S3C24XX)
+	s3c_device_rtc.name = name;
+#endif
+}
+
+#endif /* __ASM_PLAT_RTC_CORE_H */
-- 
1.7.5.4

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

* [PATCH 4/4] ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices
@ 2011-12-21  9:18   ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2011-12-21  9:18 UTC (permalink / raw)
  To: linux-arm-kernel

As the S3C24xx SoCs use the same rtc device a renaming capability like in
the adc driver is necessary.

This patch adds a s3c_rtc_setname function and names the rtc devices for
S3C2443 and S3C2416 accordingly.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/mach-s3c2416/s3c2416.c               |    2 +
 arch/arm/mach-s3c2443/s3c2443.c               |    2 +
 arch/arm/plat-samsung/include/plat/rtc-core.h |   27 +++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/rtc-core.h

diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c
index ee214bc..604cf98 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c2416/s3c2416.c
@@ -61,6 +61,7 @@
 #include <plat/fb-core.h>
 #include <plat/nand-core.h>
 #include <plat/adc-core.h>
+#include <plat/rtc-core.h>
 
 static struct map_desc s3c2416_iodesc[] __initdata = {
 	IODESC_ENT(WATCHDOG),
@@ -99,6 +100,7 @@ int __init s3c2416_init(void)
 	s3c_fb_setname("s3c2443-fb");
 
 	s3c_adc_setname("s3c2416-adc");
+	s3c_rtc_setname("s3c2416-rtc");
 
 #ifdef CONFIG_PM
 	register_syscore_ops(&s3c2416_pm_syscore_ops);
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c
index a22b771..9e6be20 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c2443/s3c2443.c
@@ -42,6 +42,7 @@
 #include <plat/fb-core.h>
 #include <plat/nand-core.h>
 #include <plat/adc-core.h>
+#include <plat/rtc-core.h>
 
 static struct map_desc s3c2443_iodesc[] __initdata = {
 	IODESC_ENT(WATCHDOG),
@@ -72,6 +73,7 @@ int __init s3c2443_init(void)
 	s3c_fb_setname("s3c2443-fb");
 
 	s3c_adc_setname("s3c2443-adc");
+	s3c_rtc_setname("s3c2443-rtc");
 
 	/* change WDT IRQ number */
 	s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
diff --git a/arch/arm/plat-samsung/include/plat/rtc-core.h b/arch/arm/plat-samsung/include/plat/rtc-core.h
new file mode 100644
index 0000000..21d8594
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/rtc-core.h
@@ -0,0 +1,27 @@
+/* linux/arch/arm/plat-samsung/include/plat/rtc-core.h
+ *
+ * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de>
+ *
+ * Samsung RTC Controller core functions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_PLAT_RTC_CORE_H
+#define __ASM_PLAT_RTC_CORE_H __FILE__
+
+/* These functions are only for use with the core support code, such as
+ * the cpu specific initialisation code
+ */
+
+/* re-define device name depending on support. */
+static inline void s3c_rtc_setname(char *name)
+{
+#if defined(CONFIG_SAMSUNG_DEV_RTC) || defined(CONFIG_PLAT_S3C24XX)
+	s3c_device_rtc.name = name;
+#endif
+}
+
+#endif /* __ASM_PLAT_RTC_CORE_H */
-- 
1.7.5.4

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

* Re: [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
  2011-12-21  9:16   ` Heiko Stübner
@ 2012-01-04 10:43     ` Sylwester Nawrocki
  -1 siblings, 0 replies; 34+ messages in thread
From: Sylwester Nawrocki @ 2012-01-04 10:43 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: Kukjin Kim, ben-linux, a.zummo, linux-samsung-soc,
	linux-arm-kernel, rtc-linux

Hello,

On 12/21/2011 10:16 AM, Heiko Stübner wrote:
> Use the data field of of_device_id to hold the type for
> s3c_cpu_type.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
> ---
>  drivers/rtc/rtc-s3c.c |   31 ++++++++++++++++++++++---------
>  1 files changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 175067a..2885b25 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -428,6 +428,20 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)
>  	return 0;
>  }
>  
> +static const struct of_device_id s3c_rtc_dt_match[];
> +
> +static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
> +{
> +#ifdef CONFIG_OF
> +	if (pdev->dev.of_node) {
> +		const struct of_device_id *match;
> +		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
> +		return match->data;
> +	}
> +#endif
> +	return platform_get_device_id(pdev)->driver_data;
> +}
> +
>  static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>  {
>  	struct rtc_device *rtc;
> @@ -508,13 +522,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>  		goto err_nortc;
>  	}
>  
> -#ifdef CONFIG_OF
> -	if (pdev->dev.of_node)
> -		s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node,
> -			"samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410;
> -	else
> -#endif
> -		s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
> +	s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev);
>  
>  	/* Check RTC Time */
>  
> @@ -638,8 +646,13 @@ static int s3c_rtc_resume(struct platform_device *pdev)
>  
>  #ifdef CONFIG_OF
>  static const struct of_device_id s3c_rtc_dt_match[] = {
> -	{ .compatible = "samsung,s3c2410-rtc" },
> -	{ .compatible = "samsung,s3c6410-rtc" },
> +	{
> +		.compatible = "samsung,s3c2410-rtc"
> +		.data = TYPE_S3C2410,
> +	}, {
> +		.compatible = "samsung,s3c6410-rtc"
> +		.data = TYPE_S3C64XX,
> +	},
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);

This patch makes compilation with CONFIG_OF enabled fail with errors
and warnings:

drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_get_driver_data’:
drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer without a
cast
drivers/rtc/rtc-s3c.c: At top level:
drivers/rtc/rtc-s3c.c:674: error: request for member ‘data’ in something not a
structure or union
drivers/rtc/rtc-s3c.c:677: error: request for member ‘data’ in something not a
structure or union
drivers/rtc/rtc-s3c.c:680: error: request for member ‘data’ in something not a
structure or union
drivers/rtc/rtc-s3c.c:683: error: request for member ‘data’ in something not a
structure or union
make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1

And the following patch fixes this:

8<------------

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 4498053..9a0d388 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -451,7 +451,7 @@ static inline int s3c_rtc_get_driver_data(struct
platform_device *pdev)
        if (pdev->dev.of_node) {
                const struct of_device_id *match;
                match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
-               return match->data;
+               return (int)match->data;
        }
 #endif
        return platform_get_device_id(pdev)->driver_data;
@@ -670,17 +670,17 @@ static int s3c_rtc_resume(struct platform_device *pdev)
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_rtc_dt_match[] = {
        {
-               .compatible = "samsung,s3c2410-rtc"
-               .data = TYPE_S3C2410,
+               .compatible = "samsung,s3c2410-rtc",
+               .data = (void*)TYPE_S3C2410,
        }, {
-               .compatible = "samsung,s3c2443-rtc"
-               .data = TYPE_S3C2443,
+               .compatible = "samsung,s3c2443-rtc",
+               .data = (void*)TYPE_S3C2443,
        }, {
-               .compatible = "samsung,s3c2416-rtc"
-               .data = TYPE_S3C2416,
+               .compatible = "samsung,s3c2416-rtc",
+               .data = (void*)TYPE_S3C2416,
        }, {
-               .compatible = "samsung,s3c6410-rtc"
-               .data = TYPE_S3C64XX,
+               .compatible = "samsung,s3c6410-rtc",
+               .data = (void*)TYPE_S3C64XX,
        },
        {},
 };

8<-----------------

--

Regards,
Sylwester

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

* [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
@ 2012-01-04 10:43     ` Sylwester Nawrocki
  0 siblings, 0 replies; 34+ messages in thread
From: Sylwester Nawrocki @ 2012-01-04 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

On 12/21/2011 10:16 AM, Heiko St?bner wrote:
> Use the data field of of_device_id to hold the type for
> s3c_cpu_type.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
> ---
>  drivers/rtc/rtc-s3c.c |   31 ++++++++++++++++++++++---------
>  1 files changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 175067a..2885b25 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -428,6 +428,20 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)
>  	return 0;
>  }
>  
> +static const struct of_device_id s3c_rtc_dt_match[];
> +
> +static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
> +{
> +#ifdef CONFIG_OF
> +	if (pdev->dev.of_node) {
> +		const struct of_device_id *match;
> +		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
> +		return match->data;
> +	}
> +#endif
> +	return platform_get_device_id(pdev)->driver_data;
> +}
> +
>  static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>  {
>  	struct rtc_device *rtc;
> @@ -508,13 +522,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>  		goto err_nortc;
>  	}
>  
> -#ifdef CONFIG_OF
> -	if (pdev->dev.of_node)
> -		s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node,
> -			"samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410;
> -	else
> -#endif
> -		s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
> +	s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev);
>  
>  	/* Check RTC Time */
>  
> @@ -638,8 +646,13 @@ static int s3c_rtc_resume(struct platform_device *pdev)
>  
>  #ifdef CONFIG_OF
>  static const struct of_device_id s3c_rtc_dt_match[] = {
> -	{ .compatible = "samsung,s3c2410-rtc" },
> -	{ .compatible = "samsung,s3c6410-rtc" },
> +	{
> +		.compatible = "samsung,s3c2410-rtc"
> +		.data = TYPE_S3C2410,
> +	}, {
> +		.compatible = "samsung,s3c6410-rtc"
> +		.data = TYPE_S3C64XX,
> +	},
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);

This patch makes compilation with CONFIG_OF enabled fail with errors
and warnings:

drivers/rtc/rtc-s3c.c: In function ?s3c_rtc_get_driver_data?:
drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer without a
cast
drivers/rtc/rtc-s3c.c: At top level:
drivers/rtc/rtc-s3c.c:674: error: request for member ?data? in something not a
structure or union
drivers/rtc/rtc-s3c.c:677: error: request for member ?data? in something not a
structure or union
drivers/rtc/rtc-s3c.c:680: error: request for member ?data? in something not a
structure or union
drivers/rtc/rtc-s3c.c:683: error: request for member ?data? in something not a
structure or union
make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1

And the following patch fixes this:

8<------------

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 4498053..9a0d388 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -451,7 +451,7 @@ static inline int s3c_rtc_get_driver_data(struct
platform_device *pdev)
        if (pdev->dev.of_node) {
                const struct of_device_id *match;
                match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
-               return match->data;
+               return (int)match->data;
        }
 #endif
        return platform_get_device_id(pdev)->driver_data;
@@ -670,17 +670,17 @@ static int s3c_rtc_resume(struct platform_device *pdev)
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_rtc_dt_match[] = {
        {
-               .compatible = "samsung,s3c2410-rtc"
-               .data = TYPE_S3C2410,
+               .compatible = "samsung,s3c2410-rtc",
+               .data = (void*)TYPE_S3C2410,
        }, {
-               .compatible = "samsung,s3c2443-rtc"
-               .data = TYPE_S3C2443,
+               .compatible = "samsung,s3c2443-rtc",
+               .data = (void*)TYPE_S3C2443,
        }, {
-               .compatible = "samsung,s3c2416-rtc"
-               .data = TYPE_S3C2416,
+               .compatible = "samsung,s3c2416-rtc",
+               .data = (void*)TYPE_S3C2416,
        }, {
-               .compatible = "samsung,s3c6410-rtc"
-               .data = TYPE_S3C64XX,
+               .compatible = "samsung,s3c6410-rtc",
+               .data = (void*)TYPE_S3C64XX,
        },
        {},
 };

8<-----------------

--

Regards,
Sylwester

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

* Re: [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
  2012-01-04 10:43     ` Sylwester Nawrocki
@ 2012-01-04 11:51       ` Heiko Stübner
  -1 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 11:51 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: Kukjin Kim, ben-linux, a.zummo, linux-samsung-soc,
	linux-arm-kernel, rtc-linux

Hi Sylwester,

Am Mittwoch, 4. Januar 2012, 11:43:45 schrieb Sylwester Nawrocki:
> Hello,
> 
> On 12/21/2011 10:16 AM, Heiko Stübner wrote:
> > Use the data field of of_device_id to hold the type for
> > s3c_cpu_type.
> > 
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
> > ---
> > 
> This patch makes compilation with CONFIG_OF enabled fail with errors
> and warnings:
> 
> drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_get_driver_data’:
> drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer
> without a cast
> drivers/rtc/rtc-s3c.c: At top level:
> drivers/rtc/rtc-s3c.c:674: error: request for member ‘data’ in something
> not a structure or union
> drivers/rtc/rtc-s3c.c:677: error: request for member ‘data’ in something
> not a structure or union
> drivers/rtc/rtc-s3c.c:680: error: request for member ‘data’ in something
> not a structure or union
> drivers/rtc/rtc-s3c.c:683: error: request for member ‘data’ in something
> not a structure or union
> make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1
thanks for spotting this.

@kgene: Should this go on top of the rtc series, or should I prepare a v4 with 
these fixes included?


> And the following patch fixes this:
> 
> 8<------------
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 4498053..9a0d388 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -451,7 +451,7 @@ static inline int s3c_rtc_get_driver_data(struct
> platform_device *pdev)
>         if (pdev->dev.of_node) {
>                 const struct of_device_id *match;
>                 match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
> -               return match->data;
> +               return (int)match->data;
>         }
>  #endif
>         return platform_get_device_id(pdev)->driver_data;
> @@ -670,17 +670,17 @@ static int s3c_rtc_resume(struct platform_device
> *pdev) #ifdef CONFIG_OF
>  static const struct of_device_id s3c_rtc_dt_match[] = {
>         {
> -               .compatible = "samsung,s3c2410-rtc"
> -               .data = TYPE_S3C2410,
> +               .compatible = "samsung,s3c2410-rtc",
> +               .data = (void*)TYPE_S3C2410,
>         }, {
> -               .compatible = "samsung,s3c2443-rtc"
> -               .data = TYPE_S3C2443,
> +               .compatible = "samsung,s3c2443-rtc",
> +               .data = (void*)TYPE_S3C2443,
>         }, {
> -               .compatible = "samsung,s3c2416-rtc"
> -               .data = TYPE_S3C2416,
> +               .compatible = "samsung,s3c2416-rtc",
> +               .data = (void*)TYPE_S3C2416,
>         }, {
> -               .compatible = "samsung,s3c6410-rtc"
> -               .data = TYPE_S3C64XX,
> +               .compatible = "samsung,s3c6410-rtc",
> +               .data = (void*)TYPE_S3C64XX,
>         },
>         {},
>  };
> 
> 8<-----------------

Heiko

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

* [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
@ 2012-01-04 11:51       ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 11:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sylwester,

Am Mittwoch, 4. Januar 2012, 11:43:45 schrieb Sylwester Nawrocki:
> Hello,
> 
> On 12/21/2011 10:16 AM, Heiko St?bner wrote:
> > Use the data field of of_device_id to hold the type for
> > s3c_cpu_type.
> > 
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
> > ---
> > 
> This patch makes compilation with CONFIG_OF enabled fail with errors
> and warnings:
> 
> drivers/rtc/rtc-s3c.c: In function ?s3c_rtc_get_driver_data?:
> drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer
> without a cast
> drivers/rtc/rtc-s3c.c: At top level:
> drivers/rtc/rtc-s3c.c:674: error: request for member ?data? in something
> not a structure or union
> drivers/rtc/rtc-s3c.c:677: error: request for member ?data? in something
> not a structure or union
> drivers/rtc/rtc-s3c.c:680: error: request for member ?data? in something
> not a structure or union
> drivers/rtc/rtc-s3c.c:683: error: request for member ?data? in something
> not a structure or union
> make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1
thanks for spotting this.

@kgene: Should this go on top of the rtc series, or should I prepare a v4 with 
these fixes included?


> And the following patch fixes this:
> 
> 8<------------
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 4498053..9a0d388 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -451,7 +451,7 @@ static inline int s3c_rtc_get_driver_data(struct
> platform_device *pdev)
>         if (pdev->dev.of_node) {
>                 const struct of_device_id *match;
>                 match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
> -               return match->data;
> +               return (int)match->data;
>         }
>  #endif
>         return platform_get_device_id(pdev)->driver_data;
> @@ -670,17 +670,17 @@ static int s3c_rtc_resume(struct platform_device
> *pdev) #ifdef CONFIG_OF
>  static const struct of_device_id s3c_rtc_dt_match[] = {
>         {
> -               .compatible = "samsung,s3c2410-rtc"
> -               .data = TYPE_S3C2410,
> +               .compatible = "samsung,s3c2410-rtc",
> +               .data = (void*)TYPE_S3C2410,
>         }, {
> -               .compatible = "samsung,s3c2443-rtc"
> -               .data = TYPE_S3C2443,
> +               .compatible = "samsung,s3c2443-rtc",
> +               .data = (void*)TYPE_S3C2443,
>         }, {
> -               .compatible = "samsung,s3c2416-rtc"
> -               .data = TYPE_S3C2416,
> +               .compatible = "samsung,s3c2416-rtc",
> +               .data = (void*)TYPE_S3C2416,
>         }, {
> -               .compatible = "samsung,s3c6410-rtc"
> -               .data = TYPE_S3C64XX,
> +               .compatible = "samsung,s3c6410-rtc",
> +               .data = (void*)TYPE_S3C64XX,
>         },
>         {},
>  };
> 
> 8<-----------------

Heiko

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

* Re: [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
  2012-01-04 11:51       ` Heiko Stübner
@ 2012-01-04 14:12         ` Heiko Stübner
  -1 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:12 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Sylwester Nawrocki, ben-linux, a.zummo, linux-samsung-soc,
	linux-arm-kernel, rtc-linux

Hi Kgene,

Am Mittwoch, 4. Januar 2012, 12:51:41 schrieb Heiko Stübner:
> Hi Sylwester,
> 
> Am Mittwoch, 4. Januar 2012, 11:43:45 schrieb Sylwester Nawrocki:
> > Hello,
> > 
> > On 12/21/2011 10:16 AM, Heiko Stübner wrote:
> > > Use the data field of of_device_id to hold the type for
> > > s3c_cpu_type.
> > > 
> > > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > > Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
> > > ---
> > 
> > This patch makes compilation with CONFIG_OF enabled fail with errors
> > and warnings:
> > 
> > drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_get_driver_data’:
> > drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer
> > without a cast
> > drivers/rtc/rtc-s3c.c: At top level:
> > drivers/rtc/rtc-s3c.c:674: error: request for member ‘data’ in something
> > not a structure or union
> > drivers/rtc/rtc-s3c.c:677: error: request for member ‘data’ in something
> > not a structure or union
> > drivers/rtc/rtc-s3c.c:680: error: request for member ‘data’ in something
> > not a structure or union
> > drivers/rtc/rtc-s3c.c:683: error: request for member ‘data’ in something
> > not a structure or union
> > make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1
> 
> thanks for spotting this.
> 
> @kgene: Should this go on top of the rtc series, or should I prepare a v4
> with these fixes included?
never mind, I did both.

In reply to this mail you will find:
- a single patch on top of the 4 original patches, fixing the problems 
sylwester reported
- a v4 of the original series including the fixes to the problems, based on 
the code that you have in your rtc-branch

Please pick the apropriate variant to fix the problem :-)

Heiko

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

* [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
@ 2012-01-04 14:12         ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:12 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kgene,

Am Mittwoch, 4. Januar 2012, 12:51:41 schrieb Heiko St?bner:
> Hi Sylwester,
> 
> Am Mittwoch, 4. Januar 2012, 11:43:45 schrieb Sylwester Nawrocki:
> > Hello,
> > 
> > On 12/21/2011 10:16 AM, Heiko St?bner wrote:
> > > Use the data field of of_device_id to hold the type for
> > > s3c_cpu_type.
> > > 
> > > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > > Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
> > > ---
> > 
> > This patch makes compilation with CONFIG_OF enabled fail with errors
> > and warnings:
> > 
> > drivers/rtc/rtc-s3c.c: In function ?s3c_rtc_get_driver_data?:
> > drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer
> > without a cast
> > drivers/rtc/rtc-s3c.c: At top level:
> > drivers/rtc/rtc-s3c.c:674: error: request for member ?data? in something
> > not a structure or union
> > drivers/rtc/rtc-s3c.c:677: error: request for member ?data? in something
> > not a structure or union
> > drivers/rtc/rtc-s3c.c:680: error: request for member ?data? in something
> > not a structure or union
> > drivers/rtc/rtc-s3c.c:683: error: request for member ?data? in something
> > not a structure or union
> > make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1
> 
> thanks for spotting this.
> 
> @kgene: Should this go on top of the rtc series, or should I prepare a v4
> with these fixes included?
never mind, I did both.

In reply to this mail you will find:
- a single patch on top of the 4 original patches, fixing the problems 
sylwester reported
- a v4 of the original series including the fixes to the problems, based on 
the code that you have in your rtc-branch

Please pick the apropriate variant to fix the problem :-)

Heiko

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

* [PATCH] rtc-s3c: Fix breakage introduced by S3C2443/S3C2416 support
  2012-01-04 14:12         ` Heiko Stübner
@ 2012-01-04 14:14           ` Heiko Stübner
  -1 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:14 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Sylwester Nawrocki, ben-linux, a.zummo, linux-samsung-soc,
	linux-arm-kernel, rtc-linux

Commits 7006ee4f (rtc-s3c: make room for more variants in devicetree block)
and 6c0a2365 (rtc-s3c: add variants for S3C2443 and S3C2416)
introduced build-failures with enabled CONFIG_USE_OF option.

This patch fixes missing "," in s3c_rtc_dt_match and wrong handling of
the of_device_id.data property.

Reported-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/rtc/rtc-s3c.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index bb0f320..2b4feb8 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -449,7 +449,7 @@ static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
 	if (pdev->dev.of_node) {
 		const struct of_device_id *match;
 		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
-		return match->data;
+		return (int)match->data;
 	}
 #endif
 	return platform_get_device_id(pdev)->driver_data;
@@ -667,17 +667,17 @@ static int s3c_rtc_resume(struct platform_device *pdev)
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_rtc_dt_match[] = {
 	{
-		.compatible = "samsung,s3c2410-rtc"
-		.data = TYPE_S3C2410,
+		.compatible = "samsung,s3c2410-rtc",
+		.data = (void *)TYPE_S3C2410,
 	}, {
-		.compatible = "samsung,s3c2416-rtc"
-		.data = TYPE_S3C2416,
+		.compatible = "samsung,s3c2416-rtc",
+		.data = (void *)TYPE_S3C2416,
 	}, {
-		.compatible = "samsung,s3c2443-rtc"
-		.data = TYPE_S3C2443,
+		.compatible = "samsung,s3c2443-rtc",
+		.data = (void *)TYPE_S3C2443,
 	}, {
-		.compatible = "samsung,s3c6410-rtc"
-		.data = TYPE_S3C64XX,
+		.compatible = "samsung,s3c6410-rtc",
+		.data = (void *)TYPE_S3C64XX,
 	},
 	{},
 };
-- 
1.7.5.4

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

* [PATCH] rtc-s3c: Fix breakage introduced by S3C2443/S3C2416 support
@ 2012-01-04 14:14           ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

Commits 7006ee4f (rtc-s3c: make room for more variants in devicetree block)
and 6c0a2365 (rtc-s3c: add variants for S3C2443 and S3C2416)
introduced build-failures with enabled CONFIG_USE_OF option.

This patch fixes missing "," in s3c_rtc_dt_match and wrong handling of
the of_device_id.data property.

Reported-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/rtc/rtc-s3c.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index bb0f320..2b4feb8 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -449,7 +449,7 @@ static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
 	if (pdev->dev.of_node) {
 		const struct of_device_id *match;
 		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
-		return match->data;
+		return (int)match->data;
 	}
 #endif
 	return platform_get_device_id(pdev)->driver_data;
@@ -667,17 +667,17 @@ static int s3c_rtc_resume(struct platform_device *pdev)
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_rtc_dt_match[] = {
 	{
-		.compatible = "samsung,s3c2410-rtc"
-		.data = TYPE_S3C2410,
+		.compatible = "samsung,s3c2410-rtc",
+		.data = (void *)TYPE_S3C2410,
 	}, {
-		.compatible = "samsung,s3c2416-rtc"
-		.data = TYPE_S3C2416,
+		.compatible = "samsung,s3c2416-rtc",
+		.data = (void *)TYPE_S3C2416,
 	}, {
-		.compatible = "samsung,s3c2443-rtc"
-		.data = TYPE_S3C2443,
+		.compatible = "samsung,s3c2443-rtc",
+		.data = (void *)TYPE_S3C2443,
 	}, {
-		.compatible = "samsung,s3c6410-rtc"
-		.data = TYPE_S3C64XX,
+		.compatible = "samsung,s3c6410-rtc",
+		.data = (void *)TYPE_S3C64XX,
 	},
 	{},
 };
-- 
1.7.5.4

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

* [PATCH v4 0/4] Implement RTC support for S3C2443/S3C2416/S3C2450
  2012-01-04 14:12         ` Heiko Stübner
@ 2012-01-04 14:14           ` Heiko Stübner
  -1 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:14 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Sylwester Nawrocki, ben-linux, a.zummo, linux-samsung-soc,
	linux-arm-kernel, rtc-linux

Similar to the ADC the RTC of S3C2443 and S3C2416/2450 has some slight
variances when compared to the existing types.

This series adds support for those SoCs.

As with the ADC patches, these changes where tested on S3C2416 hardware.
The S3C2443 quirks are a subset of those and are done according to the
datasheet, but not tested on real hardware (as I do not own a S3C2443 device).

changes since v3:
fixes missing "," in s3c_rtc_dt_match and wrong handling of the
of_device_id.data property, as reported-by Sylwester Nawrocki

changes since v2:
remove obsolete constants in register cleanup

changes since v1:
address comments from Thomas Abraham, reducing number of ifdefs and
duplicate code


Heiko Stuebner (4):
  ARM: SAMSUNG: cleanup of rtc register definitions
  rtc-s3c: make room for more variants in devicetree block
  rtc-s3c: add variants for S3C2443 and S3C2416
  ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices

 arch/arm/mach-s3c2416/s3c2416.c               |    2 +
 arch/arm/mach-s3c2443/s3c2443.c               |    2 +
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   81 +++++++++++++------------
 arch/arm/plat-samsung/include/plat/rtc-core.h |   27 ++++++++
 drivers/rtc/rtc-s3c.c                         |   71 ++++++++++++++++++----
 5 files changed, 131 insertions(+), 52 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/rtc-core.h

-- 
1.7.5.4

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

* [PATCH v4 0/4] Implement RTC support for S3C2443/S3C2416/S3C2450
@ 2012-01-04 14:14           ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

Similar to the ADC the RTC of S3C2443 and S3C2416/2450 has some slight
variances when compared to the existing types.

This series adds support for those SoCs.

As with the ADC patches, these changes where tested on S3C2416 hardware.
The S3C2443 quirks are a subset of those and are done according to the
datasheet, but not tested on real hardware (as I do not own a S3C2443 device).

changes since v3:
fixes missing "," in s3c_rtc_dt_match and wrong handling of the
of_device_id.data property, as reported-by Sylwester Nawrocki

changes since v2:
remove obsolete constants in register cleanup

changes since v1:
address comments from Thomas Abraham, reducing number of ifdefs and
duplicate code


Heiko Stuebner (4):
  ARM: SAMSUNG: cleanup of rtc register definitions
  rtc-s3c: make room for more variants in devicetree block
  rtc-s3c: add variants for S3C2443 and S3C2416
  ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices

 arch/arm/mach-s3c2416/s3c2416.c               |    2 +
 arch/arm/mach-s3c2443/s3c2443.c               |    2 +
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   81 +++++++++++++------------
 arch/arm/plat-samsung/include/plat/rtc-core.h |   27 ++++++++
 drivers/rtc/rtc-s3c.c                         |   71 ++++++++++++++++++----
 5 files changed, 131 insertions(+), 52 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/rtc-core.h

-- 
1.7.5.4

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

* [PATCH 1/4] ARM: SAMSUNG: cleanup of rtc register definitions
  2012-01-04 14:14           ` Heiko Stübner
@ 2012-01-04 14:15             ` Heiko Stübner
  -1 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:15 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Sylwester Nawrocki, ben-linux, a.zummo, linux-samsung-soc,
	linux-arm-kernel, rtc-linux

regs-rtc.h uses a mixture of tabs and spaces and also (x<<y)
to format bits. So, before adding new stuff clean up the formatting
and also add spaces to the bit definitions (i.e. (x << y) )

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   78 ++++++++++---------------
 1 files changed, 32 insertions(+), 46 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index 30b7cc1..a7d944f 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -18,51 +18,37 @@
 #define S3C2410_INTP_ALM	(1 << 1)
 #define S3C2410_INTP_TIC	(1 << 0)
 
-#define S3C2410_RTCCON	      S3C2410_RTCREG(0x40)
-#define S3C2410_RTCCON_RTCEN  (1<<0)
-#define S3C2410_RTCCON_CLKSEL (1<<1)
-#define S3C2410_RTCCON_CNTSEL (1<<2)
-#define S3C2410_RTCCON_CLKRST (1<<3)
-#define S3C64XX_RTCCON_TICEN  (1<<8)
-
-#define S3C64XX_RTCCON_TICMSK (0xF<<7)
-#define S3C64XX_RTCCON_TICSHT (7)
-
-#define S3C2410_TICNT	      S3C2410_RTCREG(0x44)
-#define S3C2410_TICNT_ENABLE  (1<<7)
-
-#define S3C2410_RTCALM	      S3C2410_RTCREG(0x50)
-#define S3C2410_RTCALM_ALMEN  (1<<6)
-#define S3C2410_RTCALM_YEAREN (1<<5)
-#define S3C2410_RTCALM_MONEN  (1<<4)
-#define S3C2410_RTCALM_DAYEN  (1<<3)
-#define S3C2410_RTCALM_HOUREN (1<<2)
-#define S3C2410_RTCALM_MINEN  (1<<1)
-#define S3C2410_RTCALM_SECEN  (1<<0)
-
-#define S3C2410_RTCALM_ALL \
-  S3C2410_RTCALM_ALMEN | S3C2410_RTCALM_YEAREN | S3C2410_RTCALM_MONEN |\
-  S3C2410_RTCALM_DAYEN | S3C2410_RTCALM_HOUREN | S3C2410_RTCALM_MINEN |\
-  S3C2410_RTCALM_SECEN
-
-
-#define S3C2410_ALMSEC	      S3C2410_RTCREG(0x54)
-#define S3C2410_ALMMIN	      S3C2410_RTCREG(0x58)
-#define S3C2410_ALMHOUR	      S3C2410_RTCREG(0x5c)
-
-#define S3C2410_ALMDATE	      S3C2410_RTCREG(0x60)
-#define S3C2410_ALMMON	      S3C2410_RTCREG(0x64)
-#define S3C2410_ALMYEAR	      S3C2410_RTCREG(0x68)
-
-#define S3C2410_RTCRST	      S3C2410_RTCREG(0x6c)
-
-#define S3C2410_RTCSEC	      S3C2410_RTCREG(0x70)
-#define S3C2410_RTCMIN	      S3C2410_RTCREG(0x74)
-#define S3C2410_RTCHOUR	      S3C2410_RTCREG(0x78)
-#define S3C2410_RTCDATE	      S3C2410_RTCREG(0x7c)
-#define S3C2410_RTCDAY	      S3C2410_RTCREG(0x80)
-#define S3C2410_RTCMON	      S3C2410_RTCREG(0x84)
-#define S3C2410_RTCYEAR	      S3C2410_RTCREG(0x88)
-
+#define S3C2410_RTCCON		S3C2410_RTCREG(0x40)
+#define S3C2410_RTCCON_RTCEN	(1 << 0)
+#define S3C2410_RTCCON_CNTSEL	(1 << 2)
+#define S3C2410_RTCCON_CLKRST	(1 << 3)
+#define S3C64XX_RTCCON_TICEN	(1 << 8)
+
+#define S3C2410_TICNT		S3C2410_RTCREG(0x44)
+#define S3C2410_TICNT_ENABLE	(1 << 7)
+
+#define S3C2410_RTCALM		S3C2410_RTCREG(0x50)
+#define S3C2410_RTCALM_ALMEN	(1 << 6)
+#define S3C2410_RTCALM_YEAREN	(1 << 5)
+#define S3C2410_RTCALM_MONEN	(1 << 4)
+#define S3C2410_RTCALM_DAYEN	(1 << 3)
+#define S3C2410_RTCALM_HOUREN	(1 << 2)
+#define S3C2410_RTCALM_MINEN	(1 << 1)
+#define S3C2410_RTCALM_SECEN	(1 << 0)
+
+#define S3C2410_ALMSEC		S3C2410_RTCREG(0x54)
+#define S3C2410_ALMMIN		S3C2410_RTCREG(0x58)
+#define S3C2410_ALMHOUR		S3C2410_RTCREG(0x5c)
+
+#define S3C2410_ALMDATE		S3C2410_RTCREG(0x60)
+#define S3C2410_ALMMON		S3C2410_RTCREG(0x64)
+#define S3C2410_ALMYEAR		S3C2410_RTCREG(0x68)
+
+#define S3C2410_RTCSEC		S3C2410_RTCREG(0x70)
+#define S3C2410_RTCMIN		S3C2410_RTCREG(0x74)
+#define S3C2410_RTCHOUR		S3C2410_RTCREG(0x78)
+#define S3C2410_RTCDATE		S3C2410_RTCREG(0x7c)
+#define S3C2410_RTCMON		S3C2410_RTCREG(0x84)
+#define S3C2410_RTCYEAR		S3C2410_RTCREG(0x88)
 
 #endif /* __ASM_ARCH_REGS_RTC_H */
-- 
1.7.5.4

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

* [PATCH 1/4] ARM: SAMSUNG: cleanup of rtc register definitions
@ 2012-01-04 14:15             ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:15 UTC (permalink / raw)
  To: linux-arm-kernel

regs-rtc.h uses a mixture of tabs and spaces and also (x<<y)
to format bits. So, before adding new stuff clean up the formatting
and also add spaces to the bit definitions (i.e. (x << y) )

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   78 ++++++++++---------------
 1 files changed, 32 insertions(+), 46 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index 30b7cc1..a7d944f 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -18,51 +18,37 @@
 #define S3C2410_INTP_ALM	(1 << 1)
 #define S3C2410_INTP_TIC	(1 << 0)
 
-#define S3C2410_RTCCON	      S3C2410_RTCREG(0x40)
-#define S3C2410_RTCCON_RTCEN  (1<<0)
-#define S3C2410_RTCCON_CLKSEL (1<<1)
-#define S3C2410_RTCCON_CNTSEL (1<<2)
-#define S3C2410_RTCCON_CLKRST (1<<3)
-#define S3C64XX_RTCCON_TICEN  (1<<8)
-
-#define S3C64XX_RTCCON_TICMSK (0xF<<7)
-#define S3C64XX_RTCCON_TICSHT (7)
-
-#define S3C2410_TICNT	      S3C2410_RTCREG(0x44)
-#define S3C2410_TICNT_ENABLE  (1<<7)
-
-#define S3C2410_RTCALM	      S3C2410_RTCREG(0x50)
-#define S3C2410_RTCALM_ALMEN  (1<<6)
-#define S3C2410_RTCALM_YEAREN (1<<5)
-#define S3C2410_RTCALM_MONEN  (1<<4)
-#define S3C2410_RTCALM_DAYEN  (1<<3)
-#define S3C2410_RTCALM_HOUREN (1<<2)
-#define S3C2410_RTCALM_MINEN  (1<<1)
-#define S3C2410_RTCALM_SECEN  (1<<0)
-
-#define S3C2410_RTCALM_ALL \
-  S3C2410_RTCALM_ALMEN | S3C2410_RTCALM_YEAREN | S3C2410_RTCALM_MONEN |\
-  S3C2410_RTCALM_DAYEN | S3C2410_RTCALM_HOUREN | S3C2410_RTCALM_MINEN |\
-  S3C2410_RTCALM_SECEN
-
-
-#define S3C2410_ALMSEC	      S3C2410_RTCREG(0x54)
-#define S3C2410_ALMMIN	      S3C2410_RTCREG(0x58)
-#define S3C2410_ALMHOUR	      S3C2410_RTCREG(0x5c)
-
-#define S3C2410_ALMDATE	      S3C2410_RTCREG(0x60)
-#define S3C2410_ALMMON	      S3C2410_RTCREG(0x64)
-#define S3C2410_ALMYEAR	      S3C2410_RTCREG(0x68)
-
-#define S3C2410_RTCRST	      S3C2410_RTCREG(0x6c)
-
-#define S3C2410_RTCSEC	      S3C2410_RTCREG(0x70)
-#define S3C2410_RTCMIN	      S3C2410_RTCREG(0x74)
-#define S3C2410_RTCHOUR	      S3C2410_RTCREG(0x78)
-#define S3C2410_RTCDATE	      S3C2410_RTCREG(0x7c)
-#define S3C2410_RTCDAY	      S3C2410_RTCREG(0x80)
-#define S3C2410_RTCMON	      S3C2410_RTCREG(0x84)
-#define S3C2410_RTCYEAR	      S3C2410_RTCREG(0x88)
-
+#define S3C2410_RTCCON		S3C2410_RTCREG(0x40)
+#define S3C2410_RTCCON_RTCEN	(1 << 0)
+#define S3C2410_RTCCON_CNTSEL	(1 << 2)
+#define S3C2410_RTCCON_CLKRST	(1 << 3)
+#define S3C64XX_RTCCON_TICEN	(1 << 8)
+
+#define S3C2410_TICNT		S3C2410_RTCREG(0x44)
+#define S3C2410_TICNT_ENABLE	(1 << 7)
+
+#define S3C2410_RTCALM		S3C2410_RTCREG(0x50)
+#define S3C2410_RTCALM_ALMEN	(1 << 6)
+#define S3C2410_RTCALM_YEAREN	(1 << 5)
+#define S3C2410_RTCALM_MONEN	(1 << 4)
+#define S3C2410_RTCALM_DAYEN	(1 << 3)
+#define S3C2410_RTCALM_HOUREN	(1 << 2)
+#define S3C2410_RTCALM_MINEN	(1 << 1)
+#define S3C2410_RTCALM_SECEN	(1 << 0)
+
+#define S3C2410_ALMSEC		S3C2410_RTCREG(0x54)
+#define S3C2410_ALMMIN		S3C2410_RTCREG(0x58)
+#define S3C2410_ALMHOUR		S3C2410_RTCREG(0x5c)
+
+#define S3C2410_ALMDATE		S3C2410_RTCREG(0x60)
+#define S3C2410_ALMMON		S3C2410_RTCREG(0x64)
+#define S3C2410_ALMYEAR		S3C2410_RTCREG(0x68)
+
+#define S3C2410_RTCSEC		S3C2410_RTCREG(0x70)
+#define S3C2410_RTCMIN		S3C2410_RTCREG(0x74)
+#define S3C2410_RTCHOUR		S3C2410_RTCREG(0x78)
+#define S3C2410_RTCDATE		S3C2410_RTCREG(0x7c)
+#define S3C2410_RTCMON		S3C2410_RTCREG(0x84)
+#define S3C2410_RTCYEAR		S3C2410_RTCREG(0x88)
 
 #endif /* __ASM_ARCH_REGS_RTC_H */
-- 
1.7.5.4

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

* [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
  2012-01-04 14:14           ` Heiko Stübner
@ 2012-01-04 14:16             ` Heiko Stübner
  -1 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:16 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Sylwester Nawrocki, ben-linux, a.zummo, linux-samsung-soc,
	linux-arm-kernel, rtc-linux

Use the data field of of_device_id to hold the type for
s3c_cpu_type.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 drivers/rtc/rtc-s3c.c |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 175067a..dc0f65e 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -428,6 +428,20 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)
 	return 0;
 }
 
+static const struct of_device_id s3c_rtc_dt_match[];
+
+static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
+{
+#ifdef CONFIG_OF
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
+		return (int)match->data;
+	}
+#endif
+	return platform_get_device_id(pdev)->driver_data;
+}
+
 static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 {
 	struct rtc_device *rtc;
@@ -508,13 +522,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 		goto err_nortc;
 	}
 
-#ifdef CONFIG_OF
-	if (pdev->dev.of_node)
-		s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node,
-			"samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410;
-	else
-#endif
-		s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
+	s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev);
 
 	/* Check RTC Time */
 
@@ -638,8 +646,13 @@ static int s3c_rtc_resume(struct platform_device *pdev)
 
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_rtc_dt_match[] = {
-	{ .compatible = "samsung,s3c2410-rtc" },
-	{ .compatible = "samsung,s3c6410-rtc" },
+	{
+		.compatible = "samsung,s3c2410-rtc",
+		.data = (void *)TYPE_S3C2410,
+	}, {
+		.compatible = "samsung,s3c6410-rtc",
+		.data = (void *)TYPE_S3C64XX,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);
-- 
1.7.5.4

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

* [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
@ 2012-01-04 14:16             ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:16 UTC (permalink / raw)
  To: linux-arm-kernel

Use the data field of of_device_id to hold the type for
s3c_cpu_type.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 drivers/rtc/rtc-s3c.c |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 175067a..dc0f65e 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -428,6 +428,20 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)
 	return 0;
 }
 
+static const struct of_device_id s3c_rtc_dt_match[];
+
+static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
+{
+#ifdef CONFIG_OF
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
+		return (int)match->data;
+	}
+#endif
+	return platform_get_device_id(pdev)->driver_data;
+}
+
 static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 {
 	struct rtc_device *rtc;
@@ -508,13 +522,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 		goto err_nortc;
 	}
 
-#ifdef CONFIG_OF
-	if (pdev->dev.of_node)
-		s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node,
-			"samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410;
-	else
-#endif
-		s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
+	s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev);
 
 	/* Check RTC Time */
 
@@ -638,8 +646,13 @@ static int s3c_rtc_resume(struct platform_device *pdev)
 
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_rtc_dt_match[] = {
-	{ .compatible = "samsung,s3c2410-rtc" },
-	{ .compatible = "samsung,s3c6410-rtc" },
+	{
+		.compatible = "samsung,s3c2410-rtc",
+		.data = (void *)TYPE_S3C2410,
+	}, {
+		.compatible = "samsung,s3c6410-rtc",
+		.data = (void *)TYPE_S3C64XX,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);
-- 
1.7.5.4

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

* [PATCH 3/4] rtc-s3c: add variants for S3C2443 and S3C2416
  2012-01-04 14:14           ` Heiko Stübner
@ 2012-01-04 14:16             ` Heiko Stübner
  -1 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:16 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Sylwester Nawrocki, ben-linux, a.zummo, linux-samsung-soc,
	linux-arm-kernel, rtc-linux

Especially the TICNT registers are different from the two rtc
types that currently exists.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   17 ++++++++++
 drivers/rtc/rtc-s3c.c                         |   40 ++++++++++++++++++++++--
 2 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index a7d944f..0f8263e 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -22,11 +22,28 @@
 #define S3C2410_RTCCON_RTCEN	(1 << 0)
 #define S3C2410_RTCCON_CNTSEL	(1 << 2)
 #define S3C2410_RTCCON_CLKRST	(1 << 3)
+#define S3C2443_RTCCON_TICSEL	(1 << 4)
 #define S3C64XX_RTCCON_TICEN	(1 << 8)
 
 #define S3C2410_TICNT		S3C2410_RTCREG(0x44)
 #define S3C2410_TICNT_ENABLE	(1 << 7)
 
+/* S3C2443: tick count is 15 bit wide
+ * TICNT[6:0] contains upper 7 bits
+ * TICNT1[7:0] contains lower 8 bits
+ */
+#define S3C2443_TICNT_PART(x)	((x & 0x7f00) >> 8)
+#define S3C2443_TICNT1		S3C2410_RTCREG(0x4C)
+#define S3C2443_TICNT1_PART(x)	(x & 0xff)
+
+/* S3C2416: tick count is 32 bit wide
+ * TICNT[6:0] contains bits [14:8]
+ * TICNT1[7:0] contains lower 8 bits
+ * TICNT2[16:0] contains upper 17 bits
+ */
+#define S3C2416_TICNT2		S3C2410_RTCREG(0x48)
+#define S3C2416_TICNT2_PART(x)	((x & 0xffff8000) >> 15)
+
 #define S3C2410_RTCALM		S3C2410_RTCREG(0x50)
 #define S3C2410_RTCALM_ALMEN	(1 << 6)
 #define S3C2410_RTCALM_YEAREN	(1 << 5)
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index dc0f65e..2b4feb8 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -35,6 +35,8 @@
 
 enum s3c_cpu_type {
 	TYPE_S3C2410,
+	TYPE_S3C2416,
+	TYPE_S3C2443,
 	TYPE_S3C64XX,
 };
 
@@ -132,6 +134,7 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct rtc_device *rtc_dev = platform_get_drvdata(pdev);
 	unsigned int tmp = 0;
+	int val;
 
 	if (!is_power_of_2(freq))
 		return -EINVAL;
@@ -139,12 +142,22 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
 	clk_enable(rtc_clk);
 	spin_lock_irq(&s3c_rtc_pie_lock);
 
-	if (s3c_rtc_cpu_type == TYPE_S3C2410) {
+	if (s3c_rtc_cpu_type != TYPE_S3C64XX) {
 		tmp = readb(s3c_rtc_base + S3C2410_TICNT);
 		tmp &= S3C2410_TICNT_ENABLE;
 	}
 
-	tmp |= (rtc_dev->max_user_freq / freq)-1;
+	val = (rtc_dev->max_user_freq / freq) - 1;
+
+	if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == TYPE_S3C2443) {
+		tmp |= S3C2443_TICNT_PART(val);
+		writel(S3C2443_TICNT1_PART(val), s3c_rtc_base + S3C2443_TICNT1);
+
+		if (s3c_rtc_cpu_type == TYPE_S3C2416)
+			writel(S3C2416_TICNT2_PART(val), s3c_rtc_base + S3C2416_TICNT2);
+	} else {
+		tmp |= val;
+	}
 
 	writel(tmp, s3c_rtc_base + S3C2410_TICNT);
 	spin_unlock_irq(&s3c_rtc_pie_lock);
@@ -371,7 +384,7 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en)
 		tmp &= ~S3C2410_RTCCON_RTCEN;
 		writew(tmp, base + S3C2410_RTCCON);
 
-		if (s3c_rtc_cpu_type == TYPE_S3C2410) {
+		if (s3c_rtc_cpu_type != TYPE_S3C64XX) {
 			tmp = readb(base + S3C2410_TICNT);
 			tmp &= ~S3C2410_TICNT_ENABLE;
 			writeb(tmp, base + S3C2410_TICNT);
@@ -448,6 +461,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 	struct rtc_time rtc_tm;
 	struct resource *res;
 	int ret;
+	int tmp;
 
 	pr_debug("%s: probe=%p\n", __func__, pdev);
 
@@ -541,11 +555,17 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 		dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n");
 	}
 
-	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+	if (s3c_rtc_cpu_type != TYPE_S3C2410)
 		rtc->max_user_freq = 32768;
 	else
 		rtc->max_user_freq = 128;
 
+	if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == TYPE_S3C2443) {
+		tmp = readw(s3c_rtc_base + S3C2410_RTCCON);
+		tmp |= S3C2443_RTCCON_TICSEL;
+		writew(tmp, s3c_rtc_base + S3C2410_RTCCON);
+	}
+
 	platform_set_drvdata(pdev, rtc);
 
 	s3c_rtc_setfreq(&pdev->dev, 1);
@@ -650,6 +670,12 @@ static const struct of_device_id s3c_rtc_dt_match[] = {
 		.compatible = "samsung,s3c2410-rtc",
 		.data = (void *)TYPE_S3C2410,
 	}, {
+		.compatible = "samsung,s3c2416-rtc",
+		.data = (void *)TYPE_S3C2416,
+	}, {
+		.compatible = "samsung,s3c2443-rtc",
+		.data = (void *)TYPE_S3C2443,
+	}, {
 		.compatible = "samsung,s3c6410-rtc",
 		.data = (void *)TYPE_S3C64XX,
 	},
@@ -665,6 +691,12 @@ static struct platform_device_id s3c_rtc_driver_ids[] = {
 		.name		= "s3c2410-rtc",
 		.driver_data	= TYPE_S3C2410,
 	}, {
+		.name		= "s3c2416-rtc",
+		.driver_data	= TYPE_S3C2416,
+	}, {
+		.name		= "s3c2443-rtc",
+		.driver_data	= TYPE_S3C2443,
+	}, {
 		.name		= "s3c64xx-rtc",
 		.driver_data	= TYPE_S3C64XX,
 	},
-- 
1.7.5.4

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

* [PATCH 3/4] rtc-s3c: add variants for S3C2443 and S3C2416
@ 2012-01-04 14:16             ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:16 UTC (permalink / raw)
  To: linux-arm-kernel

Especially the TICNT registers are different from the two rtc
types that currently exists.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   17 ++++++++++
 drivers/rtc/rtc-s3c.c                         |   40 ++++++++++++++++++++++--
 2 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index a7d944f..0f8263e 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -22,11 +22,28 @@
 #define S3C2410_RTCCON_RTCEN	(1 << 0)
 #define S3C2410_RTCCON_CNTSEL	(1 << 2)
 #define S3C2410_RTCCON_CLKRST	(1 << 3)
+#define S3C2443_RTCCON_TICSEL	(1 << 4)
 #define S3C64XX_RTCCON_TICEN	(1 << 8)
 
 #define S3C2410_TICNT		S3C2410_RTCREG(0x44)
 #define S3C2410_TICNT_ENABLE	(1 << 7)
 
+/* S3C2443: tick count is 15 bit wide
+ * TICNT[6:0] contains upper 7 bits
+ * TICNT1[7:0] contains lower 8 bits
+ */
+#define S3C2443_TICNT_PART(x)	((x & 0x7f00) >> 8)
+#define S3C2443_TICNT1		S3C2410_RTCREG(0x4C)
+#define S3C2443_TICNT1_PART(x)	(x & 0xff)
+
+/* S3C2416: tick count is 32 bit wide
+ * TICNT[6:0] contains bits [14:8]
+ * TICNT1[7:0] contains lower 8 bits
+ * TICNT2[16:0] contains upper 17 bits
+ */
+#define S3C2416_TICNT2		S3C2410_RTCREG(0x48)
+#define S3C2416_TICNT2_PART(x)	((x & 0xffff8000) >> 15)
+
 #define S3C2410_RTCALM		S3C2410_RTCREG(0x50)
 #define S3C2410_RTCALM_ALMEN	(1 << 6)
 #define S3C2410_RTCALM_YEAREN	(1 << 5)
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index dc0f65e..2b4feb8 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -35,6 +35,8 @@
 
 enum s3c_cpu_type {
 	TYPE_S3C2410,
+	TYPE_S3C2416,
+	TYPE_S3C2443,
 	TYPE_S3C64XX,
 };
 
@@ -132,6 +134,7 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct rtc_device *rtc_dev = platform_get_drvdata(pdev);
 	unsigned int tmp = 0;
+	int val;
 
 	if (!is_power_of_2(freq))
 		return -EINVAL;
@@ -139,12 +142,22 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
 	clk_enable(rtc_clk);
 	spin_lock_irq(&s3c_rtc_pie_lock);
 
-	if (s3c_rtc_cpu_type == TYPE_S3C2410) {
+	if (s3c_rtc_cpu_type != TYPE_S3C64XX) {
 		tmp = readb(s3c_rtc_base + S3C2410_TICNT);
 		tmp &= S3C2410_TICNT_ENABLE;
 	}
 
-	tmp |= (rtc_dev->max_user_freq / freq)-1;
+	val = (rtc_dev->max_user_freq / freq) - 1;
+
+	if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == TYPE_S3C2443) {
+		tmp |= S3C2443_TICNT_PART(val);
+		writel(S3C2443_TICNT1_PART(val), s3c_rtc_base + S3C2443_TICNT1);
+
+		if (s3c_rtc_cpu_type == TYPE_S3C2416)
+			writel(S3C2416_TICNT2_PART(val), s3c_rtc_base + S3C2416_TICNT2);
+	} else {
+		tmp |= val;
+	}
 
 	writel(tmp, s3c_rtc_base + S3C2410_TICNT);
 	spin_unlock_irq(&s3c_rtc_pie_lock);
@@ -371,7 +384,7 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en)
 		tmp &= ~S3C2410_RTCCON_RTCEN;
 		writew(tmp, base + S3C2410_RTCCON);
 
-		if (s3c_rtc_cpu_type == TYPE_S3C2410) {
+		if (s3c_rtc_cpu_type != TYPE_S3C64XX) {
 			tmp = readb(base + S3C2410_TICNT);
 			tmp &= ~S3C2410_TICNT_ENABLE;
 			writeb(tmp, base + S3C2410_TICNT);
@@ -448,6 +461,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 	struct rtc_time rtc_tm;
 	struct resource *res;
 	int ret;
+	int tmp;
 
 	pr_debug("%s: probe=%p\n", __func__, pdev);
 
@@ -541,11 +555,17 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 		dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n");
 	}
 
-	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+	if (s3c_rtc_cpu_type != TYPE_S3C2410)
 		rtc->max_user_freq = 32768;
 	else
 		rtc->max_user_freq = 128;
 
+	if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == TYPE_S3C2443) {
+		tmp = readw(s3c_rtc_base + S3C2410_RTCCON);
+		tmp |= S3C2443_RTCCON_TICSEL;
+		writew(tmp, s3c_rtc_base + S3C2410_RTCCON);
+	}
+
 	platform_set_drvdata(pdev, rtc);
 
 	s3c_rtc_setfreq(&pdev->dev, 1);
@@ -650,6 +670,12 @@ static const struct of_device_id s3c_rtc_dt_match[] = {
 		.compatible = "samsung,s3c2410-rtc",
 		.data = (void *)TYPE_S3C2410,
 	}, {
+		.compatible = "samsung,s3c2416-rtc",
+		.data = (void *)TYPE_S3C2416,
+	}, {
+		.compatible = "samsung,s3c2443-rtc",
+		.data = (void *)TYPE_S3C2443,
+	}, {
 		.compatible = "samsung,s3c6410-rtc",
 		.data = (void *)TYPE_S3C64XX,
 	},
@@ -665,6 +691,12 @@ static struct platform_device_id s3c_rtc_driver_ids[] = {
 		.name		= "s3c2410-rtc",
 		.driver_data	= TYPE_S3C2410,
 	}, {
+		.name		= "s3c2416-rtc",
+		.driver_data	= TYPE_S3C2416,
+	}, {
+		.name		= "s3c2443-rtc",
+		.driver_data	= TYPE_S3C2443,
+	}, {
 		.name		= "s3c64xx-rtc",
 		.driver_data	= TYPE_S3C64XX,
 	},
-- 
1.7.5.4

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

* [PATCH 4/4] ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices
  2012-01-04 14:14           ` Heiko Stübner
@ 2012-01-04 14:17             ` Heiko Stübner
  -1 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:17 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Sylwester Nawrocki, ben-linux, a.zummo, linux-samsung-soc,
	linux-arm-kernel, rtc-linux

As the S3C24xx SoCs use the same rtc device a renaming capability like in
the adc driver is necessary.

This patch adds a s3c_rtc_setname function and names the rtc devices for
S3C2443 and S3C2416 accordingly.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 arch/arm/mach-s3c2416/s3c2416.c               |    2 +
 arch/arm/mach-s3c2443/s3c2443.c               |    2 +
 arch/arm/plat-samsung/include/plat/rtc-core.h |   27 +++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/rtc-core.h

diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c
index ee214bc..604cf98 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c2416/s3c2416.c
@@ -61,6 +61,7 @@
 #include <plat/fb-core.h>
 #include <plat/nand-core.h>
 #include <plat/adc-core.h>
+#include <plat/rtc-core.h>
 
 static struct map_desc s3c2416_iodesc[] __initdata = {
 	IODESC_ENT(WATCHDOG),
@@ -99,6 +100,7 @@ int __init s3c2416_init(void)
 	s3c_fb_setname("s3c2443-fb");
 
 	s3c_adc_setname("s3c2416-adc");
+	s3c_rtc_setname("s3c2416-rtc");
 
 #ifdef CONFIG_PM
 	register_syscore_ops(&s3c2416_pm_syscore_ops);
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c
index a22b771..9e6be20 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c2443/s3c2443.c
@@ -42,6 +42,7 @@
 #include <plat/fb-core.h>
 #include <plat/nand-core.h>
 #include <plat/adc-core.h>
+#include <plat/rtc-core.h>
 
 static struct map_desc s3c2443_iodesc[] __initdata = {
 	IODESC_ENT(WATCHDOG),
@@ -72,6 +73,7 @@ int __init s3c2443_init(void)
 	s3c_fb_setname("s3c2443-fb");
 
 	s3c_adc_setname("s3c2443-adc");
+	s3c_rtc_setname("s3c2443-rtc");
 
 	/* change WDT IRQ number */
 	s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
diff --git a/arch/arm/plat-samsung/include/plat/rtc-core.h b/arch/arm/plat-samsung/include/plat/rtc-core.h
new file mode 100644
index 0000000..21d8594
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/rtc-core.h
@@ -0,0 +1,27 @@
+/* linux/arch/arm/plat-samsung/include/plat/rtc-core.h
+ *
+ * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de>
+ *
+ * Samsung RTC Controller core functions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_PLAT_RTC_CORE_H
+#define __ASM_PLAT_RTC_CORE_H __FILE__
+
+/* These functions are only for use with the core support code, such as
+ * the cpu specific initialisation code
+ */
+
+/* re-define device name depending on support. */
+static inline void s3c_rtc_setname(char *name)
+{
+#if defined(CONFIG_SAMSUNG_DEV_RTC) || defined(CONFIG_PLAT_S3C24XX)
+	s3c_device_rtc.name = name;
+#endif
+}
+
+#endif /* __ASM_PLAT_RTC_CORE_H */
-- 
1.7.5.4

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

* [PATCH 4/4] ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices
@ 2012-01-04 14:17             ` Heiko Stübner
  0 siblings, 0 replies; 34+ messages in thread
From: Heiko Stübner @ 2012-01-04 14:17 UTC (permalink / raw)
  To: linux-arm-kernel

As the S3C24xx SoCs use the same rtc device a renaming capability like in
the adc driver is necessary.

This patch adds a s3c_rtc_setname function and names the rtc devices for
S3C2443 and S3C2416 accordingly.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 arch/arm/mach-s3c2416/s3c2416.c               |    2 +
 arch/arm/mach-s3c2443/s3c2443.c               |    2 +
 arch/arm/plat-samsung/include/plat/rtc-core.h |   27 +++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/rtc-core.h

diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c
index ee214bc..604cf98 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c2416/s3c2416.c
@@ -61,6 +61,7 @@
 #include <plat/fb-core.h>
 #include <plat/nand-core.h>
 #include <plat/adc-core.h>
+#include <plat/rtc-core.h>
 
 static struct map_desc s3c2416_iodesc[] __initdata = {
 	IODESC_ENT(WATCHDOG),
@@ -99,6 +100,7 @@ int __init s3c2416_init(void)
 	s3c_fb_setname("s3c2443-fb");
 
 	s3c_adc_setname("s3c2416-adc");
+	s3c_rtc_setname("s3c2416-rtc");
 
 #ifdef CONFIG_PM
 	register_syscore_ops(&s3c2416_pm_syscore_ops);
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c
index a22b771..9e6be20 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c2443/s3c2443.c
@@ -42,6 +42,7 @@
 #include <plat/fb-core.h>
 #include <plat/nand-core.h>
 #include <plat/adc-core.h>
+#include <plat/rtc-core.h>
 
 static struct map_desc s3c2443_iodesc[] __initdata = {
 	IODESC_ENT(WATCHDOG),
@@ -72,6 +73,7 @@ int __init s3c2443_init(void)
 	s3c_fb_setname("s3c2443-fb");
 
 	s3c_adc_setname("s3c2443-adc");
+	s3c_rtc_setname("s3c2443-rtc");
 
 	/* change WDT IRQ number */
 	s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
diff --git a/arch/arm/plat-samsung/include/plat/rtc-core.h b/arch/arm/plat-samsung/include/plat/rtc-core.h
new file mode 100644
index 0000000..21d8594
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/rtc-core.h
@@ -0,0 +1,27 @@
+/* linux/arch/arm/plat-samsung/include/plat/rtc-core.h
+ *
+ * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de>
+ *
+ * Samsung RTC Controller core functions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_PLAT_RTC_CORE_H
+#define __ASM_PLAT_RTC_CORE_H __FILE__
+
+/* These functions are only for use with the core support code, such as
+ * the cpu specific initialisation code
+ */
+
+/* re-define device name depending on support. */
+static inline void s3c_rtc_setname(char *name)
+{
+#if defined(CONFIG_SAMSUNG_DEV_RTC) || defined(CONFIG_PLAT_S3C24XX)
+	s3c_device_rtc.name = name;
+#endif
+}
+
+#endif /* __ASM_PLAT_RTC_CORE_H */
-- 
1.7.5.4

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

* Re: [PATCH 1/4] ARM: SAMSUNG: cleanup of rtc register definitions
  2012-01-04 14:15             ` Heiko Stübner
@ 2012-01-04 22:14               ` Russell King - ARM Linux
  -1 siblings, 0 replies; 34+ messages in thread
From: Russell King - ARM Linux @ 2012-01-04 22:14 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: Kukjin Kim, a.zummo, linux-samsung-soc, Sylwester Nawrocki,
	rtc-linux, ben-linux, linux-arm-kernel

On Wed, Jan 04, 2012 at 03:15:44PM +0100, Heiko Stübner wrote:
> regs-rtc.h uses a mixture of tabs and spaces and also (x<<y)
> to format bits. So, before adding new stuff clean up the formatting
> and also add spaces to the bit definitions (i.e. (x << y) )

Ok, so this is just a formatting change - and it should stay that way.

However, there's an opportunity missed here.

Are these register definitions used anywhere else other than in the
drivers/rtc driver?  If not, they should be placed along side that
driver or even inside the driver itself.

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

* [PATCH 1/4] ARM: SAMSUNG: cleanup of rtc register definitions
@ 2012-01-04 22:14               ` Russell King - ARM Linux
  0 siblings, 0 replies; 34+ messages in thread
From: Russell King - ARM Linux @ 2012-01-04 22:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 04, 2012 at 03:15:44PM +0100, Heiko St?bner wrote:
> regs-rtc.h uses a mixture of tabs and spaces and also (x<<y)
> to format bits. So, before adding new stuff clean up the formatting
> and also add spaces to the bit definitions (i.e. (x << y) )

Ok, so this is just a formatting change - and it should stay that way.

However, there's an opportunity missed here.

Are these register definitions used anywhere else other than in the
drivers/rtc driver?  If not, they should be placed along side that
driver or even inside the driver itself.

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

* RE: [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
  2012-01-04 14:12         ` Heiko Stübner
@ 2012-01-05  2:32           ` Kukjin Kim
  -1 siblings, 0 replies; 34+ messages in thread
From: Kukjin Kim @ 2012-01-05  2:32 UTC (permalink / raw)
  To: 'Heiko Stübner'
  Cc: 'Sylwester Nawrocki',
	ben-linux, a.zummo, linux-samsung-soc, linux-arm-kernel,
	rtc-linux

Heiko Stübner wrote:

> 
> Hi Kgene,
> 
> Am Mittwoch, 4. Januar 2012, 12:51:41 schrieb Heiko Stübner:
> > Hi Sylwester,
> >
> > Am Mittwoch, 4. Januar 2012, 11:43:45 schrieb Sylwester Nawrocki:
> > > Hello,
> > >
> > > On 12/21/2011 10:16 AM, Heiko Stübner wrote:
> > > > Use the data field of of_device_id to hold the type for
> > > > s3c_cpu_type.
> > > >
> > > > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > > > Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
> > > > ---
> > >
> > > This patch makes compilation with CONFIG_OF enabled fail with errors
> > > and warnings:
> > >
> > > drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_get_driver_data’:
> > > drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer
> > > without a cast
> > > drivers/rtc/rtc-s3c.c: At top level:
> > > drivers/rtc/rtc-s3c.c:674: error: request for member ‘data’ in
> something
> > > not a structure or union
> > > drivers/rtc/rtc-s3c.c:677: error: request for member ‘data’ in
> something
> > > not a structure or union
> > > drivers/rtc/rtc-s3c.c:680: error: request for member ‘data’ in
> something
> > > not a structure or union
> > > drivers/rtc/rtc-s3c.c:683: error: request for member ‘data’ in
> something
> > > not a structure or union
> > > make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1
> >
> > thanks for spotting this.
> >
> > @kgene: Should this go on top of the rtc series, or should I prepare a
> v4
> > with these fixes included?
> never mind, I did both.
> 
> In reply to this mail you will find:
> - a single patch on top of the 4 original patches, fixing the problems
> sylwester reported
> - a v4 of the original series including the fixes to the problems, based
> on
> the code that you have in your rtc-branch
> 
> Please pick the apropriate variant to fix the problem :-)
> 
OK, since it has been merged into arm-soc, I will send a single patch to
arm-soc.

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] 34+ messages in thread

* [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
@ 2012-01-05  2:32           ` Kukjin Kim
  0 siblings, 0 replies; 34+ messages in thread
From: Kukjin Kim @ 2012-01-05  2:32 UTC (permalink / raw)
  To: linux-arm-kernel

Heiko St?bner wrote:

> 
> Hi Kgene,
> 
> Am Mittwoch, 4. Januar 2012, 12:51:41 schrieb Heiko St?bner:
> > Hi Sylwester,
> >
> > Am Mittwoch, 4. Januar 2012, 11:43:45 schrieb Sylwester Nawrocki:
> > > Hello,
> > >
> > > On 12/21/2011 10:16 AM, Heiko St?bner wrote:
> > > > Use the data field of of_device_id to hold the type for
> > > > s3c_cpu_type.
> > > >
> > > > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > > > Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
> > > > ---
> > >
> > > This patch makes compilation with CONFIG_OF enabled fail with errors
> > > and warnings:
> > >
> > > drivers/rtc/rtc-s3c.c: In function ?s3c_rtc_get_driver_data?:
> > > drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer
> > > without a cast
> > > drivers/rtc/rtc-s3c.c: At top level:
> > > drivers/rtc/rtc-s3c.c:674: error: request for member ?data? in
> something
> > > not a structure or union
> > > drivers/rtc/rtc-s3c.c:677: error: request for member ?data? in
> something
> > > not a structure or union
> > > drivers/rtc/rtc-s3c.c:680: error: request for member ?data? in
> something
> > > not a structure or union
> > > drivers/rtc/rtc-s3c.c:683: error: request for member ?data? in
> something
> > > not a structure or union
> > > make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1
> >
> > thanks for spotting this.
> >
> > @kgene: Should this go on top of the rtc series, or should I prepare a
> v4
> > with these fixes included?
> never mind, I did both.
> 
> In reply to this mail you will find:
> - a single patch on top of the 4 original patches, fixing the problems
> sylwester reported
> - a v4 of the original series including the fixes to the problems, based
> on
> the code that you have in your rtc-branch
> 
> Please pick the apropriate variant to fix the problem :-)
> 
OK, since it has been merged into arm-soc, I will send a single patch to
arm-soc.

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] 34+ messages in thread

* RE: [PATCH] rtc-s3c: Fix breakage introduced by S3C2443/S3C2416 support
  2012-01-04 14:14           ` Heiko Stübner
@ 2012-01-05  2:32             ` Kukjin Kim
  -1 siblings, 0 replies; 34+ messages in thread
From: Kukjin Kim @ 2012-01-05  2:32 UTC (permalink / raw)
  To: 'Heiko Stübner', 'Arnd Bergmann'
  Cc: 'Sylwester Nawrocki',
	ben-linux, a.zummo, linux-samsung-soc, linux-arm-kernel,
	rtc-linux

Heiko Stübner wrote:
> 
> Commits 7006ee4f (rtc-s3c: make room for more variants in devicetree
block)
> and 6c0a2365 (rtc-s3c: add variants for S3C2443 and S3C2416)
> introduced build-failures with enabled CONFIG_USE_OF option.
> 
> This patch fixes missing "," in s3c_rtc_dt_match and wrong handling of
> the of_device_id.data property.
> 
> Reported-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Acked-by: Kukjin Kim <kgene.kim@samsung.com>

Arnd,
Could you please pick this up in your next/driver2 for samsung-rtc?

Thanks.

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

> ---
>  drivers/rtc/rtc-s3c.c |   18 +++++++++---------
>  1 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index bb0f320..2b4feb8 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -449,7 +449,7 @@ static inline int s3c_rtc_get_driver_data(struct
> platform_device *pdev)
>  	if (pdev->dev.of_node) {
>  		const struct of_device_id *match;
>  		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
> -		return match->data;
> +		return (int)match->data;
>  	}
>  #endif
>  	return platform_get_device_id(pdev)->driver_data;
> @@ -667,17 +667,17 @@ static int s3c_rtc_resume(struct platform_device
> *pdev)
>  #ifdef CONFIG_OF
>  static const struct of_device_id s3c_rtc_dt_match[] = {
>  	{
> -		.compatible = "samsung,s3c2410-rtc"
> -		.data = TYPE_S3C2410,
> +		.compatible = "samsung,s3c2410-rtc",
> +		.data = (void *)TYPE_S3C2410,
>  	}, {
> -		.compatible = "samsung,s3c2416-rtc"
> -		.data = TYPE_S3C2416,
> +		.compatible = "samsung,s3c2416-rtc",
> +		.data = (void *)TYPE_S3C2416,
>  	}, {
> -		.compatible = "samsung,s3c2443-rtc"
> -		.data = TYPE_S3C2443,
> +		.compatible = "samsung,s3c2443-rtc",
> +		.data = (void *)TYPE_S3C2443,
>  	}, {
> -		.compatible = "samsung,s3c6410-rtc"
> -		.data = TYPE_S3C64XX,
> +		.compatible = "samsung,s3c6410-rtc",
> +		.data = (void *)TYPE_S3C64XX,
>  	},
>  	{},
>  };
> --
> 1.7.5.4

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

* [PATCH] rtc-s3c: Fix breakage introduced by S3C2443/S3C2416 support
@ 2012-01-05  2:32             ` Kukjin Kim
  0 siblings, 0 replies; 34+ messages in thread
From: Kukjin Kim @ 2012-01-05  2:32 UTC (permalink / raw)
  To: linux-arm-kernel

Heiko St?bner wrote:
> 
> Commits 7006ee4f (rtc-s3c: make room for more variants in devicetree
block)
> and 6c0a2365 (rtc-s3c: add variants for S3C2443 and S3C2416)
> introduced build-failures with enabled CONFIG_USE_OF option.
> 
> This patch fixes missing "," in s3c_rtc_dt_match and wrong handling of
> the of_device_id.data property.
> 
> Reported-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Acked-by: Kukjin Kim <kgene.kim@samsung.com>

Arnd,
Could you please pick this up in your next/driver2 for samsung-rtc?

Thanks.

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

> ---
>  drivers/rtc/rtc-s3c.c |   18 +++++++++---------
>  1 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index bb0f320..2b4feb8 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -449,7 +449,7 @@ static inline int s3c_rtc_get_driver_data(struct
> platform_device *pdev)
>  	if (pdev->dev.of_node) {
>  		const struct of_device_id *match;
>  		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
> -		return match->data;
> +		return (int)match->data;
>  	}
>  #endif
>  	return platform_get_device_id(pdev)->driver_data;
> @@ -667,17 +667,17 @@ static int s3c_rtc_resume(struct platform_device
> *pdev)
>  #ifdef CONFIG_OF
>  static const struct of_device_id s3c_rtc_dt_match[] = {
>  	{
> -		.compatible = "samsung,s3c2410-rtc"
> -		.data = TYPE_S3C2410,
> +		.compatible = "samsung,s3c2410-rtc",
> +		.data = (void *)TYPE_S3C2410,
>  	}, {
> -		.compatible = "samsung,s3c2416-rtc"
> -		.data = TYPE_S3C2416,
> +		.compatible = "samsung,s3c2416-rtc",
> +		.data = (void *)TYPE_S3C2416,
>  	}, {
> -		.compatible = "samsung,s3c2443-rtc"
> -		.data = TYPE_S3C2443,
> +		.compatible = "samsung,s3c2443-rtc",
> +		.data = (void *)TYPE_S3C2443,
>  	}, {
> -		.compatible = "samsung,s3c6410-rtc"
> -		.data = TYPE_S3C64XX,
> +		.compatible = "samsung,s3c6410-rtc",
> +		.data = (void *)TYPE_S3C64XX,
>  	},
>  	{},
>  };
> --
> 1.7.5.4

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

end of thread, other threads:[~2012-01-05  2:32 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-21  9:14 [PATCH v3 0/4] Implement RTC support for S3C2443/S3C2416/S3C2450 Heiko Stübner
2011-12-21  9:14 ` Heiko Stübner
2011-12-21  9:16 ` [PATCH 1/4] ARM: SAMSUNG: cleanup of rtc register definitions Heiko Stübner
2011-12-21  9:16   ` Heiko Stübner
2011-12-21  9:16 ` [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block Heiko Stübner
2011-12-21  9:16   ` Heiko Stübner
2012-01-04 10:43   ` Sylwester Nawrocki
2012-01-04 10:43     ` Sylwester Nawrocki
2012-01-04 11:51     ` Heiko Stübner
2012-01-04 11:51       ` Heiko Stübner
2012-01-04 14:12       ` Heiko Stübner
2012-01-04 14:12         ` Heiko Stübner
2012-01-04 14:14         ` [PATCH] rtc-s3c: Fix breakage introduced by S3C2443/S3C2416 support Heiko Stübner
2012-01-04 14:14           ` Heiko Stübner
2012-01-05  2:32           ` Kukjin Kim
2012-01-05  2:32             ` Kukjin Kim
2012-01-04 14:14         ` [PATCH v4 0/4] Implement RTC support for S3C2443/S3C2416/S3C2450 Heiko Stübner
2012-01-04 14:14           ` Heiko Stübner
2012-01-04 14:15           ` [PATCH 1/4] ARM: SAMSUNG: cleanup of rtc register definitions Heiko Stübner
2012-01-04 14:15             ` Heiko Stübner
2012-01-04 22:14             ` Russell King - ARM Linux
2012-01-04 22:14               ` Russell King - ARM Linux
2012-01-04 14:16           ` [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block Heiko Stübner
2012-01-04 14:16             ` Heiko Stübner
2012-01-04 14:16           ` [PATCH 3/4] rtc-s3c: add variants for S3C2443 and S3C2416 Heiko Stübner
2012-01-04 14:16             ` Heiko Stübner
2012-01-04 14:17           ` [PATCH 4/4] ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices Heiko Stübner
2012-01-04 14:17             ` Heiko Stübner
2012-01-05  2:32         ` [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block Kukjin Kim
2012-01-05  2:32           ` Kukjin Kim
2011-12-21  9:17 ` [PATCH 3/4] rtc-s3c: add variants for S3C2443 and S3C2416 Heiko Stübner
2011-12-21  9:17   ` Heiko Stübner
2011-12-21  9:18 ` [PATCH 4/4] ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices Heiko Stübner
2011-12-21  9:18   ` Heiko Stübner

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.