m68k: Hook up rtc-generic

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, April 3, 2009 - 11:04 am

Gitweb:     http://git.kernel.org/linus/2ceb3ad705aa1abe6656b038bb9f4a6b1201cc35
Commit:     2ceb3ad705aa1abe6656b038bb9f4a6b1201cc35
Parent:     3afe6d04626f8de87b15150a30b78df492ab68ee
Author:     Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
AuthorDate: Thu Feb 19 16:50:46 2009 +0100
Committer:  Kyle McMartin <kyle@mcmartin.ca>
CommitDate: Thu Apr 2 01:05:31 2009 +0000

    m68k: Hook up rtc-generic
    
    m68k has been a long time user of the generic RTC abstraction, so hook up
    rtc-generic:
      - Create the "rtc-generic" platform device if mach_hwclk is set,
      - Add checks for mach_hwclk, in anticipation of RTC chip drivers being moved
        to drivers/rtc/.
    
    Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
    Acked-by: Alessandro Zummo <a.zummo@towertech.it>
    Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
---
 arch/m68k/include/asm/rtc.h |    7 +++++--
 arch/m68k/kernel/time.c     |   18 ++++++++++++++++++
 drivers/rtc/Kconfig         |    2 +-
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/include/asm/rtc.h b/arch/m68k/include/asm/rtc.h
index 5d3e038..a4d08ea 100644
--- a/arch/m68k/include/asm/rtc.h
+++ b/arch/m68k/include/asm/rtc.h
@@ -36,13 +36,16 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
 	 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
 	 * by the RTC when initially set to a non-zero value.
 	 */
-	mach_hwclk(0, time);
+	if (mach_hwclk)
+		mach_hwclk(0, time);
 	return RTC_24H;
 }
 
 static inline int set_rtc_time(struct rtc_time *time)
 {
-	return mach_hwclk(1, time);
+	if (mach_hwclk)
+		return mach_hwclk(1, time);
+	return -EINVAL;
 }
 
 static inline unsigned int get_rtc_ss(void)
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 7db4159..54d9807 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -18,6 +18,7 @@
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/rtc.h>
+#include <linux/platform_device.h>
 
 #include <asm/machdep.h>
 #include <asm/io.h>
@@ -159,3 +160,20 @@ int do_settimeofday(struct timespec *tv)
 }
 
 EXPORT_SYMBOL(do_settimeofday);
+
+
+static int __init rtc_init(void)
+{
+	struct platform_device *pdev;
+
+	if (!mach_hwclk)
+		return -ENODEV;
+
+	pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	return 0;
+}
+
+module_init(rtc_init);
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 13df513..5aab5b9 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -692,7 +692,7 @@ config RTC_DRV_GENERIC
 	tristate "Generic RTC support"
 	# Please consider writing a new RTC driver instead of using the generic
 	# RTC abstraction
-	depends on PARISC
+	depends on PARISC || M68K
 	help
 	  Say Y or M here to enable RTC support on systems using the generic
 	  RTC abstraction. If you do not know what you are doing, you should
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
m68k: Hook up rtc-generic, Linux Kernel Mailing ..., (Fri Apr 3, 11:04 am)