]> git.karo-electronics.de Git - linux-beck.git/commitdiff
rtc: ia64: allow other architectures to use EFI RTC
authorMark Salter <msalter@redhat.com>
Fri, 8 Aug 2014 21:20:14 +0000 (14:20 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Aug 2014 22:57:19 +0000 (15:57 -0700)
Currently, the rtc-efi driver is restricted to ia64 only.  Newer
architectures with EFI support may want to also use that driver.  This
patch moves the platform device setup from ia64 into drivers/rtc and
allow any architecture with CONFIG_EFI=y to use the rtc-efi driver.

Signed-off-by: Mark Salter <msalter@redhat.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/ia64/kernel/time.c
drivers/rtc/Kconfig
drivers/rtc/Makefile
drivers/rtc/rtc-efi-platform.c [new file with mode: 0644]

index 3e71ef85e4397f58a5bf392d8217088eab4eccd7..9a0104a38cd37ef3e1a4a1537cfe95c785d45dbf 100644 (file)
@@ -384,21 +384,6 @@ static struct irqaction timer_irqaction = {
        .name =         "timer"
 };
 
-static struct platform_device rtc_efi_dev = {
-       .name = "rtc-efi",
-       .id = -1,
-};
-
-static int __init rtc_init(void)
-{
-       if (platform_device_register(&rtc_efi_dev) < 0)
-               printk(KERN_ERR "unable to register rtc device...\n");
-
-       /* not necessarily an error */
-       return 0;
-}
-module_init(rtc_init);
-
 void read_persistent_clock(struct timespec *ts)
 {
        efi_gettimeofday(ts);
index a672dd16da62b20be104045d728708afbc5fa99a..83743a1a6731faf0bb7b8b23e46ba7e4f2812c56 100644 (file)
@@ -798,7 +798,7 @@ config RTC_DRV_DA9063
 
 config RTC_DRV_EFI
        tristate "EFI RTC"
-       depends on IA64
+       depends on EFI
        help
          If you say yes here you will get support for the EFI
          Real Time Clock.
index 70347d041d10b86aaa2efb68ada1d56cf47225a4..f1dfc3648ee519013e186fd13b9cde45f650b5de 100644 (file)
@@ -10,6 +10,10 @@ obj-$(CONFIG_RTC_SYSTOHC)    += systohc.o
 obj-$(CONFIG_RTC_CLASS)                += rtc-core.o
 rtc-core-y                     := class.o interface.o
 
+ifdef CONFIG_RTC_DRV_EFI
+rtc-core-y                     += rtc-efi-platform.o
+endif
+
 rtc-core-$(CONFIG_RTC_INTF_DEV)        += rtc-dev.o
 rtc-core-$(CONFIG_RTC_INTF_PROC) += rtc-proc.o
 rtc-core-$(CONFIG_RTC_INTF_SYSFS) += rtc-sysfs.o
diff --git a/drivers/rtc/rtc-efi-platform.c b/drivers/rtc/rtc-efi-platform.c
new file mode 100644 (file)
index 0000000..b40fbe3
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Moved from arch/ia64/kernel/time.c
+ *
+ * Copyright (C) 1998-2003 Hewlett-Packard Co
+ *     Stephane Eranian <eranian@hpl.hp.com>
+ *     David Mosberger <davidm@hpl.hp.com>
+ * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
+ * Copyright (C) 1999-2000 VA Linux Systems
+ * Copyright (C) 1999-2000 Walt Drummond <drummond@valinux.com>
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/efi.h>
+#include <linux/platform_device.h>
+
+static struct platform_device rtc_efi_dev = {
+       .name = "rtc-efi",
+       .id = -1,
+};
+
+static int __init rtc_init(void)
+{
+       if (efi_enabled(EFI_RUNTIME_SERVICES))
+               if (platform_device_register(&rtc_efi_dev) < 0)
+                       pr_err("unable to register rtc device...\n");
+
+       /* not necessarily an error */
+       return 0;
+}
+module_init(rtc_init);