aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>2009-02-19 10:50:46 -0500
committerKyle McMartin <kyle@mcmartin.ca>2009-04-01 21:05:31 -0400
commitbcd68a70cb0eee556d86d93133aa150319bd9f53 (patch)
tree433e163d649d515bfc08751016fe98d3cf0caaee
parent2ceb3ad705aa1abe6656b038bb9f4a6b1201cc35 (diff)
powerpc: Hook up rtc-generic, and kill rtc-ppc
PowerPC has been a long time user of the generic RTC abstraction, so hook up rtc-generic: - Create the "rtc-generic" platform device if ppc_md.get_rtc_time is set, - Kill rtc-ppc, as rtc-generic offers the same functionality in a more generic way, and supports autoloading through udev. Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Acked-by: David Woodhouse <David.Woodhouse@intel.com> Acked-by: Alessandro Zummo <a.zummo@towertech.it> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
-rw-r--r--arch/powerpc/kernel/time.c16
-rw-r--r--drivers/rtc/Kconfig10
-rw-r--r--drivers/rtc/Makefile1
-rw-r--r--drivers/rtc/rtc-ppc.c69
4 files changed, 17 insertions, 79 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index c9564031a2a9..926ea864e34f 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -1127,3 +1127,19 @@ void div128_by_32(u64 dividend_high, u64 dividend_low,
1127 dr->result_low = ((u64)y << 32) + z; 1127 dr->result_low = ((u64)y << 32) + z;
1128 1128
1129} 1129}
1130
1131static int __init rtc_init(void)
1132{
1133 struct platform_device *pdev;
1134
1135 if (!ppc_md.get_rtc_time)
1136 return -ENODEV;
1137
1138 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
1139 if (IS_ERR(pdev))
1140 return PTR_ERR(pdev);
1141
1142 return 0;
1143}
1144
1145module_init(rtc_init);
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 5aab5b917c8b..fa66d10dd5a0 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -692,20 +692,12 @@ config RTC_DRV_GENERIC
692 tristate "Generic RTC support" 692 tristate "Generic RTC support"
693 # Please consider writing a new RTC driver instead of using the generic 693 # Please consider writing a new RTC driver instead of using the generic
694 # RTC abstraction 694 # RTC abstraction
695 depends on PARISC || M68K 695 depends on PARISC || M68K || PPC
696 help 696 help
697 Say Y or M here to enable RTC support on systems using the generic 697 Say Y or M here to enable RTC support on systems using the generic
698 RTC abstraction. If you do not know what you are doing, you should 698 RTC abstraction. If you do not know what you are doing, you should
699 just say Y. 699 just say Y.
700 700
701config RTC_DRV_PPC
702 tristate "PowerPC machine dependent RTC support"
703 depends on PPC
704 help
705 The PowerPC kernel has machine-specific functions for accessing
706 the RTC. This exposes that functionality through the generic RTC
707 class.
708
709config RTC_DRV_PXA 701config RTC_DRV_PXA
710 tristate "PXA27x/PXA3xx" 702 tristate "PXA27x/PXA3xx"
711 depends on ARCH_PXA 703 depends on ARCH_PXA
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 39cdb9799de6..2b022f19a6ed 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -57,7 +57,6 @@ obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o
57obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o 57obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o
58obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o 58obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o
59obj-$(CONFIG_RTC_DRV_GENERIC) += rtc-generic.o 59obj-$(CONFIG_RTC_DRV_GENERIC) += rtc-generic.o
60obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o
61obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o 60obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o
62obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o 61obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o
63obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o 62obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o
diff --git a/drivers/rtc/rtc-ppc.c b/drivers/rtc/rtc-ppc.c
deleted file mode 100644
index c8e97e25ef7e..000000000000
--- a/drivers/rtc/rtc-ppc.c
+++ /dev/null
@@ -1,69 +0,0 @@
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
20static 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
26static int ppc_rtc_set_time(struct device *dev, struct rtc_time *tm)
27{
28 return ppc_md.set_rtc_time(tm);
29}
30
31static const struct rtc_class_ops ppc_rtc_ops = {
32 .set_time = ppc_rtc_set_time,
33 .read_time = ppc_rtc_read_time,
34};
35
36static struct rtc_device *rtc;
37static struct platform_device *ppc_rtc_pdev;
38
39static 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
58static void __exit ppc_rtc_exit(void)
59{
60 rtc_device_unregister(rtc);
61 platform_device_unregister(ppc_rtc_pdev);
62}
63
64module_init(ppc_rtc_init);
65module_exit(ppc_rtc_exit);
66
67MODULE_LICENSE("GPL");
68MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
69MODULE_DESCRIPTION("Generic RTC class driver for PowerPC");