aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAfzal Mohammed <afzal@ti.com>2012-12-17 19:02:15 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-17 20:15:20 -0500
commit9e0344dcc225fe1a0e8b8af9ff7df44ec4613580 (patch)
tree37d66d1ad2eaf49880e199fe23d90dc5f57d8b1b
parent852168c92322d3b28de01514dccf25945be92b0b (diff)
rtc: omap: dt support
Enhance rtc-omap driver with DT capability Signed-off-by: Afzal Mohammed <afzal@ti.com> Acked-by: Sekhar Nori <nsekhar@ti.com> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Sekhar Nori <nsekhar@ti.com> Cc: Kevin Hilman <khilman@ti.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Daniel Mack <zonque@gmail.com> Cc: Vaibhav Hiremath <hvaibhav@ti.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/devicetree/bindings/rtc/rtc-omap.txt17
-rw-r--r--drivers/rtc/rtc-omap.c18
2 files changed, 35 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
new file mode 100644
index 000000000000..b47aa415c820
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
@@ -0,0 +1,17 @@
1TI Real Time Clock
2
3Required properties:
4- compatible: "ti,da830-rtc"
5- reg: Address range of rtc register set
6- interrupts: rtc timer, alarm interrupts in order
7- interrupt-parent: phandle for the interrupt controller
8
9Example:
10
11rtc@1c23000 {
12 compatible = "ti,da830-rtc";
13 reg = <0x23000 0x1000>;
14 interrupts = <19
15 19>;
16 interrupt-parent = <&intc>;
17};
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index d948426283db..dff9ff476b0d 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -20,6 +20,8 @@
20#include <linux/rtc.h> 20#include <linux/rtc.h>
21#include <linux/bcd.h> 21#include <linux/bcd.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/of.h>
24#include <linux/of_device.h>
23 25
24#include <asm/io.h> 26#include <asm/io.h>
25 27
@@ -298,6 +300,8 @@ static struct rtc_class_ops omap_rtc_ops = {
298static int omap_rtc_alarm; 300static int omap_rtc_alarm;
299static int omap_rtc_timer; 301static int omap_rtc_timer;
300 302
303#define OMAP_RTC_DATA_DA830_IDX 1
304
301static struct platform_device_id omap_rtc_devtype[] = { 305static struct platform_device_id omap_rtc_devtype[] = {
302 { 306 {
303 .name = DRIVER_NAME, 307 .name = DRIVER_NAME,
@@ -309,12 +313,25 @@ static struct platform_device_id omap_rtc_devtype[] = {
309}; 313};
310MODULE_DEVICE_TABLE(platform, omap_rtc_devtype); 314MODULE_DEVICE_TABLE(platform, omap_rtc_devtype);
311 315
316static const struct of_device_id omap_rtc_of_match[] = {
317 { .compatible = "ti,da830-rtc",
318 .data = &omap_rtc_devtype[OMAP_RTC_DATA_DA830_IDX],
319 },
320 {},
321};
322MODULE_DEVICE_TABLE(of, omap_rtc_of_match);
323
312static int __init omap_rtc_probe(struct platform_device *pdev) 324static int __init omap_rtc_probe(struct platform_device *pdev)
313{ 325{
314 struct resource *res, *mem; 326 struct resource *res, *mem;
315 struct rtc_device *rtc; 327 struct rtc_device *rtc;
316 u8 reg, new_ctrl; 328 u8 reg, new_ctrl;
317 const struct platform_device_id *id_entry; 329 const struct platform_device_id *id_entry;
330 const struct of_device_id *of_id;
331
332 of_id = of_match_device(omap_rtc_of_match, &pdev->dev);
333 if (of_id)
334 pdev->id_entry = of_id->data;
318 335
319 omap_rtc_timer = platform_get_irq(pdev, 0); 336 omap_rtc_timer = platform_get_irq(pdev, 0);
320 if (omap_rtc_timer <= 0) { 337 if (omap_rtc_timer <= 0) {
@@ -510,6 +527,7 @@ static struct platform_driver omap_rtc_driver = {
510 .driver = { 527 .driver = {
511 .name = DRIVER_NAME, 528 .name = DRIVER_NAME,
512 .owner = THIS_MODULE, 529 .owner = THIS_MODULE,
530 .of_match_table = of_match_ptr(omap_rtc_of_match),
513 }, 531 },
514 .id_table = omap_rtc_devtype, 532 .id_table = omap_rtc_devtype,
515}; 533};