From patchwork Wed Dec 13 18:53:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 10110679 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A9A7260327 for ; Wed, 13 Dec 2017 18:55:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AA0D287B2 for ; Wed, 13 Dec 2017 18:55:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F19128AE6; Wed, 13 Dec 2017 18:55:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2BB16287B2 for ; Wed, 13 Dec 2017 18:55:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PZlUahCRjn+cHYbC/HBq8LBgGdP6XIC/QDp+5EENc38=; b=I6zrYQtrWh0HoPrEzg9cxJO604 zR/bgQZQEFozZLV+cY0hMIGTLHgkt2ox+QpAtVRz5pmISZawfMpI8S4ZfjB4eK1q1e7ClbF+o+bLW c7dSetyemMAaQ0bPe3xPUjTLsgGiMdZLZ+QTtzpQTCIiGwTnzPe4T9PhWN5TmXOvpi1BTmjiLskEy URcpHdN3TCj0LfJljP/VTJhIe27G/Nx6EsWMSpYK8IFCFd7hhPYy+ii8R8uxE1af9ZimMZWDOWpQk ow0pW7LTPmhbdU3L3kMr9ktvKlbW8EDwT5ErIULBaNo38o6VOzddPEzvqg4G2v3hCLxF4aty+BbBN Vj10xvBg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePCBh-0007td-G6; Wed, 13 Dec 2017 18:55:25 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePCAN-0005TP-Ru for linux-arm-kernel@lists.infradead.org; Wed, 13 Dec 2017 18:54:08 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id 5974120810; Wed, 13 Dec 2017 19:53:42 +0100 (CET) Received: from localhost (unknown [195.53.49.241]) by mail.free-electrons.com (Postfix) with ESMTPSA id 19FAC2093C; Wed, 13 Dec 2017 19:53:32 +0100 (CET) From: Alexandre Belloni To: Rob Herring , Daniel Lezcano Subject: [PATCH 3/3] clocksource/drivers: integrator-ap: parse the chosen node Date: Wed, 13 Dec 2017 19:53:13 +0100 Message-Id: <20171213185313.20017-4-alexandre.belloni@free-electrons.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171213185313.20017-1-alexandre.belloni@free-electrons.com> References: <20171213185313.20017-1-alexandre.belloni@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171213_105404_141582_B48AAAC5 X-CRM114-Status: GOOD ( 12.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Belloni , Thomas Gleixner , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The driver currently uses aliases to know whether the timer is the clocksource or the clockevent. Add the /chosen/linux,clocksource and /chosen/linux,clockevent parsing while keeping backward compatibility. Signed-off-by: Alexandre Belloni --- drivers/clocksource/Kconfig | 1 + drivers/clocksource/timer-integrator-ap.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 9a22d1048fcf..053aca99caf7 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -212,6 +212,7 @@ config KEYSTONE_TIMER config INTEGRATOR_AP_TIMER bool "Integrator-ap timer driver" if COMPILE_TEST select CLKSRC_MMIO + select TIMER_OF help Enables support for the Integrator-ap timer. diff --git a/drivers/clocksource/timer-integrator-ap.c b/drivers/clocksource/timer-integrator-ap.c index 62d24690ba02..8f38be724aff 100644 --- a/drivers/clocksource/timer-integrator-ap.c +++ b/drivers/clocksource/timer-integrator-ap.c @@ -197,6 +197,17 @@ static int __init integrator_ap_timer_init_of(struct device_node *node) rate = clk_get_rate(clk); writel(0, base + TIMER_CTRL); + if (timer_of_is_clocksource(node)) + /* The primary timer lacks IRQ, use as clocksource */ + return integrator_clocksource_init(rate, base); + + if (timer_of_is_clockevent(node)) { + /* The secondary timer will drive the clock event */ + irq = irq_of_parse_and_map(node, 0); + return integrator_clockevent_init(rate, base, irq); + } + + /* DT ABI compatibility below */ err = of_property_read_string(of_aliases, "arm,timer-primary", &path); if (err) {