From patchwork Fri Jul 25 20:00:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 34315 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9B972235AB for ; Fri, 25 Jul 2014 20:04:43 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kx10sf32345175pab.4 for ; Fri, 25 Jul 2014 13:04:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:subject:from:to:cc:date :in-reply-to:references:organization:mime-version:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-transfer-encoding; bh=mQDqyHs8UfsMhuL2zVwEXt+3eYsetGa8n5YDaYDpPEY=; b=WmekgsfOmJCmK9V3o5ceFf2vvkt2AwkKsRtA2ZV6+ZZlWSN6EGURddMfOWWTKAJ2o3 IZqHpVh21rVxnQhWFuDRwZJfxvMyh8v2Wg/Guzu/wgehjV5tEByCBAHpbifeNX125nH1 SbOT5qqthlT1f+mIdZT7yzwRKrrdLsUZupMbrTvKX5EQqheiR7j2p8rtXYpGIgPU/yuw Jz1sxNwcqh3eDZiNRYhAzXOvvk44eON54QRaWPjc3n8fZNzmYulxOn0LBDc2boM+geN9 fyded2ac7wSEkWRWJqAIOGx8t3db8qOxhy0S0foGtXnMnXq1dhgsYTF3fpssH326oB0r 4u0A== X-Gm-Message-State: ALoCoQk42gfzlx0+d5AYKdINIhaQa8sEHuhyerKLOZr32dLdxVZ5q0G/PflhHpNvqVopSjercvUh X-Received: by 10.66.66.196 with SMTP id h4mr8985152pat.22.1406318682765; Fri, 25 Jul 2014 13:04:42 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.35 with SMTP id k32ls1296372qgd.73.gmail; Fri, 25 Jul 2014 13:04:42 -0700 (PDT) X-Received: by 10.220.137.145 with SMTP id w17mr5280309vct.47.1406318682618; Fri, 25 Jul 2014 13:04:42 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id na9si8253000vcb.64.2014.07.25.13.04.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Jul 2014 13:04:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id lf12so8077084vcb.29 for ; Fri, 25 Jul 2014 13:04:42 -0700 (PDT) X-Received: by 10.221.47.9 with SMTP id uq9mr5306981vcb.48.1406318682492; Fri, 25 Jul 2014 13:04:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp62778vcb; Fri, 25 Jul 2014 13:04:41 -0700 (PDT) X-Received: by 10.68.189.137 with SMTP id gi9mr12665099pbc.87.1406318681373; Fri, 25 Jul 2014 13:04:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ad1si10219334pbd.83.2014.07.25.13.04.40 for ; Fri, 25 Jul 2014 13:04:41 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935182AbaGYUEj (ORCPT + 16 others); Fri, 25 Jul 2014 16:04:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4619 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932508AbaGYUEh (ORCPT ); Fri, 25 Jul 2014 16:04:37 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6PK0Nn0031517 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Jul 2014 16:00:23 -0400 Received: from [10.3.113.127] (ovpn-113-127.phx2.redhat.com [10.3.113.127]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6PK0L8M003757; Fri, 25 Jul 2014 16:00:22 -0400 Message-ID: <1406318421.27055.29.camel@deneb.redhat.com> Subject: [PATCH v2] rtc: ia64: allow other architectures to use EFI RTC From: Mark Salter To: Alessandro Zummo , Tony Luck , Fenghua Yu Cc: linux-ia64@vger.kernel.org, rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, Andrew Morton Date: Fri, 25 Jul 2014 16:00:21 -0400 In-Reply-To: <1402685430-32591-1-git-send-email-msalter@redhat.com> References: <1402685430-32591-1-git-send-email-msalter@redhat.com> Organization: Red Hat, Inc Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: msalter@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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. This is v2 of the patch to fix a boot problem with kernels building in rtc-efi but not being booted via EFI. In that case, runtime services are not available so there is no point in registering the platform device. Signed-off-by: Mark Salter Cc: Alessandro Zummo Cc: Tony Luck Cc: Fenghua Yu Cc: Andrew Morton --- arch/ia64/kernel/time.c | 15 --------------- drivers/rtc/Kconfig | 2 +- drivers/rtc/Makefile | 4 ++++ drivers/rtc/rtc-efi-platform.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 drivers/rtc/rtc-efi-platform.c diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index 71c52bc..a149c67 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c @@ -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); diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 0754f5c..4478a59 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -789,7 +789,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. diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 70347d0..f1dfc36 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -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 index 0000000..b40fbe3 --- /dev/null +++ b/drivers/rtc/rtc-efi-platform.c @@ -0,0 +1,31 @@ +/* + * Moved from arch/ia64/kernel/time.c + * + * Copyright (C) 1998-2003 Hewlett-Packard Co + * Stephane Eranian + * David Mosberger + * Copyright (C) 1999 Don Dugger + * Copyright (C) 1999-2000 VA Linux Systems + * Copyright (C) 1999-2000 Walt Drummond + */ +#include +#include +#include +#include +#include + +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);