Received: by 10.223.185.116 with SMTP id b49csp4169827wrg; Mon, 19 Feb 2018 12:27:47 -0800 (PST) X-Google-Smtp-Source: AH8x226kqcdH2VU5JykoXlF5a4tgSeeYpE6/TTo97Pnp00TKI+w5uJPttoY81botzW0YVXjxxC34 X-Received: by 2002:a17:902:6a0f:: with SMTP id m15-v6mr4482788plk.379.1519072067723; Mon, 19 Feb 2018 12:27:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519072067; cv=none; d=google.com; s=arc-20160816; b=VxUWO6NnEg4mZB+zrQFdRLAg+C8lj+oIjiJF8jt0XbG7ruZQNQBdSDZu1JwB9ikMGW COYt73YRopbtWsCARo6fueG0hZvTssKX2wntV6XxWUoawPpV81Tyuhdl43g8JTeIgzMz bGz6qlkQyBF4wctvrxuUL2h51eWCeI+dJ/7pYaPnIRhZzPiHju/2l95sOVMbGD1TK0hQ whhl4rqrVN0Km0I4R/nUcSHjJx6UrW7w2BjmvG9/WZAJxsDQxVFJmq0+nw/M5wCQwMm0 nlkXlKBw7doUZtGjXz6dv3nUlGCPD9pZuOKfSE5cIt6uux/pFLk2FkdCVheR2Je/pw6H VfUQ== 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=OaNs9wnrIOeqcniJ7AyXKBju+0mleNSCejHCrpzmV84=; b=zsqTPCXii3G4Id1YmoGpO9RuC2y27AGl30wnOMMRHzxoHYDLh/DGgxmIpmFa5cfl9f Fc5a591qfvV8/4YEou2K4zZJChpHpIjDBDT+XU5KTx0u+OdB/V4wp7R9HuKvKoqWcxQK NBv11IKxfw9lQt1XCMIyZamLo/AhtisBTnS1Dq/xIASmBMKsxSHJUIcBbhYlC8nc1Yix B/KKmI2EihnP74q6XvmfqdjB64lsKQJRLff8XXSHYh036YjO9j2BjbmCKdK2NUBKNoy/ R5s1i/gmj6y2sNhKGC5FzmUOmS4zOim8HMIjaIla3YF2g1tmh5w21zu62L10dCrVIKRW CK3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=aV7ZhUZp; 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 u3-v6si3495393plz.494.2018.02.19.12.27.33; Mon, 19 Feb 2018 12:27:47 -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=aV7ZhUZp; 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 S932323AbeBSUZm (ORCPT + 99 others); Mon, 19 Feb 2018 15:25:42 -0500 Received: from vern.gendns.com ([206.190.152.46]:58573 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932187AbeBSUXI (ORCPT ); Mon, 19 Feb 2018 15:23:08 -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=OaNs9wnrIOeqcniJ7AyXKBju+0mleNSCejHCrpzmV84=; b=aV7ZhUZpJXQy86KhfBgSpDnwA Agc9FxXMcZcOBTSpUTN44O4GOmLb8PxizSHjpTurl6qkIyQ/3kc2E2ADkSZWUVXuxRHdaLAL+lLQq yDXI44lADYWQxq1Zp5qaCIYhODYQfeolWLoqpbGi3oRcJT6uic3JtPG5MJCC1EIWbYSGqYRVCwgNy wQeFqhMp8Bw5oDPyKRmIzJILUPAx2B3O931AvpZoGg5ysMv/kYW/e+Cl+DSk2JUXqK1PlhylXuu68 TZ1xzfSH+gObrKRQ2mnZ3KXGAPTFEy8XiHdCNFf5n+uhRTIyhqDMjN5dcUrUcdb7mujFO1m88BNa+ kjdYcqiug==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:48842 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1enrwZ-003xBV-TP; Mon, 19 Feb 2018 15:21:48 -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 v7 20/42] ARM: davinci: pass clock as parameter to davinci_timer_init() Date: Mon, 19 Feb 2018 14:21:41 -0600 Message-Id: <1519071723-31790-21-git-send-email-david@lechnology.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519071723-31790-1-git-send-email-david@lechnology.com> References: <1519071723-31790-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 changes davinci_timer_init() so that we pass the clock as a parameter instead of using clk_get(). This is done in preparation for converting to the common clock framework. It removes the requirement that we have to have a clock with con_id of "timer0", which will be good for DT bindings since clock-names = "timer0" doesn't really make sense. Additionally, when we convert to the common clock framework, most of the clocks will be platform devices, which will not be available at this point during the boot process, so we will need to pass a clock that is available (i.e. ref_clk) instead of the "timer0" clock. NB: The comment added in time.c is not entirely true when this patch is applied, but it will be correct once the conversion to the common clock framework is complete in subsequent patches. Also, drop use of extern in header file since we are touching the definition. Signed-off-by: David Lechner --- v7 changes: - new in v7 arch/arm/mach-davinci/da830.c | 2 +- arch/arm/mach-davinci/da850.c | 2 +- arch/arm/mach-davinci/dm355.c | 2 +- arch/arm/mach-davinci/dm365.c | 2 +- arch/arm/mach-davinci/dm644x.c | 2 +- arch/arm/mach-davinci/dm646x.c | 2 +- arch/arm/mach-davinci/include/mach/common.h | 3 ++- arch/arm/mach-davinci/time.c | 13 +++++++++---- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c index 350d767..0b17e5a 100644 --- a/arch/arm/mach-davinci/da830.c +++ b/arch/arm/mach-davinci/da830.c @@ -1224,5 +1224,5 @@ void __init da830_init(void) void __init da830_init_time(void) { davinci_clk_init(da830_clks); - davinci_timer_init(); + davinci_timer_init(&timerp64_0_clk); } diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 34117e61..1dbf01c 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -1396,5 +1396,5 @@ void __init da850_init(void) void __init da850_init_time(void) { davinci_clk_init(da850_clks); - davinci_timer_init(); + davinci_timer_init(&timerp64_0_clk); } diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index f294804..0da7516 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c @@ -1047,7 +1047,7 @@ void __init dm355_init(void) void __init dm355_init_time(void) { davinci_clk_init(dm355_clks); - davinci_timer_init(); + davinci_timer_init(&timer0_clk); } int __init dm355_init_video(struct vpfe_config *vpfe_cfg, diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index 1e3df9d..871372a 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c @@ -1172,7 +1172,7 @@ void __init dm365_init(void) void __init dm365_init_time(void) { davinci_clk_init(dm365_clks); - davinci_timer_init(); + davinci_timer_init(&timer0_clk); } static struct resource dm365_vpss_resources[] = { diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index b409801..71a16fc 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c @@ -935,7 +935,7 @@ void __init dm644x_init(void) void __init dm644x_init_time(void) { davinci_clk_init(dm644x_clks); - davinci_timer_init(); + davinci_timer_init(&timer0_clk); } int __init dm644x_init_video(struct vpfe_config *vpfe_cfg, diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 109ab1f..e1d6e92 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c @@ -956,7 +956,7 @@ void __init dm646x_init_time(unsigned long ref_clk_rate, ref_clk.rate = ref_clk_rate; aux_clkin.rate = aux_clkin_rate; davinci_clk_init(dm646x_clks); - davinci_timer_init(); + davinci_timer_init(&timer0_clk); } static int __init dm646x_init_devices(void) diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h index f0d5e858..5f45d0a 100644 --- a/arch/arm/mach-davinci/include/mach/common.h +++ b/arch/arm/mach-davinci/include/mach/common.h @@ -12,11 +12,12 @@ #ifndef __ARCH_ARM_MACH_DAVINCI_COMMON_H #define __ARCH_ARM_MACH_DAVINCI_COMMON_H +#include #include #include #include -extern void davinci_timer_init(void); +void davinci_timer_init(struct clk *clk); extern void davinci_irq_init(void); extern void __iomem *davinci_intc_base; diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c index 1bb991a..2521333 100644 --- a/arch/arm/mach-davinci/time.c +++ b/arch/arm/mach-davinci/time.c @@ -334,10 +334,8 @@ static struct clock_event_device clockevent_davinci = { .set_state_oneshot = davinci_set_oneshot, }; - -void __init davinci_timer_init(void) +void __init davinci_timer_init(struct clk *timer_clk) { - struct clk *timer_clk; struct davinci_soc_info *soc_info = &davinci_soc_info; unsigned int clockevent_id; unsigned int clocksource_id; @@ -373,7 +371,14 @@ void __init davinci_timer_init(void) } } - timer_clk = clk_get(NULL, "timer0"); + /* + * REVISIT: Currently, timer_clk will be "ref_clk". However, the actual + * clock for this device comes from a PLL AUXCLK or a PSC clock + * (depending on the SoC). The PLL and PSC clocks are not registered + * until later in boot because they are platform devices. We should try + * again later to get the real clock so that the real clock is not + * turned off when disabling unused clocks, which would stop the timer. + */ BUG_ON(IS_ERR(timer_clk)); clk_prepare_enable(timer_clk); -- 2.7.4