diff options
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/Kconfig | 8 | ||||
-rw-r--r-- | drivers/rtc/Makefile | 1 | ||||
-rw-r--r-- | drivers/rtc/rtc-ds1374.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-ppc.c | 69 |
4 files changed, 79 insertions, 1 deletions
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 6cc2c0330230..60f8afc7a56e 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -534,4 +534,12 @@ config RTC_DRV_RS5C313 | |||
534 | help | 534 | help |
535 | If you say yes here you get support for the Ricoh RS5C313 RTC chips. | 535 | If you say yes here you get support for the Ricoh RS5C313 RTC chips. |
536 | 536 | ||
537 | config RTC_DRV_PPC | ||
538 | tristate "PowerPC machine dependent RTC support" | ||
539 | depends on PPC_MERGE | ||
540 | help | ||
541 | The PowerPC kernel has machine-specific functions for accessing | ||
542 | the RTC. This exposes that functionality through the generic RTC | ||
543 | class. | ||
544 | |||
537 | endif # RTC_CLASS | 545 | endif # RTC_CLASS |
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 872f1218ff9f..ebe871cf16c1 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile | |||
@@ -54,3 +54,4 @@ obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o | |||
54 | obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o | 54 | obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o |
55 | obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o | 55 | obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o |
56 | obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o | 56 | obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o |
57 | obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o | ||
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index fa2d2f8b3f4d..640acd20fdde 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #define DS1374_REG_TCR 0x09 /* Trickle Charge */ | 42 | #define DS1374_REG_TCR 0x09 /* Trickle Charge */ |
43 | 43 | ||
44 | static const struct i2c_device_id ds1374_id[] = { | 44 | static const struct i2c_device_id ds1374_id[] = { |
45 | { "rtc-ds1374", 0 }, | 45 | { "ds1374", 0 }, |
46 | { } | 46 | { } |
47 | }; | 47 | }; |
48 | MODULE_DEVICE_TABLE(i2c, ds1374_id); | 48 | MODULE_DEVICE_TABLE(i2c, ds1374_id); |
diff --git a/drivers/rtc/rtc-ppc.c b/drivers/rtc/rtc-ppc.c new file mode 100644 index 000000000000..c8e97e25ef7e --- /dev/null +++ b/drivers/rtc/rtc-ppc.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * RTC driver for ppc_md RTC functions | ||
3 | * | ||
4 | * © 2007 Red Hat, Inc. | ||
5 | * | ||
6 | * Author: David Woodhouse <dwmw2@infradead.org> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/err.h> | ||
16 | #include <linux/rtc.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <asm/machdep.h> | ||
19 | |||
20 | static int ppc_rtc_read_time(struct device *dev, struct rtc_time *tm) | ||
21 | { | ||
22 | ppc_md.get_rtc_time(tm); | ||
23 | return 0; | ||
24 | } | ||
25 | |||
26 | static int ppc_rtc_set_time(struct device *dev, struct rtc_time *tm) | ||
27 | { | ||
28 | return ppc_md.set_rtc_time(tm); | ||
29 | } | ||
30 | |||
31 | static const struct rtc_class_ops ppc_rtc_ops = { | ||
32 | .set_time = ppc_rtc_set_time, | ||
33 | .read_time = ppc_rtc_read_time, | ||
34 | }; | ||
35 | |||
36 | static struct rtc_device *rtc; | ||
37 | static struct platform_device *ppc_rtc_pdev; | ||
38 | |||
39 | static int __init ppc_rtc_init(void) | ||
40 | { | ||
41 | if (!ppc_md.get_rtc_time || !ppc_md.set_rtc_time) | ||
42 | return -ENODEV; | ||
43 | |||
44 | ppc_rtc_pdev = platform_device_register_simple("ppc-rtc", 0, NULL, 0); | ||
45 | if (IS_ERR(ppc_rtc_pdev)) | ||
46 | return PTR_ERR(ppc_rtc_pdev); | ||
47 | |||
48 | rtc = rtc_device_register("ppc_md", &ppc_rtc_pdev->dev, | ||
49 | &ppc_rtc_ops, THIS_MODULE); | ||
50 | if (IS_ERR(rtc)) { | ||
51 | platform_device_unregister(ppc_rtc_pdev); | ||
52 | return PTR_ERR(rtc); | ||
53 | } | ||
54 | |||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static void __exit ppc_rtc_exit(void) | ||
59 | { | ||
60 | rtc_device_unregister(rtc); | ||
61 | platform_device_unregister(ppc_rtc_pdev); | ||
62 | } | ||
63 | |||
64 | module_init(ppc_rtc_init); | ||
65 | module_exit(ppc_rtc_exit); | ||
66 | |||
67 | MODULE_LICENSE("GPL"); | ||
68 | MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); | ||
69 | MODULE_DESCRIPTION("Generic RTC class driver for PowerPC"); | ||