Thread (5 messages) 5 messages, 3 authors, 2011-10-24

[PATCH] rtc: rtc-s3c: Add device tree support

From: Grant Likely <hidden>
Date: 2011-10-13 19:34:55
Also in: linux-devicetree, linux-samsung-soc

On Tue, Oct 11, 2011 at 07:48:07PM +0900, Kukjin Kim wrote:
Thomas Abraham wrote:
quoted
On 3 September 2011 21:19, Thomas Abraham [off-list ref]
wrote:
quoted
Add device tree based discovery support for Samsung's rtc controller.

Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Thomas Abraham <redacted>
---
?Documentation/devicetree/bindings/rtc/s3c-rtc.txt | ? 20
++++++++++++++++++++
quoted
?drivers/rtc/rtc-s3c.c ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 21
++++++++++++++++++++-
quoted
?2 files changed, 40 insertions(+), 1 deletions(-)
?create mode 100644 Documentation/devicetree/bindings/rtc/s3c-rtc.txt
Ping. Any comments for this patch? If this looks fine, can this be
considered for 3.2 merge via the Samsung kernel tree.
(Cc'ed Alessandro Zummo who is RTC Subsystem maintainer)

I'm ok with this, so if this can be got the ack from Grant and Alessandro,
will take this.
Acked-by: Grant Likely <redacted>
quoted
quoted
diff --git a/Documentation/devicetree/bindings/rtc/s3c-rtc.txt
b/Documentation/devicetree/bindings/rtc/s3c-rtc.txt
quoted
new file mode 100644
index 0000000..90ec45f
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/s3c-rtc.txt
@@ -0,0 +1,20 @@
+* Samsung's S3C Real Time Clock controller
+
+Required properties:
+- compatible: should be one of the following.
+ ? ?* "samsung,s3c2410-rtc" - for controllers compatible with s3c2410
rtc.
quoted
quoted
+ ? ?* "samsung,s3c6410-rtc" - for controllers compatible with s3c6410
rtc.
quoted
quoted
+- reg: physical base address of the controller and length of memory
mapped
quoted
quoted
+ ?region.
+- interrupts: Two interrupt numbers to the cpu should be specified.
First
quoted
quoted
+ ?interrupt number is the rtc alarm interupt and second interrupt
number
quoted
quoted
+ ?is the rtc tick interrupt. The number of cells representing a
interrupt
quoted
quoted
+ ?depends on the parent interrupt controller.
+
+Example:
+
+ ? ? ? rtc at 10070000 {
+ ? ? ? ? ? ? ? compatible = "samsung,s3c6410-rtc";
+ ? ? ? ? ? ? ? reg = <0x10070000 0x100>;
+ ? ? ? ? ? ? ? interrupts = <44 0 45 0>;
+ ? ? ? };
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 4e7c04e..29f928c 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -25,6 +25,7 @@
?#include <linux/clk.h>
?#include <linux/log2.h>
?#include <linux/slab.h>
+#include <linux/of.h>

?#include <mach/hardware.h>
?#include <asm/uaccess.h>
@@ -481,7 +482,13 @@ static int __devinit s3c_rtc_probe(struct
platform_device *pdev)
quoted
? ? ? ? ? ? ? ?goto err_nortc;
? ? ? ?}

- ? ? ? s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
+#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;
quoted
+ ? ? ? else
+#endif
+ ? ? ? ? ? ? ? s3c_rtc_cpu_type =
platform_get_device_id(pdev)->driver_data;
quoted
quoted
? ? ? ?/* Check RTC Time */
@@ -603,6 +610,17 @@ static int s3c_rtc_resume(struct platform_device
*pdev)
quoted
quoted
?#define s3c_rtc_resume ?NULL
?#endif

+#ifdef CONFIG_OF
+static const struct of_device_id s3c_rtc_dt_match[] = {
+       { .compatible = "samsung,s3c2410-rtc" },
     ^^^^^^^
quoted
quoted
+       { .compatible = "samsung,s3c6410-rtc" },
     ^^^^^^^
quoted
quoted
+       {},
     ^^^^^^^
should be Tab?
quoted
quoted
+};
+MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);
+#else
+#define s3c_rtc_dt_match NULL
+#endif
+
?static struct platform_device_id s3c_rtc_driver_ids[] = {
? ? ? ?{
? ? ? ? ? ? ? ?.name ? ? ? ? ? = "s3c2410-rtc",
@@ -625,6 +643,7 @@ static struct platform_driver s3c_rtc_driver = {
? ? ? ?.driver ? ? ? ? = {
? ? ? ? ? ? ? ?.name ? = "s3c-rtc",
? ? ? ? ? ? ? ?.owner ?= THIS_MODULE,
+               .of_match_table = s3c_rtc_dt_match,
     ^^^^^^^^^^^^^^^
Same as above...

But I know, Thomas' original patch has no problem...probably when ping,
happened above.
quoted
quoted
? ? ? ?},
?};

--
Thanks.

Best regards,
Kgene.
--
Kukjin Kim [off-list ref], Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help