]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - drivers/rtc/rtc-starfire.c
efi: print unrecognized CPER section
[mirror_ubuntu-zesty-kernel.git] / drivers / rtc / rtc-starfire.c
CommitLineData
de2cf332 1/* rtc-starfire.c: Starfire platform RTC driver.
683cec8a
PG
2 *
3 * Author: David S. Miller
4 * License: GPL
de2cf332
DM
5 *
6 * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
7 */
8
9#include <linux/kernel.h>
de2cf332 10#include <linux/init.h>
de2cf332
DM
11#include <linux/rtc.h>
12#include <linux/platform_device.h>
13
14#include <asm/oplib.h>
15
de2cf332
DM
16static u32 starfire_get_time(void)
17{
18 static char obp_gettod[32];
19 static u32 unix_tod;
20
21 sprintf(obp_gettod, "h# %08x unix-gettod",
22 (unsigned int) (long) &unix_tod);
23 prom_feval(obp_gettod);
24
25 return unix_tod;
26}
27
28static int starfire_read_time(struct device *dev, struct rtc_time *tm)
29{
be1ffce3
AZ
30 rtc_time_to_tm(starfire_get_time(), tm);
31 return rtc_valid_tm(tm);
de2cf332
DM
32}
33
34static const struct rtc_class_ops starfire_rtc_ops = {
35 .read_time = starfire_read_time,
de2cf332
DM
36};
37
be1ffce3 38static int __init starfire_rtc_probe(struct platform_device *pdev)
de2cf332 39{
45e39861
JH
40 struct rtc_device *rtc;
41
42 rtc = devm_rtc_device_register(&pdev->dev, "starfire",
43 &starfire_rtc_ops, THIS_MODULE);
be1ffce3
AZ
44 if (IS_ERR(rtc))
45 return PTR_ERR(rtc);
de2cf332 46
be1ffce3 47 platform_set_drvdata(pdev, rtc);
de2cf332 48
de2cf332
DM
49 return 0;
50}
51
de2cf332
DM
52static struct platform_driver starfire_rtc_driver = {
53 .driver = {
54 .name = "rtc-starfire",
de2cf332 55 },
de2cf332
DM
56};
57
683cec8a 58builtin_platform_driver_probe(starfire_rtc_driver, starfire_rtc_probe);