1 /* rtc-starfire.c: Starfire platform RTC driver.
3 * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
6 #include <linux/kernel.h>
7 #include <linux/module.h>
8 #include <linux/init.h>
10 #include <linux/platform_device.h>
12 #include <asm/oplib.h>
14 MODULE_AUTHOR("David S. Miller <davem@davemloft.net>");
15 MODULE_DESCRIPTION("Starfire RTC driver");
16 MODULE_LICENSE("GPL");
18 static u32 starfire_get_time(void)
20 static char obp_gettod[32];
23 sprintf(obp_gettod, "h# %08x unix-gettod",
24 (unsigned int) (long) &unix_tod);
25 prom_feval(obp_gettod);
30 static int starfire_read_time(struct device *dev, struct rtc_time *tm)
32 rtc_time_to_tm(starfire_get_time(), tm);
33 return rtc_valid_tm(tm);
36 static const struct rtc_class_ops starfire_rtc_ops = {
37 .read_time = starfire_read_time,
40 static int __init starfire_rtc_probe(struct platform_device *pdev)
42 struct rtc_device *rtc;
44 rtc = devm_rtc_device_register(&pdev->dev, "starfire",
45 &starfire_rtc_ops, THIS_MODULE);
49 platform_set_drvdata(pdev, rtc);
54 static struct platform_driver starfire_rtc_driver = {
56 .name = "rtc-starfire",
60 module_platform_driver_probe(starfire_rtc_driver, starfire_rtc_probe);