From patchwork Fri Nov 11 21:38:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 693969 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tFtbx2YGpz9t2G for ; Sat, 12 Nov 2016 08:39:41 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c5JXv-0006o7-O9; Fri, 11 Nov 2016 21:39:39 +0000 Received: from smtprelay.synopsys.com ([198.182.60.111]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c5JXr-0006lJ-PR for linux-snps-arc@lists.infradead.org; Fri, 11 Nov 2016 21:39:36 +0000 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 712CB10C1970; Fri, 11 Nov 2016 13:39:14 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 54B43D9E; Fri, 11 Nov 2016 13:39:14 -0800 (PST) Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id 3E0EDD9D; Fri, 11 Nov 2016 13:39:14 -0800 (PST) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 11 Nov 2016 13:39:14 -0800 Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by IN01WEHTCA.internal.synopsys.com (10.144.199.103) with Microsoft SMTP Server (TLS) id 14.3.266.1; Sat, 12 Nov 2016 03:09:13 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.12.196.111) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.266.1; Sat, 12 Nov 2016 03:09:12 +0530 From: Vineet Gupta To: Daniel Lezcano Subject: [PATCH v4 2/8] ARC: timer: gfrc, rtc: Read BCR to detect whether hardware exists ... Date: Fri, 11 Nov 2016 13:38:46 -0800 Message-ID: <1478900332-24279-3-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478900332-24279-1-git-send-email-vgupta@synopsys.com> References: <1478900332-24279-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.12.196.111] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161111_133935_893319_FB411980 X-CRM114-Status: UNSURE ( 8.68 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -3.3 (---) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-3.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.60.111 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [198.182.60.111 listed in wl.mailspike.net] -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Noam Camus , Vineet Gupta , Alexey.Brodkin@synopsys.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, linux-snps-arc@lists.infradead.org Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org ... don't rely on cpuinfo populated in arc boot code. This paves way for moving this code in drivers/clocksource/ And while at it, convert the WARN() to pr_warn() as sugested by Daniel Signed-off-by: Vineet Gupta --- arch/arc/kernel/time.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/arc/kernel/time.c b/arch/arc/kernel/time.c index 8d66bb446209..d3f3750a0d2d 100644 --- a/arch/arc/kernel/time.c +++ b/arch/arc/kernel/time.c @@ -111,11 +111,14 @@ static struct clocksource arc_counter_gfrc = { static int __init arc_cs_setup_gfrc(struct device_node *node) { - int exists = cpuinfo_arc700[0].extn.gfrc; + struct mcip_bcr mp; int ret; - if (WARN(!exists, "Global-64-bit-Ctr clocksource not detected")) + READ_BCR(ARC_REG_MCIP_BCR, mp); + if (!mp.gfrc) { + pr_warn("Global-64-bit-Ctr clocksource not detected"); return -ENXIO; + } ret = arc_get_timer_clk(node); if (ret) @@ -163,15 +166,20 @@ static struct clocksource arc_counter_rtc = { static int __init arc_cs_setup_rtc(struct device_node *node) { - int exists = cpuinfo_arc700[smp_processor_id()].extn.rtc; + struct bcr_timer timer; int ret; - if (WARN(!exists, "Local-64-bit-Ctr clocksource not detected")) + READ_BCR(ARC_REG_TIMERS_BCR, timer); + if (!timer.rtc) { + pr_warn("Local-64-bit-Ctr clocksource not detected"); return -ENXIO; + } /* Local to CPU hence not usable in SMP */ - if (WARN(IS_ENABLED(CONFIG_SMP), "Local-64-bit-Ctr not usable in SMP")) + if (IS_ENABLED(CONFIG_SMP)) { + pr_warn("Local-64-bit-Ctr not usable in SMP"); return -EINVAL; + } ret = arc_get_timer_clk(node); if (ret)