From patchwork Tue Jun 28 16:09:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9203513 X-Patchwork-Delegate: sboyd@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 45C886075F for ; Tue, 28 Jun 2016 16:09:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36F222860D for ; Tue, 28 Jun 2016 16:09:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2876828605; Tue, 28 Jun 2016 16:09:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90FF328605 for ; Tue, 28 Jun 2016 16:09:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752218AbcF1QJ2 (ORCPT ); Tue, 28 Jun 2016 12:09:28 -0400 Received: from etezian.org ([198.101.225.253]:54707 "EHLO mail.etezian.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751864AbcF1QJ1 (ORCPT ); Tue, 28 Jun 2016 12:09:27 -0400 Received: from mail.etezian.org (unknown [211.196.237.107]) by mail.etezian.org (Postfix) with ESMTPA id C6E2922001; Tue, 28 Jun 2016 11:10:29 -0500 (CDT) Date: Wed, 29 Jun 2016 01:09:22 +0900 From: Andi Shyti To: Heiko Stuebner Cc: andi.shyti@gmail.com, Jeffy Chen , Xing Zheng , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Andi Shyti Subject: Re: [PATCH 1/2] clk: clk-rk3*: set CLK_IS_CRITICAL flag to critical clocks Message-ID: <20160628160922.GN424@jack.zhora.eu> References: <1467125137-25999-1-git-send-email-andi@etezian.org> <1467125137-25999-2-git-send-email-andi@etezian.org> <29356205.Gk5k6xKH6K@phil> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <29356205.Gk5k6xKH6K@phil> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Heiko, > > RK2928_CLKSEL_CON(0), 14, 2, MFLAGS, 8, 5, DFLAGS), > > - GATE(ACLK_CPU, "aclk_cpu", "aclk_cpu_src", CLK_IGNORE_UNUSED, > > + GATE(ACLK_CPU, "aclk_cpu", "aclk_cpu_src", > > + CLK_IS_CRITICAL | CLK_IGNORE_UNUSED, > > - you'll never need both critical and ignore_unused Indeed I was unsure whether I should remove the CLK_IGNORE_UNUSED, but then I decided to leave it because that's basically what the driver is currently doing. Thanks! > Happens in some more cases below, but otherwise looks ok ... as written in > the cover-letter I'm just still trying to make up my mind if it's worth > waiting for the handoff mechanism. You mean something similar (*)? Thanks, Andi (*) @@ -2403,7 +2407,7 @@ static int __clk_core_init(struct clk_core *core) if (core->ops->init) core->ops->init(core->hw); - if (core->flags & CLK_IS_CRITICAL) { + if (core->flags & CLK_IS_CRITICAL || core->flags & CLK_HANDOFF) { unsigned long flags; clk_core_prepare(core); --- To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 89cc700..5698ef1 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -201,11 +201,19 @@ struct clk *clk_get(struct device *dev, const char *con_id) if (dev) { clk = __of_clk_get_by_name(dev->of_node, dev_id, con_id); - if (!IS_ERR(clk) || PTR_ERR(clk) == -EPROBE_DEFER) + if (!IS_ERR(clk)) { + clk->clk_core->flags &= ~CLK_HANDOFF; + return clk; + } + if (PTR_ERR(clk) == -EPROBE_DEFER) return clk; } - return clk_get_sys(dev_id, con_id); + clk = clk_get_sys(dev_id, con_id); + if (!IS_ERR(clk)) + clk->clk_core->flags &= ~CLK_HANDOFF; + + return clk; } EXPORT_SYMBOL(clk_get); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index fb39d5a..39684ec 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -33,6 +33,7 @@ #define CLK_RECALC_NEW_RATES BIT(9) /* recalc rates after notifications */ #define CLK_SET_RATE_UNGATE BIT(10) /* clock needs to run to set rate */ #define CLK_IS_CRITICAL BIT(11) /* do not gate, ever */ +#define CLK_HANDOFF BIT(12) /* do not gate, ever */ struct clk; struct clk_hw;