aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 17:38:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 17:40:31 -0400
commite3d2f927f788adcdabc42f8a1616f6cc56c53bbe (patch)
treeff051e33cff49e23f4c4ef84360f22cf7a1998c9 /drivers/rtc
parenta9b6148d25f15ddfe9d7a7f3e526fdb64e7cf7da (diff)
parent81e192d6ce303b6792aa38ff35f41a1a7357f23a (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6: parisc: convert to generic compat_sys_ptrace parisc: add rtc platform driver parisc: initialize unwinder much earlier parisc: add new syscalls parisc: hijack jump to start_kernel parisc: add pdc_coproc_cfg_unlocked and set_firmware_width_unlocked parisc: move include/asm-parisc to arch/parisc/include/asm parisc: move pdc_result to real2.S parisc: unify CCIO_COLLECT_STATS implementation parisc: add arch/parisc/kernel/.gitignore parisc: ropes.h - fix <asm-parisc/*> -> <asm/*> parisc: parisc-agp - fix <asm-parisc/*> -> <asm/*> Resolve remove/rename conflict: include/asm-parisc/a.out.h is no longer relevant.
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/Kconfig8
-rw-r--r--drivers/rtc/Makefile1
-rw-r--r--drivers/rtc/rtc-parisc.c111
3 files changed, 120 insertions, 0 deletions
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index f660ef3e5b29..814f49fde530 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -610,6 +610,14 @@ config RTC_DRV_RS5C313
610 help 610 help
611 If you say yes here you get support for the Ricoh RS5C313 RTC chips. 611 If you say yes here you get support for the Ricoh RS5C313 RTC chips.
612 612
613config RTC_DRV_PARISC
614 tristate "PA-RISC firmware RTC support"
615 depends on PARISC
616 help
617 Say Y or M here to enable RTC support on PA-RISC systems using
618 firmware calls. If you do not know what you are doing, you should
619 just say Y.
620
613config RTC_DRV_PPC 621config RTC_DRV_PPC
614 tristate "PowerPC machine dependent RTC support" 622 tristate "PowerPC machine dependent RTC support"
615 depends on PPC 623 depends on PPC
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index d05928b3ca94..d6a9ac7176ea 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -51,6 +51,7 @@ obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o
51obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o 51obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o
52obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o 52obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o
53obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o 53obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o
54obj-$(CONFIG_RTC_DRV_PARISC) += rtc-parisc.o
54obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o 55obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o
55obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o 56obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o
56obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o 57obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o
diff --git a/drivers/rtc/rtc-parisc.c b/drivers/rtc/rtc-parisc.c
new file mode 100644
index 000000000000..346d633655e7
--- /dev/null
+++ b/drivers/rtc/rtc-parisc.c
@@ -0,0 +1,111 @@
1/* rtc-parisc: RTC for HP PA-RISC firmware
2 *
3 * Copyright (C) 2008 Kyle McMartin <kyle@mcmartin.ca>
4 */
5
6#include <linux/kernel.h>
7#include <linux/module.h>
8#include <linux/time.h>
9#include <linux/platform_device.h>
10
11#include <asm/rtc.h>
12
13/* as simple as can be, and no simpler. */
14struct parisc_rtc {
15 struct rtc_device *rtc;
16 spinlock_t lock;
17};
18
19static int parisc_get_time(struct device *dev, struct rtc_time *tm)
20{
21 struct parisc_rtc *p = dev_get_drvdata(dev);
22 unsigned long flags, ret;
23
24 spin_lock_irqsave(&p->lock, flags);
25 ret = get_rtc_time(tm);
26 spin_unlock_irqrestore(&p->lock, flags);
27
28 if (ret & RTC_BATT_BAD)
29 return -EOPNOTSUPP;
30
31 return 0;
32}
33
34static int parisc_set_time(struct device *dev, struct rtc_time *tm)
35{
36 struct parisc_rtc *p = dev_get_drvdata(dev);
37 unsigned long flags, ret;
38
39 spin_lock_irqsave(&p->lock, flags);
40 ret = set_rtc_time(tm);
41 spin_unlock_irqrestore(&p->lock, flags);
42
43 if (ret < 0)
44 return -EOPNOTSUPP;
45
46 return 0;
47}
48
49static const struct rtc_class_ops parisc_rtc_ops = {
50 .read_time = parisc_get_time,
51 .set_time = parisc_set_time,
52};
53
54static int __devinit parisc_rtc_probe(struct platform_device *dev)
55{
56 struct parisc_rtc *p;
57
58 p = kzalloc(sizeof (*p), GFP_KERNEL);
59 if (!p)
60 return -ENOMEM;
61
62 spin_lock_init(&p->lock);
63
64 p->rtc = rtc_device_register("rtc-parisc", &dev->dev, &parisc_rtc_ops,
65 THIS_MODULE);
66 if (IS_ERR(p->rtc)) {
67 int err = PTR_ERR(p->rtc);
68 kfree(p);
69 return err;
70 }
71
72 platform_set_drvdata(dev, p);
73
74 return 0;
75}
76
77static int __devexit parisc_rtc_remove(struct platform_device *dev)
78{
79 struct parisc_rtc *p = platform_get_drvdata(dev);
80
81 rtc_device_unregister(p->rtc);
82 kfree(p);
83
84 return 0;
85}
86
87static struct platform_driver parisc_rtc_driver = {
88 .driver = {
89 .name = "rtc-parisc",
90 .owner = THIS_MODULE,
91 },
92 .probe = parisc_rtc_probe,
93 .remove = __devexit_p(parisc_rtc_remove),
94};
95
96static int __init parisc_rtc_init(void)
97{
98 return platform_driver_register(&parisc_rtc_driver);
99}
100
101static void __exit parisc_rtc_fini(void)
102{
103 platform_driver_unregister(&parisc_rtc_driver);
104}
105
106module_init(parisc_rtc_init);
107module_exit(parisc_rtc_fini);
108
109MODULE_AUTHOR("Kyle McMartin <kyle@mcmartin.ca>");
110MODULE_LICENSE("GPL");
111MODULE_DESCRIPTION("HP PA-RISC RTC driver");