From patchwork Fri Feb 20 15:46:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 23482 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from yw-out-2122.google.com (yw-out-2122.google.com [74.125.46.27]) by ozlabs.org (Postfix) with ESMTP id 512F0DDDF0 for ; Sat, 21 Feb 2009 02:46:59 +1100 (EST) Received: by yw-out-2122.google.com with SMTP id 4so1015782ywc.11 for ; Fri, 20 Feb 2009 07:46:57 -0800 (PST) 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:mime-version:content-type:content-transfer-encoding :reply-to:sender:precedence:x-google-loop:mailing-list:list-id :list-post:list-help:list-unsubscribe:x-beenthere-env:x-beenthere; bh=mMIZJDl1Bti3D4mJPSjaP70GwTU7qfGBbaXwW07AmZc=; b=bAwOeFDi+V+eJ0bWOSOlO0y+/HZB5oVHHXYygNowtM1Oks/a86BEM9KYx/JpwopDjI P5u7sHYDOwXYpxJEHvf45dw+1WXGv2qYzo+jc7XvJ0bZBeaEtgQn2MV9gSSY652CjSSQ 74l0FV3nNaazyKR23KikzowFrDdQZgQQsQeIg= 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 :mime-version:content-type:content-transfer-encoding:reply-to:sender :precedence:x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; b=i3zDHOpIQFhBdcr2tWwJGukuRvYO4bKjsTAFhQTruyifsqdItY0PnYB4BNBaz5ll2K BZPd+EzbK74bSyWv3x8lpKwJoGldYOmC1zmY3xq0NizP0fRKrm0kYT0Oe2tM55WjhvQI nZXBQic7VDmIWIAT7cG8t9nNHyu9OyftH/Mps= Received: by 10.151.103.11 with SMTP id f11mr548743ybm.13.1235144814670; Fri, 20 Feb 2009 07:46:54 -0800 (PST) Received: by 10.177.127.42 with SMTP id e42gr1918yqn.0; Fri, 20 Feb 2009 07:46:54 -0800 (PST) X-Sender: geert@sonycom.com X-Apparently-To: rtc-linux@googlegroups.com Received: by 10.103.215.15 with SMTP id s15mr17417muq.28.1235144814085; Fri, 20 Feb 2009 07:46:54 -0800 (PST) Received: from vervifontaine.sonycom.com (vervifontaine.sonytel.be [80.88.33.193]) by mx.google.com with ESMTP id 3si286050fgg.13.2009.02.20.07.46.54; Fri, 20 Feb 2009 07:46:54 -0800 (PST) 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: 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 9295E58C50; Fri, 20 Feb 2009 16:46:52 +0100 (MET) Received: from geert by vixen.sonytel.be with local (Exim 4.63) (envelope-from ) id 1LaXaW-0008TZ-H1; Fri, 20 Feb 2009 16:46:52 +0100 From: Geert Uytterhoeven To: Alessandro Zummo Cc: rtc-linux@googlegroups.com, Kyle McMartin , David Woodhouse , Richard Zidlicky , linux-parisc@vger.kernel.org, linuxppc-dev@ozlabs.org, linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [rtc-linux] [PATCH/RFC 4/5] powerpc: Enable rtc-generic, and kill rtc-ppc Date: Fri, 20 Feb 2009 16:46:48 +0100 Message-Id: <1235144809-32468-5-git-send-email-Geert.Uytterhoeven@sonycom.com> X-Mailer: git-send-email 1.6.0.4 In-Reply-To: <1235144809-32468-4-git-send-email-Geert.Uytterhoeven@sonycom.com> References: <1235144809-32468-1-git-send-email-Geert.Uytterhoeven@sonycom.com> <1235144809-32468-2-git-send-email-Geert.Uytterhoeven@sonycom.com> <1235144809-32468-3-git-send-email-Geert.Uytterhoeven@sonycom.com> <1235144809-32468-4-git-send-email-Geert.Uytterhoeven@sonycom.com> Mime-Version: 1.0 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 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. Signed-off-by: Geert Uytterhoeven --- arch/powerpc/Kconfig | 4 ++ arch/powerpc/kernel/time.c | 22 ++++++++++++++ drivers/rtc/Kconfig | 8 ----- drivers/rtc/Makefile | 1 - drivers/rtc/rtc-ppc.c | 69 -------------------------------------------- 5 files changed, 26 insertions(+), 78 deletions(-) delete mode 100644 drivers/rtc/rtc-ppc.c diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 40b7981..82e47b0 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -85,6 +85,10 @@ config ARCH_HAS_ILOG2_U64 bool default y if 64BIT +config ARCH_HAS_GENERIC_RTC + bool + default y + config GENERIC_HWEIGHT bool default y diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index c956403..616c7d3 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -1127,3 +1127,25 @@ void div128_by_32(u64 dividend_high, u64 dividend_low, dr->result_low = ((u64)y << 32) + z; } + +static struct platform_device rtc_generic_dev = { + .name = "rtc-generic", + .id = -1, +}; + +static int __init rtc_init(void) +{ + int ret; + + if (!ppc_md.get_rtc_time) + return -ENODEV; + + ret = platform_device_register(&rtc_generic_dev); + if (ret < 0) + pr_err("Unable to register rtc device...\n"); + + /* not necessarily an error */ + return 0; +} + +module_init(rtc_init); diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 3e58182..9964a72 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -685,14 +685,6 @@ config RTC_DRV_GENERIC RTC abstraction. If you do not know what you are doing, you should just say Y. -config RTC_DRV_PPC - tristate "PowerPC machine dependent RTC support" - depends on PPC - help - The PowerPC kernel has machine-specific functions for accessing - the RTC. This exposes that functionality through the generic RTC - class. - config RTC_DRV_PXA tristate "PXA27x/PXA3xx" depends on ARCH_PXA diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 9c18a01..bd209a5 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -56,7 +56,6 @@ obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o obj-$(CONFIG_RTC_DRV_GENERIC) += rtc-generic.o -obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o obj-$(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 c8e97e2..0000000 --- a/drivers/rtc/rtc-ppc.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * RTC driver for ppc_md RTC functions - * - * © 2007 Red Hat, Inc. - * - * Author: David Woodhouse - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - - -#include -#include -#include -#include -#include - -static int ppc_rtc_read_time(struct device *dev, struct rtc_time *tm) -{ - ppc_md.get_rtc_time(tm); - return 0; -} - -static int ppc_rtc_set_time(struct device *dev, struct rtc_time *tm) -{ - return ppc_md.set_rtc_time(tm); -} - -static const struct rtc_class_ops ppc_rtc_ops = { - .set_time = ppc_rtc_set_time, - .read_time = ppc_rtc_read_time, -}; - -static struct rtc_device *rtc; -static struct platform_device *ppc_rtc_pdev; - -static int __init ppc_rtc_init(void) -{ - if (!ppc_md.get_rtc_time || !ppc_md.set_rtc_time) - return -ENODEV; - - ppc_rtc_pdev = platform_device_register_simple("ppc-rtc", 0, NULL, 0); - if (IS_ERR(ppc_rtc_pdev)) - return PTR_ERR(ppc_rtc_pdev); - - rtc = rtc_device_register("ppc_md", &ppc_rtc_pdev->dev, - &ppc_rtc_ops, THIS_MODULE); - if (IS_ERR(rtc)) { - platform_device_unregister(ppc_rtc_pdev); - return PTR_ERR(rtc); - } - - return 0; -} - -static void __exit ppc_rtc_exit(void) -{ - rtc_device_unregister(rtc); - platform_device_unregister(ppc_rtc_pdev); -} - -module_init(ppc_rtc_init); -module_exit(ppc_rtc_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("David Woodhouse "); -MODULE_DESCRIPTION("Generic RTC class driver for PowerPC");