Commit 9e0344dcc225fe1a0e8b8af9ff7df44ec4613580

Authored by Afzal Mohammed
Committed by Linus Torvalds
1 parent 852168c923

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>

Showing 2 changed files with 35 additions and 0 deletions Side-by-side Diff

Documentation/devicetree/bindings/rtc/rtc-omap.txt
  1 +TI Real Time Clock
  2 +
  3 +Required 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 +
  9 +Example:
  10 +
  11 +rtc@1c23000 {
  12 + compatible = "ti,da830-rtc";
  13 + reg = <0x23000 0x1000>;
  14 + interrupts = <19
  15 + 19>;
  16 + interrupt-parent = <&intc>;
  17 +};
drivers/rtc/rtc-omap.c
... ... @@ -20,6 +20,8 @@
20 20 #include <linux/rtc.h>
21 21 #include <linux/bcd.h>
22 22 #include <linux/platform_device.h>
  23 +#include <linux/of.h>
  24 +#include <linux/of_device.h>
23 25  
24 26 #include <asm/io.h>
25 27  
... ... @@ -298,6 +300,8 @@
298 300 static int omap_rtc_alarm;
299 301 static int omap_rtc_timer;
300 302  
  303 +#define OMAP_RTC_DATA_DA830_IDX 1
  304 +
301 305 static struct platform_device_id omap_rtc_devtype[] = {
302 306 {
303 307 .name = DRIVER_NAME,
304 308  
305 309  
... ... @@ -309,13 +313,26 @@
309 313 };
310 314 MODULE_DEVICE_TABLE(platform, omap_rtc_devtype);
311 315  
  316 +static 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 +};
  322 +MODULE_DEVICE_TABLE(of, omap_rtc_of_match);
  323 +
312 324 static int __init omap_rtc_probe(struct platform_device *pdev)
313 325 {
314 326 struct resource *res, *mem;
315 327 struct rtc_device *rtc;
316 328 u8 reg, new_ctrl;
317 329 const struct platform_device_id *id_entry;
  330 + const struct of_device_id *of_id;
318 331  
  332 + of_id = of_match_device(omap_rtc_of_match, &pdev->dev);
  333 + if (of_id)
  334 + pdev->id_entry = of_id->data;
  335 +
319 336 omap_rtc_timer = platform_get_irq(pdev, 0);
320 337 if (omap_rtc_timer <= 0) {
321 338 pr_debug("%s: no update irq?\n", pdev->name);
... ... @@ -510,6 +527,7 @@
510 527 .driver = {
511 528 .name = DRIVER_NAME,
512 529 .owner = THIS_MODULE,
  530 + .of_match_table = of_match_ptr(omap_rtc_of_match),
513 531 },
514 532 .id_table = omap_rtc_devtype,
515 533 };