From patchwork Fri Mar 21 08:02:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 26792 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8B4EA203AB for ; Fri, 21 Mar 2014 08:03:20 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id p10sf4710601pdj.11 for ; Fri, 21 Mar 2014 01:03:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:subject:references:in-reply-to:cc:precedence :list-id:list-unsubscribe:list-archive:list-post:list-help :list-subscribe:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list :content-transfer-encoding:content-type; bh=eKadx7Iqs1t3lWxpv726HYIT2mRV0lrFqWbIk++H+sQ=; b=YH3bUWBfO45Bl2fzGNp4KwWetOlTjANinuHbXFli39CrdDPkntJa448OxTt7hHXm2O DwuCvv/FNz8O/xJlJuF28v1O7lMoJgqIcnPWAxVacfHT03l9k9dKaKC3eIxNj9j1yEj3 QjAaPAXpds8XQXDqZhABHljxEcG1CQ857BspLJXjqPg1LgjWCIOhyINo4WXRqJjarfAk ihcI2+3UKNkAk3gRVoOu8C3Su4CPaLBq5JzfZYmiAXKnM9V3RBMRFhic98KzUUB1kmbG /uXBAM4Lo0GfrT4fROSP0kv2cXZ/ExePAfrL3dI6igrdzQzyID3r5MMC9A5s2TkXmmHh TBtg== X-Gm-Message-State: ALoCoQlTcjuckcBHqczsodF38T7+xRvGnlSQagR5q7JCmgoT79DLLYBc61vVGz+E4eNAODMV7yKP X-Received: by 10.66.145.105 with SMTP id st9mr21266666pab.23.1395388999688; Fri, 21 Mar 2014 01:03:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.107.198 with SMTP id h64ls569216qgf.84.gmail; Fri, 21 Mar 2014 01:03:19 -0700 (PDT) X-Received: by 10.220.146.13 with SMTP id f13mr92157vcv.57.1395388999569; Fri, 21 Mar 2014 01:03:19 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id bw7si970701vcb.159.2014.03.21.01.03.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Mar 2014 01:03:19 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hu19so2236424vcb.29 for ; Fri, 21 Mar 2014 01:03:19 -0700 (PDT) X-Received: by 10.52.90.37 with SMTP id bt5mr3646508vdb.7.1395388999455; Fri, 21 Mar 2014 01:03:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp12282vck; Fri, 21 Mar 2014 01:03:18 -0700 (PDT) X-Received: by 10.180.38.41 with SMTP id d9mr1023715wik.9.1395388997881; Fri, 21 Mar 2014 01:03:17 -0700 (PDT) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id o15si374296wjr.159.2014.03.21.01.03.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Mar 2014 01:03:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQuPo-0003s8-Ld; Fri, 21 Mar 2014 08:02:56 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQuPm-0003al-31; Fri, 21 Mar 2014 08:02:54 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQuPj-0003Zi-1t for linux-arm-kernel@lists.infradead.org; Fri, 21 Mar 2014 08:02:51 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s2L82SEE001095; Fri, 21 Mar 2014 03:02:28 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2L82SIH008155; Fri, 21 Mar 2014 03:02:28 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Fri, 21 Mar 2014 03:02:27 -0500 Received: from [172.22.232.38] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2L82PK3014171; Fri, 21 Mar 2014 03:02:26 -0500 Message-ID: <532BF211.30203@ti.com> Date: Fri, 21 Mar 2014 10:02:25 +0200 From: Tero Kristo User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Mike Turquette , Subject: Re: [PATCH 0/4] clk: dt: add support for default rate/parent References: <1392282048-6284-1-git-send-email-t-kristo@ti.com> <53172239.3030705@ti.com> <20140320212308.21989.36094@quantum> In-Reply-To: <20140320212308.21989.36094@quantum> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140321_040251_164606_96F670BD X-CRM114-Status: GOOD ( 24.02 ) X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.153 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: t-kristo@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 On 03/20/2014 11:23 PM, Mike Turquette wrote: > Quoting Tero Kristo (2014-03-05 05:10:17) >> Ping. >> >> Mike, any feedback on this? > > Hi Tero, > > Have you seen Sylwester's approach[1]? I prefer it since it is more > device-oriented and less "centralized". The clock consumer enumerates > the default parent or rate of a consumed clock. This can be made to work > like your approach by having the clock driver consume these clocks and > set them up with default rates or parents. What do you think? Just saw the patches yesterday. I think that approach would work in most cases, however I guess there might be cases where you need to setup the rate/parent of a clock very early in boot (basically when you are registering the clock itself) to avoid any race issues with drivers (or the clock framework itself) coming in and using a clock that is not properly setup yet. But well, I guess these can be handled by some init time tweaks. I just converted the OMAP4 code to the format provided by Sylwester's patches and it seems to work fine. The patch should be changed eventually to probe at the time when the CM/PRM instances are probed. Inlined here as reference: From 1b05e03bbd3fb5a4f5192444e7d4365f177c1756 Mon Sep 17 00:00:00 2001 From: Tero Kristo Date: Fri, 21 Mar 2014 09:52:47 +0200 Subject: [PATCH] CLK: TI: OMAP4: setup default clocks / rates using the clock consumer approach Signed-off-by: Tero Kristo --- arch/arm/boot/dts/omap4.dtsi | 8 ++++++++ drivers/clk/ti/clk-44xx.c | 44 ------------------------------------------ drivers/clk/ti/clk.c | 41 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 44 deletions(-) +module_exit(ti_clk_exit); diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index d3f8a6e..4826168 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi @@ -88,6 +88,14 @@ }; }; + default-clocks { + compatible = "ti,default-clocks"; + clocks = <&abe_dpll_refclk_mux_ck>, <&dpll_usb_ck>, + <&dpll_abe_ck>; + clock-parents = <&sys_32k_ck>; + clock-rates = <0>, <960000000>, <98304000>; + }; + /* * XXX: Use a flat representation of the OMAP4 interconnect. * The real OMAP interconnect network is quite complex. diff --git a/drivers/clk/ti/clk-44xx.c b/drivers/clk/ti/clk-44xx.c index ae00218..dfafb96 100644 --- a/drivers/clk/ti/clk-44xx.c +++ b/drivers/clk/ti/clk-44xx.c @@ -16,21 +16,6 @@ #include #include -/* - * OMAP4 ABE DPLL default frequency. In OMAP4460 TRM version V, section - * "3.6.3.2.3 CM1_ABE Clock Generator" states that the "DPLL_ABE_X2_CLK - * must be set to 196.608 MHz" and hence, the DPLL locked frequency is - * half of this value. - */ -#define OMAP4_DPLL_ABE_DEFFREQ 98304000 - -/* - * OMAP4 USB DPLL default frequency. In OMAP4430 TRM version V, section - * "3.6.3.9.5 DPLL_USB Preferred Settings" shows that the preferred - * locked frequency for the USB DPLL is 960MHz. - */ -#define OMAP4_DPLL_USB_DEFFREQ 960000000 - static struct ti_dt_clk omap44xx_clks[] = { DT_CLK(NULL, "extalt_clkin_ck", "extalt_clkin_ck"), DT_CLK(NULL, "pad_clks_src_ck", "pad_clks_src_ck"), @@ -281,36 +266,7 @@ static struct ti_dt_clk omap44xx_clks[] = { int __init omap4xxx_dt_clk_init(void) { - int rc; - struct clk *abe_dpll_ref, *abe_dpll, *sys_32k_ck, *usb_dpll; - ti_dt_clocks_register(omap44xx_clks); - omap2_clk_disable_autoidle_all(); - - /* - * Lock USB DPLL on OMAP4 devices so that the L3INIT power - * domain can transition to retention state when not in use. - */ - usb_dpll = clk_get_sys(NULL, "dpll_usb_ck"); - rc = clk_set_rate(usb_dpll, OMAP4_DPLL_USB_DEFFREQ); - if (rc) - pr_err("%s: failed to configure USB DPLL!\n", __func__); - - /* - * On OMAP4460 the ABE DPLL fails to turn on if in idle low-power - * state when turning the ABE clock domain. Workaround this by - * locking the ABE DPLL on boot. - * Lock the ABE DPLL in any case to avoid issues with audio. - */ - abe_dpll_ref = clk_get_sys(NULL, "abe_dpll_refclk_mux_ck"); - sys_32k_ck = clk_get_sys(NULL, "sys_32k_ck"); - rc = clk_set_parent(abe_dpll_ref, sys_32k_ck); - abe_dpll = clk_get_sys(NULL, "dpll_abe_ck"); - if (!rc) - rc = clk_set_rate(abe_dpll, OMAP4_DPLL_ABE_DEFFREQ); - if (rc) - pr_err("%s: failed to configure ABE DPLL!\n", __func__); - return 0; } diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c index b1a6f71..469fd4e 100644 --- a/drivers/clk/ti/clk.c +++ b/drivers/clk/ti/clk.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #undef pr_fmt #define pr_fmt(fmt) "%s: " fmt, __func__ @@ -165,3 +167,41 @@ void ti_dt_clk_init_provider(struct device_node *parent, int index) kfree(retry); } } + +static int ti_clk_probe(struct platform_device *pdev) +{ + return 0; +} + +static int ti_clk_remove(struct platform_device *dev) +{ + return 0; +} + +static const struct of_device_id ti_clk_match[] = { + { .compatible = "ti,default-clocks" }, + {}, +}; +MODULE_DEVICE_TABLE(of, ti_clk_match); + +static struct platform_driver ti_clk_driver = { + .probe = ti_clk_probe, + .remove = ti_clk_remove, + .driver = { + .name = "ti-clk", + .of_match_table = of_match_ptr(ti_clk_match), + }, +}; + +static int __init ti_clk_init(void) +{ + return platform_driver_register(&ti_clk_driver); +} + +static void __exit ti_clk_exit(void) +{ + platform_driver_unregister(&ti_clk_driver); +} + +module_init(ti_clk_init);