From patchwork Mon Mar 9 13:26:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 24192 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from mail-qy0-f142.google.com (mail-qy0-f142.google.com [209.85.221.142]) by ozlabs.org (Postfix) with ESMTP id BF548DE0AA for ; Tue, 10 Mar 2009 00:26:39 +1100 (EST) Received: by mail-qy0-f142.google.com with SMTP id 6so2066850qyk.29 for ; Mon, 09 Mar 2009 06:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:received:x-sender:x-apparently-to :received:received:received-spf:authentication-results:received :received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:reply-to:sender:precedence:x-google-loop:mailing-list :list-id:list-post:list-help:list-unsubscribe:x-beenthere-env :x-beenthere; bh=7bIErp5zOwfKGShZSPCCNMUsJBbu3sKYS/YI8UcdXAU=; b=THWE+cA/lEzS6oHvHsTz4RNwEzCvnIXBWrtiaOKW5xL4Xzpc56IdQgF5FMT/W4dJ21 ClOFS8TtjUDPRTC80OV/8VibCGZxCcdfpZUcTATR7xNtGmKbOK1FQCHGafHGtI4U365S 1L2sl6PT7jMOTXs7PxZsfKr93qnWtMM7jS8lQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-sender:x-apparently-to:received-spf:authentication-results:from :to:cc:subject:date:message-id:x-mailer:in-reply-to:references :reply-to:sender:precedence:x-google-loop:mailing-list:list-id :list-post:list-help:list-unsubscribe:x-beenthere-env:x-beenthere; b=RgHRpKN6x38CK2n+v5anSIlOmnUgFO9T5wZEL7O0hA216g9mzHk5HSBnrIcSHRVDB1 nWnm1L5x+KzGV34ga3JKzjY9+Obi4lPsHy6gTU1RtS1vzrbeBFXzo9mY3CQa4ym0cSai R3NeBtqZ/cU2fC73gLtY+qrU9reRq97P9wnSA= Received: by 10.224.20.3 with SMTP id d3mr832221qab.25.1236605196229; Mon, 09 Mar 2009 06:26:36 -0700 (PDT) Received: by 10.176.122.11 with SMTP id u11gr1989yqc.0; Mon, 09 Mar 2009 06:26:36 -0700 (PDT) X-Sender: geert@sonycom.com X-Apparently-To: rtc-linux@googlegroups.com Received: by 10.210.130.13 with SMTP id c13mr321612ebd.11.1236605187777; Mon, 09 Mar 2009 06:26:27 -0700 (PDT) Received: from vervifontaine.sonycom.com (vervifontaine.sonytel.be [80.88.33.193]) by gmr-mx.google.com with ESMTP id 14si532247ewy.1.2009.03.09.06.26.27; Mon, 09 Mar 2009 06:26:27 -0700 (PDT) Received-SPF: neutral (google.com: 80.88.33.193 is neither permitted nor denied by best guess record for domain of geert@sonycom.com) client-ip=80.88.33.193; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 80.88.33.193 is neither permitted nor denied by best guess record for domain of geert@sonycom.com) smtp.mail=geert@sonycom.com Received: from vixen.sonytel.be (piraat.sonytel.be [43.221.60.197]) by vervifontaine.sonycom.com (Postfix) with ESMTP id C48E458C3F; Mon, 9 Mar 2009 14:26:25 +0100 (MET) Received: from geert by vixen.sonytel.be with local (Exim 4.63) (envelope-from ) id 1LgfUv-0005v8-NT; Mon, 09 Mar 2009 14:26:25 +0100 From: Geert Uytterhoeven To: Alessandro Zummo , Kyle McMartin Cc: rtc-linux@googlegroups.com, linux-parisc@vger.kernel.org, linuxppc-dev@ozlabs.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Mundt , Dann Frazier , Geert Uytterhoeven Subject: [rtc-linux] [PATCH 5/7] m68k: Hook up rtc-generic Date: Mon, 9 Mar 2009 14:26:21 +0100 Message-Id: <1236605183-22718-6-git-send-email-Geert.Uytterhoeven@sonycom.com> X-Mailer: git-send-email 1.6.0.4 In-Reply-To: <1236605183-22718-5-git-send-email-Geert.Uytterhoeven@sonycom.com> References: <1236605183-22718-1-git-send-email-Geert.Uytterhoeven@sonycom.com> <1236605183-22718-2-git-send-email-Geert.Uytterhoeven@sonycom.com> <1236605183-22718-3-git-send-email-Geert.Uytterhoeven@sonycom.com> <1236605183-22718-4-git-send-email-Geert.Uytterhoeven@sonycom.com> <1236605183-22718-5-git-send-email-Geert.Uytterhoeven@sonycom.com> Reply-To: rtc-linux@googlegroups.com Sender: rtc-linux@googlegroups.com Precedence: bulk X-Google-Loop: groups Mailing-List: list rtc-linux@googlegroups.com; contact rtc-linux+owner@googlegroups.com List-Id: List-Post: List-Help: List-Unsubscribe: , X-BeenThere-Env: rtc-linux@googlegroups.com X-BeenThere: rtc-linux@googlegroups.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 --- 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 #include #include +#include #include #include @@ -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