Received: by 10.223.176.46 with SMTP id f43csp1045850wra; Sat, 20 Jan 2018 09:39:13 -0800 (PST) X-Google-Smtp-Source: AH8x225jTjEqvklWXitpQTy3TQu1jloSZ4zp3yFkL9HIrn70lHiwLEzJ3S5zE9kHqU4ZEnUwQQUt X-Received: by 10.98.87.2 with SMTP id l2mr3023461pfb.46.1516469953832; Sat, 20 Jan 2018 09:39:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516469953; cv=none; d=google.com; s=arc-20160816; b=oH+fmKiprBHhcDLMuq2sp+0GivsysMf8RjO/ehqa4oO+Gtqs/7q09lRE30CTlibKPd jrXXNjmde26yKGXwiT77WPFy63WtDkPplil2gvkmWDs+P96wXxhxYTp1CSjnJXcHlGJj 9JjbQVjAnWY8jLDjQHwiqrObnmFtLm4ipF229We+Qgv/MzExBYQdC0cDpa29r6l89zn4 9UJqYqhumm4L4W+a3NdNHwlBjpoZtuqrkAphXVqBbnwx4PirCIoZBG0Y+6BKz8VYBKo/ zPHbBow5JO8ZCmzbrU/BAIYPkhazK3bodRxZUikQphSY16dhsXqEdBEPD9ajX8ohSKr9 8k8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=BCHZgdIs3FDvwlsHjHtWidBk2kiLHrumZu3TFazAv3o=; b=wU2Vvl2csnGL+T5CqWei1JlzFYgqJYw0tBPpovznLxn6n54YpNKdH9bZ9huXKg7KU3 Wkqbd1k0hv9UuFHHDqmhRY5Xw7GJMoh1rGl/WMg/HUz0YKP38wA8oWe0h+v2jKJ2tqKG qCN3xKyo378rXDkw24YJnTCDy7Ix/V6Yhtw/z0ekeH19SwnWs47CTipuVGBDElmNJTIr CPQtFxE25DJEV5neqbe5fLS2UHHTNqCw8eOUydOYbSxnpweCaA2yGUsk/gYdgN2AM1pu Ygem3xCxi+GVLYlG9kUpcqQdu/vHNFYSRXOowAkAp4K1vWSFXTDHt/7Dtz5OI3oizRaa DcjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=zqG+JBRb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7-v6si1865485pln.97.2018.01.20.09.38.59; Sat, 20 Jan 2018 09:39:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=zqG+JBRb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756711AbeATRiV (ORCPT + 99 others); Sat, 20 Jan 2018 12:38:21 -0500 Received: from vern.gendns.com ([206.190.152.46]:43625 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754913AbeATRiP (ORCPT ); Sat, 20 Jan 2018 12:38:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject :Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BCHZgdIs3FDvwlsHjHtWidBk2kiLHrumZu3TFazAv3o=; b=zqG+JBRbptXEkrW4gspCWdkSP +8NX2qpmGrUiInotaQ2uoIf7DEiZm7fR9agDrT24kmBJPIxFF9ulRFzkqgQQcJgyruTEuO/0i9SRm AvOzgf6BHK+MJD9BgV3I+LPP/jDiTitbPZ5w+L3BPeZh9MM/u9cwGq0laEw0lZuFKnYq7Pztb61d+ N5jjgAFgzdhDKHY5l+pg1VmO3eC/FwtQAq9pIhADIcm/nqLrkJdCYy1+krlBZfIcILcqNVFx23kM/ 20jQGp21CiXPiayBkNBA3oToQgW7qlCrKSMs1zq2lX5lFG8ip/xFa+oTUNvKLoHgBvs9uBe/XmZtN uQbaHYqUg==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:53590 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1ecwjy-00059q-Qq; Sat, 20 Jan 2018 12:15:39 -0500 From: David Lechner To: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland , Sekhar Nori , Kevin Hilman , Bartosz Golaszewski , Adam Ford , linux-kernel@vger.kernel.org, David Lechner Subject: [PATCH v6 39/41] ARM: davinci: add device tree support to timer Date: Sat, 20 Jan 2018 11:14:18 -0600 Message-Id: <1516468460-4908-40-git-send-email-david@lechnology.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516468460-4908-1-git-send-email-david@lechnology.com> References: <1516468460-4908-1-git-send-email-david@lechnology.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds device tree support to the davinci timer so that when clocks are moved to device tree, the timer will still work. Signed-off-by: David Lechner --- v6 changes: - none arch/arm/mach-davinci/Kconfig | 1 + arch/arm/mach-davinci/time.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig index ba9912b..da8a039 100644 --- a/arch/arm/mach-davinci/Kconfig +++ b/arch/arm/mach-davinci/Kconfig @@ -59,6 +59,7 @@ config MACH_DA8XX_DT default y depends on ARCH_DAVINCI_DA850 select PINCTRL + select TIMER_OF help Say y here to include support for TI DaVinci DA850 based using Flattened Device Tree. More information at Documentation/devicetree diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c index bd0c80e..44470e9 100644 --- a/arch/arm/mach-davinci/time.c +++ b/arch/arm/mach-davinci/time.c @@ -333,9 +333,9 @@ static struct clock_event_device clockevent_davinci = { }; -void __init davinci_timer_init(void) +static int __init of_davinci_timer_init(struct device_node *node) { - struct clk *timer_clk; + struct clk *timer_clk = NULL; struct davinci_soc_info *soc_info = &davinci_soc_info; unsigned int clockevent_id; unsigned int clocksource_id; @@ -371,7 +371,10 @@ void __init davinci_timer_init(void) } } - timer_clk = clk_get(NULL, "timer0"); + if (node) + timer_clk = of_clk_get(node, 0); + if (IS_ERR_OR_NULL(timer_clk)) + timer_clk = clk_get(NULL, "timer0"); BUG_ON(IS_ERR(timer_clk)); clk_prepare_enable(timer_clk); @@ -399,4 +402,12 @@ void __init davinci_timer_init(void) for (i=0; i< ARRAY_SIZE(timers); i++) timer32_config(&timers[i]); + + return 0; +} +TIMER_OF_DECLARE(davinci_timer, "ti,davinci-timer", of_davinci_timer_init); + +void __init davinci_timer_init(void) +{ + of_davinci_timer_init(NULL); } -- 2.7.4