From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752394AbbKJKLN (ORCPT ); Tue, 10 Nov 2015 05:11:13 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:41552 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752184AbbKJKLL (ORCPT ); Tue, 10 Nov 2015 05:11:11 -0500 Message-ID: <1447150266.3142.11.camel@pengutronix.de> Subject: Re: [PATCH] clk: imx: add 'is_prepared' clk_ops callback for pllv3 clk From: Lucas Stach To: Bai Ping Cc: shawnguo@kernel.org, kernel@pengutronix.de, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Tue, 10 Nov 2015 11:11:06 +0100 In-Reply-To: <1446487569-20757-1-git-send-email-b51503@freescale.com> References: <1446487569-20757-1-git-send-email-b51503@freescale.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:fa0f:41ff:fe58:4010 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Dienstag, den 03.11.2015, 02:06 +0800 schrieb Bai Ping: > Add 'is_prepared' callback function for pllv3 type clk to make sure when > the system is bootup, the unused clk is in a known state to match the > prepare count info. > > Signed-off-by: Bai Ping Reviewed-by: Lucas Stach > --- > drivers/clk/imx/clk-pllv3.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c > index 6addf8f..c05c43d 100644 > --- a/drivers/clk/imx/clk-pllv3.c > +++ b/drivers/clk/imx/clk-pllv3.c > @@ -97,6 +97,16 @@ static void clk_pllv3_unprepare(struct clk_hw *hw) > writel_relaxed(val, pll->base); > } > > +static int clk_pllv3_is_prepared(struct clk_hw *hw) > +{ > + struct clk_pllv3 *pll = to_clk_pllv3(hw); > + > + if (readl_relaxed(pll->base) & BM_PLL_LOCK) > + return 1; > + > + return 0; > +} > + > static unsigned long clk_pllv3_recalc_rate(struct clk_hw *hw, > unsigned long parent_rate) > { > @@ -139,6 +149,7 @@ static int clk_pllv3_set_rate(struct clk_hw *hw, unsigned long rate, > static const struct clk_ops clk_pllv3_ops = { > .prepare = clk_pllv3_prepare, > .unprepare = clk_pllv3_unprepare, > + .is_prepared = clk_pllv3_is_prepared, > .recalc_rate = clk_pllv3_recalc_rate, > .round_rate = clk_pllv3_round_rate, > .set_rate = clk_pllv3_set_rate, > @@ -193,6 +204,7 @@ static int clk_pllv3_sys_set_rate(struct clk_hw *hw, unsigned long rate, > static const struct clk_ops clk_pllv3_sys_ops = { > .prepare = clk_pllv3_prepare, > .unprepare = clk_pllv3_unprepare, > + .is_prepared = clk_pllv3_is_prepared, > .recalc_rate = clk_pllv3_sys_recalc_rate, > .round_rate = clk_pllv3_sys_round_rate, > .set_rate = clk_pllv3_sys_set_rate, > @@ -265,6 +277,7 @@ static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate, > static const struct clk_ops clk_pllv3_av_ops = { > .prepare = clk_pllv3_prepare, > .unprepare = clk_pllv3_unprepare, > + .is_prepared = clk_pllv3_is_prepared, > .recalc_rate = clk_pllv3_av_recalc_rate, > .round_rate = clk_pllv3_av_round_rate, > .set_rate = clk_pllv3_av_set_rate, > @@ -279,6 +292,7 @@ static unsigned long clk_pllv3_enet_recalc_rate(struct clk_hw *hw, > static const struct clk_ops clk_pllv3_enet_ops = { > .prepare = clk_pllv3_prepare, > .unprepare = clk_pllv3_unprepare, > + .is_prepared = clk_pllv3_is_prepared, > .recalc_rate = clk_pllv3_enet_recalc_rate, > }; > -- Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ |