Received: by 10.223.176.46 with SMTP id f43csp1032070wra; Sat, 20 Jan 2018 09:21:46 -0800 (PST) X-Google-Smtp-Source: AH8x225yBYmDh5ZQVcdWpJlNoACq8iiAfFOD2iryvPdCMlN46smsEgwf6Dqm50zad/Rx45ChQBAg X-Received: by 10.98.192.10 with SMTP id x10mr3039905pff.27.1516468906360; Sat, 20 Jan 2018 09:21:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516468906; cv=none; d=google.com; s=arc-20160816; b=oxrr/1CFxD7Z+dQIrxcQCKiepIfMIfsfKYz27DrQ9qaT5uvK/sK6Y4GvXigxKAz/cN mEYXhRu6Bn0UEbHGOs55FMikzDbx40009GMWA6aNWhcdNuvB8WAr3NebHeKYRYdkp9Z4 2izBThrGNjvZWfKpjtxHtbOy3WGfMfgGCMqi4wMnCjMbAZwGye/QBpJri0g/H3S5N1Er q5WwCWK+xaUgCK9Fo4YyLWyK+cvQEKFTnAS6mH7VHJLlrNUuHXjsP+em2tUzfp7KZTAs eQ07zwhIAOO1uGUoj3qU+vigyEgzk1IV61qiu1gMN0Plf8rvJjuuAL0E0meDMM+HJ+IM VNXg== 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=kI0VxASUlF4hRpetguv2pvttmBPaLK4orNuCCg0kdF0=; b=hSxPVO359AykKwf7q70aAMGxZqGH+t+HsCYo1tndOqJE8OPTEfWkAbrDJ4RzFIUl8v aOSUYTVz4kjCzEYySReLVS9GqSfk1VAJMLjCceeIcI/8p21NwUWzZWzh7dBmJNcZ2oJO QhW9VokYCkXHrCgFj8W0BMLBUxvZc2jQcoDC96CAnrDIbXVGGd8JCWeBj3Rbut5qci4E IjFpXTaivzSS0OtgmVuMBARCxySCHh60Iycl/kwI0BHl/MsSS8OFZY0nt1u4edml9pyZ eY8jo42BCdvBz7VoXeJdZgerMbT/F0OEMZBwfWGYHdGCsvZirmmOiPO7XwJM/wfExcz9 yaXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=cd7ke8Km; 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 37-v6si1854450plc.215.2018.01.20.09.21.32; Sat, 20 Jan 2018 09:21:46 -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=cd7ke8Km; 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 S1756770AbeATRUW (ORCPT + 99 others); Sat, 20 Jan 2018 12:20:22 -0500 Received: from vern.gendns.com ([206.190.152.46]:42756 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756618AbeATRPh (ORCPT ); Sat, 20 Jan 2018 12:15:37 -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=kI0VxASUlF4hRpetguv2pvttmBPaLK4orNuCCg0kdF0=; b=cd7ke8KmW8y31m6JtFwOcGz3w u19p+qC1oaDn5p32JmcsOy0SapVPo5ubOAX3VfPcvw50taG07kvW/LW/TWQ/jFvMfbvqCZLoYb3N1 Bvh19+kIyPTqEDiH65pRd6L+CQNG61CJn4a5gAZimyuObBQosfLZb68a3aGPyz/XhdT+w/fb/q5QH A+ES7d6SNrwuQQtav5aLA3XSf7O/A2vcQwNIkA2Dgo4BzBt2KQXNZVc1nHS9KlxREsnmYxIx9BTnt QDO8zI0r0g+p3IPAJWTeuEDxS5F+qZg/kVgZg7/BmoWlnXZ3rv5b6lXrtChBvzweYcMQLj5PTISqS zDn9NoCuQ==; 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 1ecwjS-00059q-Pw; Sat, 20 Jan 2018 12:15:07 -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 21/41] ARM: da850: add new clock init using common clock framework Date: Sat, 20 Jan 2018 11:14:00 -0600 Message-Id: <1516468460-4908-22-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 the new board-specific clock init in mach-davinci/da850.c using the new common clock framework drivers. The #ifdefs are needed to prevent compile errors until the entire ARCH_DAVINCI is converted. Also clean up the #includes since we are adding some here. Signed-off-by: David Lechner --- v6 changes: - add blank lines between function calls - include da8xx_register_cfgchip() - add async1 and async2 clock domains arch/arm/mach-davinci/da850.c | 79 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 69 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 5c86d77..0fdf647 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -11,37 +11,44 @@ * is licensed "as is" without any warranty of any kind, whether express * or implied. */ + +#include +#include +#include #include +#include #include #include -#include -#include -#include #include +#include +#include #include #include -#include #include -#include "psc.h" -#include -#include #include -#include -#include #include +#include +#include +#include #include +#include -#include "clock.h" #include "mux.h" +#ifndef CONFIG_COMMON_CLK +#include "clock.h" +#include "psc.h" +#endif + #define DA850_PLL1_BASE 0x01e1a000 #define DA850_TIMER64P2_BASE 0x01f0c000 #define DA850_TIMER64P3_BASE 0x01f0d000 #define DA850_REF_FREQ 24000000 +#ifndef CONFIG_COMMON_CLK static int da850_set_armrate(struct clk *clk, unsigned long rate); static int da850_round_armrate(struct clk *clk, unsigned long rate); static int da850_set_pll0rate(struct clk *clk, unsigned long armrate); @@ -581,6 +588,7 @@ static struct clk_lookup da850_clks[] = { CLK("ecap.2", "fck", &ecap2_clk), CLK(NULL, NULL, NULL), }; +#endif /* * Device specific mux setup @@ -1168,6 +1176,7 @@ int da850_register_cpufreq(char *async_clk) return platform_device_register(&da850_cpufreq_device); } +#ifndef CONFIG_COMMON_CLK static int da850_round_armrate(struct clk *clk, unsigned long rate) { int ret = 0, diff; @@ -1230,12 +1239,14 @@ static int da850_set_pll0rate(struct clk *clk, unsigned long rate) return 0; } +#endif /* CONFIG_COMMON_CLK */ #else int __init da850_register_cpufreq(char *async_clk) { return 0; } +#ifndef CONFIG_COMMON_CLK static int da850_set_armrate(struct clk *clk, unsigned long rate) { return -EINVAL; @@ -1250,6 +1261,7 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate) { return clk->rate; } +#endif /* CONFIG_COMMON_CLK */ #endif /* VPIF resource, platform data */ @@ -1381,6 +1393,52 @@ void __init da850_init(void) void __init da850_init_time(void) { +#ifdef CONFIG_COMMON_CLK + void __iomem *pll0, *pll1, *psc0, *psc1; + struct regmap *cfgchip; + struct clk *clk; + struct clk_hw *parent; + + pll0 = ioremap(DA8XX_PLL0_BASE, SZ_4K); + pll1 = ioremap(DA850_PLL1_BASE, SZ_4K); + psc0 = ioremap(DA8XX_PSC0_BASE, SZ_4K); + psc1 = ioremap(DA8XX_PSC1_BASE, SZ_4K); + + cfgchip = da8xx_register_cfgchip(); + if (WARN(IS_ERR(cfgchip), "failed to register CFGCHIP syscon")) + return; + + clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DA850_REF_FREQ); + + da850_pll_clk_init(pll0, pll1); + + da8xx_cfgchip_register_div4p5(cfgchip); + + da8xx_cfgchip_register_async1(cfgchip); + + clk = clk_register_fixed_factor(NULL, "async2", "pll0_auxclk", 0, 1, 1); + clk_register_clkdev(clk, NULL, "i2c_davinci.1"); + clk_register_clkdev(clk, "timer0", NULL); + clk_register_clkdev(clk, NULL, "davinci-wdt"); + + clk = da8xx_cfgchip_register_async3(cfgchip); + + /* pll1_sysclk2 is not affected by CPU scaling, so use it for async3 */ + parent = clk_hw_get_parent_by_index(__clk_get_hw(clk), 1); + if (parent) + clk_set_parent(clk, parent->clk); + else + pr_warn("%s: Failed to find async3 parent clock\n", __func__); + + da850_psc_clk_init(psc0, psc1); + + clk = clk_register_fixed_factor(NULL, "rmii", "pll0_sysclk7", 0, 1, 1); + clk_register_clkdev(clk, "rmii", NULL); + + clk = da8xx_cfgchip_register_tbclk(cfgchip); + clk_register_clkdev(clk, "tbclk", "ehrpwm.0"); + clk_register_clkdev(clk, "tbclk", "ehrpwm.1"); +#else struct regmap *cfgchip; cfgchip = da8xx_register_cfgchip(); @@ -1392,5 +1450,6 @@ void __init da850_init_time(void) regmap_write_bits(cfgchip, CFGCHIP(3), CFGCHIP3_PLL1_MASTER_LOCK, 0); davinci_clk_init(da850_clks); +#endif davinci_timer_init(); } -- 2.7.4