From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
To: Alessandro Zummo <alessandro.zummo@towertech.it>,
Kyle McMartin <kyle@mcmartin.ca>
Cc: linux-m68k@vger.kernel.org, rtc-linux@googlegroups.com,
linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxppc-dev@ozlabs.org, Paul Mundt <lethal@linux-sh.org>,
Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>,
Dann Frazier <dannf@dannf.org>
Subject: [PATCH 5/7] m68k: Hook up rtc-generic
Date: Mon, 9 Mar 2009 14:26:21 +0100 [thread overview]
Message-ID: <1236605183-22718-6-git-send-email-Geert.Uytterhoeven@sonycom.com> (raw)
In-Reply-To: <1236605183-22718-5-git-send-email-Geert.Uytterhoeven@sonycom.com>
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>
---
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 d0aeff2..c8ead87 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -681,7 +681,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
--
1.6.0.4
next prev parent reply other threads:[~2009-03-09 13:26 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-09 13:26 [PATCH 0/7] Generic RTC class driver Geert Uytterhoeven
2009-03-09 13:26 ` [PATCH 1/7] parisc: rtc: get_rtc_time() returns unsigned int Geert Uytterhoeven
2009-03-09 13:26 ` [PATCH 2/7] parisc: rtc: platform_driver_probe() fixups Geert Uytterhoeven
2009-03-09 13:26 ` [PATCH 3/7] parisc: rtc: Add missing module alias Geert Uytterhoeven
2009-03-09 13:26 ` [PATCH 4/7] parisc: rtc: Rename rtc-parisc to rtc-generic Geert Uytterhoeven
2009-03-09 13:26 ` Geert Uytterhoeven [this message]
2009-03-09 13:26 ` [PATCH 6/7] powerpc: Hook up rtc-generic, and kill rtc-ppc Geert Uytterhoeven
2009-03-09 13:26 ` [PATCH 7/7] powerpc/ps3: Add rtc-ps3 Geert Uytterhoeven
2009-03-09 14:12 ` [rtc-linux] " Alessandro Zummo
2009-03-09 15:24 ` Geert Uytterhoeven
2009-03-09 18:04 ` Geoff Levand
2009-03-09 18:43 ` [rtc-linux] " Alessandro Zummo
2009-03-09 19:06 ` Geoff Levand
2009-03-09 19:18 ` Joe Perches
2009-03-09 18:35 ` Geoff Levand
2009-03-10 9:21 ` Geert Uytterhoeven
2009-03-10 9:39 ` [rtc-linux] " Alessandro Zummo
2009-03-10 16:18 ` Geoff Levand
2009-03-09 13:59 ` [PATCH 6/7] powerpc: Hook up rtc-generic, and kill rtc-ppc David Woodhouse
2009-03-11 4:15 ` Benjamin Herrenschmidt
2009-03-16 13:09 ` [PATCH 4/7] parisc: rtc: Rename rtc-parisc to rtc-generic Christoph Hellwig
2009-03-09 14:14 ` [rtc-linux] [PATCH 0/7] Generic RTC class driver Alessandro Zummo
2009-03-09 15:46 ` Paul Mundt
2009-03-11 10:36 ` Geert Uytterhoeven
2009-03-11 15:45 ` Kyle McMartin
2009-03-11 17:26 ` Geert Uytterhoeven
2009-03-13 4:25 ` Kyle McMartin
2009-04-02 9:42 ` Geert Uytterhoeven
2009-04-02 13:56 ` Kyle McMartin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1236605183-22718-6-git-send-email-Geert.Uytterhoeven@sonycom.com \
--to=geert.uytterhoeven@sonycom.com \
--cc=alessandro.zummo@towertech.it \
--cc=dannf@dannf.org \
--cc=kyle@mcmartin.ca \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=rtc-linux@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).