From patchwork Thu Dec 6 19:07:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1846591 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 3FDF3400ED for ; Thu, 6 Dec 2012 19:10:29 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TggnV-0007Ct-VI; Thu, 06 Dec 2012 19:07:50 +0000 Received: from mail-ee0-f49.google.com ([74.125.83.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TggnS-0007C6-HJ for linux-arm-kernel@lists.infradead.org; Thu, 06 Dec 2012 19:07:47 +0000 Received: by mail-ee0-f49.google.com with SMTP id c4so3832591eek.36 for ; Thu, 06 Dec 2012 11:07:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=ORpbBZ9m/T88ZkYoOZMURto9JmoV9tGCWF5j54SWYqU=; b=Fy9QFfXxZkF4hbBFTGfXvSrdBmZDx1RN5S/He2t/Co+jG0aLqxgxtwBVpefjsZSo9C xspt9zevoxZTDpiGYRqTFfIzzxFafKmR/X2vWW4ice6zfeKWwcmLZd6XnwIQukdiMd/k 1Ke6wDSHgohJxCXJJiPbYXHxZtgRK9DXQTDJhnN0813cGJHckmeexy/M6oZS7RiDWXrq 1OMe2EZzXocYqoE0JxFI021WBUYGDUWxjsIq3W0QPns5ub0r+OvCB6q+Pp9QChuTuKR0 U9OnguKCXq1SOWTeuOYUZkcWj4fcqBoDUOkUkS55gbk5Nx9VsFhEdd63zMPY/iEsH7qq /pDA== MIME-Version: 1.0 Received: by 10.14.221.9 with SMTP id q9mr8638539eep.3.1354820862569; Thu, 06 Dec 2012 11:07:42 -0800 (PST) Received: by 10.223.13.215 with HTTP; Thu, 6 Dec 2012 11:07:42 -0800 (PST) In-Reply-To: <1354654823-1576-2-git-send-email-mturquette@linaro.org> References: <1354654823-1576-1-git-send-email-mturquette@linaro.org> <1354654823-1576-2-git-send-email-mturquette@linaro.org> Date: Thu, 6 Dec 2012 20:07:42 +0100 Message-ID: Subject: Re: [PATCH 1/2] clk: introduce optional disable_unused callback From: Linus Walleij To: Mike Turquette X-Gm-Message-State: ALoCoQn7gj0wJ5IlptrIUlAXFiyoQtlH6XYAeVwT775sj/jdnkKV2vr4ukyQKolhl7/BN82oqZg3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121206_140746_719162_4455C275 X-CRM114-Status: GOOD ( 20.57 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.83.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Paul Walmsley , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Tue, Dec 4, 2012 at 10:00 PM, Mike Turquette wrote: > Some gate clocks have special needs which must be handled during the > disable-unused clocks sequence. These needs might be driven by software > due to the fact that we're disabling a clock outside of the normal > clk_disable path and a clk's enable_count will not be accurate. On the > other hand a specific hardware programming sequence might need to be > followed for this corner case. > > This change is needed for the upcoming OMAP port to the common clock > framework. Specifically, it is undesirable to treat the disable-unused > path identically to the normal clk_disable path since other software > layers are involved. In this case OMAP's clockdomain code throws WARNs > and bails early due to the clock's enable_count being set to zero. A > custom callback mitigates this problem nicely. > > Cc: Paul Walmsley > Signed-off-by: Mike Turquette This semantic change: > - if (__clk_is_enabled(clk) && clk->ops->disable) > - clk->ops->disable(clk->hw); > + /* > + * some gate clocks have special needs during the disable-unused > + * sequence. call .disable_unused if available, otherwise fall > + * back to .disable > + */ > + if (__clk_is_enabled(clk)) { > + if (clk->ops->disable_unused) > + clk->ops->disable_unused(clk->hw); > + else if (clk->ops->disable) > + clk->ops->disable(clk->hw); > + } Means that you should probably go into all drivers and set their .disable_unused to point to the clk_disable() implentation. Something like the below (untested, Signed-off-by: Linus Walleij Yours, Linus Walleij Acked-by: Linus Walleij diff --git a/drivers/clk/clk-u300.c b/drivers/clk/clk-u300.c index a15f792..504abde 100644 --- a/drivers/clk/clk-u300.c +++ b/drivers/clk/clk-u300.c @@ -340,6 +340,7 @@ static const struct clk_ops syscon_clk_ops = { .unprepare = syscon_clk_unprepare, .enable = syscon_clk_enable, .disable = syscon_clk_disable, + .disable_unused = syscon_clk_disable, .is_enabled = syscon_clk_is_enabled, .recalc_rate = syscon_clk_recalc_rate, .round_rate = syscon_clk_round_rate, diff --git a/drivers/clk/ux500/clk-prcc.c b/drivers/clk/ux500/clk-prcc.c index 7eee7f7..1d3ff60 100644 --- a/drivers/clk/ux500/clk-prcc.c +++ b/drivers/clk/ux500/clk-prcc.c @@ -84,12 +84,14 @@ static int clk_prcc_is_enabled(struct clk_hw *hw) static struct clk_ops clk_prcc_pclk_ops = { .enable = clk_prcc_pclk_enable, .disable = clk_prcc_pclk_disable, + .disable_unused = clk_prcc_pclk_disable, .is_enabled = clk_prcc_is_enabled, }; static struct clk_ops clk_prcc_kclk_ops = { .enable = clk_prcc_kclk_enable, .disable = clk_prcc_kclk_disable, + .disable_unused = clk_prcc_kclk_disable, .is_enabled = clk_prcc_is_enabled, }; diff --git a/drivers/clk/ux500/clk-prcmu.c b/drivers/clk/ux500/clk-prcmu.c index 74faa7e..00498f2 100644 --- a/drivers/clk/ux500/clk-prcmu.c +++ b/drivers/clk/ux500/clk-prcmu.c @@ -172,6 +172,7 @@ static struct clk_ops clk_prcmu_scalable_ops = { .unprepare = clk_prcmu_unprepare, .enable = clk_prcmu_enable, .disable = clk_prcmu_disable, + .disable_unused = clk_prcmu_disable, .is_enabled = clk_prcmu_is_enabled, .recalc_rate = clk_prcmu_recalc_rate, .round_rate = clk_prcmu_round_rate, @@ -183,6 +184,7 @@ static struct clk_ops clk_prcmu_gate_ops = { .unprepare = clk_prcmu_unprepare, .enable = clk_prcmu_enable, .disable = clk_prcmu_disable, + .disable_unused = clk_prcmu_disable, .is_enabled = clk_prcmu_is_enabled, .recalc_rate = clk_prcmu_recalc_rate, }; @@ -204,6 +206,7 @@ static struct clk_ops clk_prcmu_opp_gate_ops = { .unprepare = clk_prcmu_opp_unprepare, .enable = clk_prcmu_enable, .disable = clk_prcmu_disable, + .disable_unused = clk_prcmu_disable, .is_enabled = clk_prcmu_is_enabled, .recalc_rate = clk_prcmu_recalc_rate, }; @@ -213,6 +216,7 @@ static struct clk_ops clk_prcmu_opp_volt_scalable_ops = { .unprepare = clk_prcmu_opp_volt_unprepare, .enable = clk_prcmu_enable, .disable = clk_prcmu_disable, + .disable_unused = clk_prcmu_disable, .is_enabled = clk_prcmu_is_enabled, .recalc_rate = clk_prcmu_recalc_rate, .round_rate = clk_prcmu_round_rate,