All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Welling <mwelling@ieee.org>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Mike Turquette <mturquette@linaro.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Jean-Francois Moine <moinejf@free.fr>,
	Russell King <rmk+linux@arm.linux.org.uk>,
	devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] clk: si5351: Reset PLL after rate change
Date: Thu, 30 Apr 2015 13:49:32 -0500	[thread overview]
Message-ID: <20150430184932.GB22000@deathray> (raw)
In-Reply-To: <1430415954-29517-5-git-send-email-sebastian.hesselbarth@gmail.com>

On Thu, Apr 30, 2015 at 07:45:54PM +0200, Sebastian Hesselbarth wrote:
> When changing PLL rate significantly, PLLs have to be reset. Add a function
> to perform and check for successful PLL reset.
> 
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Cc: Mike Turquette <mturquette@linaro.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Jean-Francois Moine <moinejf@free.fr>
> Cc: Michael Welling <mwelling@ieee.org>
> Cc: Russell King <rmk+linux@arm.linux.org.uk>
> Cc: devicetree@vger.kernel.org
> Cc: linux-clk@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/clk/clk-si5351.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
> index beeb57bbb04c..9b97c134e3c1 100644
> --- a/drivers/clk/clk-si5351.c
> +++ b/drivers/clk/clk-si5351.c
> @@ -366,6 +366,32 @@ static const struct clk_ops si5351_vxco_ops = {
>   *         = (MSNx_P1*MSNx_P3 + MSNx_P2 + 512*MSNx_P3)/(128*MSNx_P3)
>   *
>   */
> +static int si5351_pll_reset(struct si5351_hw_data *hwdata)
> +{
> +	unsigned long timeout;
> +	u8 mask = (hwdata->num == 0) ?
> +		SI5351_STATUS_LOL_A : SI5351_STATUS_LOL_B;
> +
> +	si5351_reg_write(hwdata->drvdata, SI5351_PLL_RESET,
> +			 (hwdata->num == 0) ? SI5351_PLL_RESET_A :
> +			 SI5351_PLL_RESET_B);
> +	timeout = jiffies + msecs_to_jiffies(100);
> +	do {
> +		if ((si5351_reg_read(hwdata->drvdata, SI5351_DEVICE_STATUS) &
> +		     mask) == 0)
> +			break;
> +		if (time_after(jiffies, timeout)) {
> +			dev_err(&hwdata->drvdata->client->dev,
> +				"timeout waiting for pll %d reset\n",
> +				hwdata->num);
> +			return -EBUSY;
> +		};
> +		udelay(250);
> +	} while (true);
> +
> +	return 0;
> +}
> +
>  static int _si5351_pll_reparent(struct si5351_driver_data *drvdata,
>  				int num, enum si5351_pll_src parent)
>  {
> @@ -519,6 +545,9 @@ static int si5351_pll_set_rate(struct clk_hw *hw, unsigned long rate,
>  		SI5351_CLK_INTEGER_MODE,
>  		(hwdata->params.p2 == 0) ? SI5351_CLK_INTEGER_MODE : 0);
>  
> +	/* reset pll after rate change */
> +	si5351_pll_reset(hwdata);
> +

What is the point of having a return code if it is not being used?

>  	dev_dbg(&hwdata->drvdata->client->dev,
>  		"%s - %s: p1 = %lu, p2 = %lu, p3 = %lu, parent_rate = %lu, rate = %lu\n",
>  		__func__, __clk_get_name(hwdata->hw.clk),
> -- 
> 2.1.0
> 

WARNING: multiple messages have this Message-ID (diff)
From: mwelling@ieee.org (Michael Welling)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] clk: si5351: Reset PLL after rate change
Date: Thu, 30 Apr 2015 13:49:32 -0500	[thread overview]
Message-ID: <20150430184932.GB22000@deathray> (raw)
In-Reply-To: <1430415954-29517-5-git-send-email-sebastian.hesselbarth@gmail.com>

On Thu, Apr 30, 2015 at 07:45:54PM +0200, Sebastian Hesselbarth wrote:
> When changing PLL rate significantly, PLLs have to be reset. Add a function
> to perform and check for successful PLL reset.
> 
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Cc: Mike Turquette <mturquette@linaro.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Jean-Francois Moine <moinejf@free.fr>
> Cc: Michael Welling <mwelling@ieee.org>
> Cc: Russell King <rmk+linux@arm.linux.org.uk>
> Cc: devicetree at vger.kernel.org
> Cc: linux-clk at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> ---
>  drivers/clk/clk-si5351.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
> index beeb57bbb04c..9b97c134e3c1 100644
> --- a/drivers/clk/clk-si5351.c
> +++ b/drivers/clk/clk-si5351.c
> @@ -366,6 +366,32 @@ static const struct clk_ops si5351_vxco_ops = {
>   *         = (MSNx_P1*MSNx_P3 + MSNx_P2 + 512*MSNx_P3)/(128*MSNx_P3)
>   *
>   */
> +static int si5351_pll_reset(struct si5351_hw_data *hwdata)
> +{
> +	unsigned long timeout;
> +	u8 mask = (hwdata->num == 0) ?
> +		SI5351_STATUS_LOL_A : SI5351_STATUS_LOL_B;
> +
> +	si5351_reg_write(hwdata->drvdata, SI5351_PLL_RESET,
> +			 (hwdata->num == 0) ? SI5351_PLL_RESET_A :
> +			 SI5351_PLL_RESET_B);
> +	timeout = jiffies + msecs_to_jiffies(100);
> +	do {
> +		if ((si5351_reg_read(hwdata->drvdata, SI5351_DEVICE_STATUS) &
> +		     mask) == 0)
> +			break;
> +		if (time_after(jiffies, timeout)) {
> +			dev_err(&hwdata->drvdata->client->dev,
> +				"timeout waiting for pll %d reset\n",
> +				hwdata->num);
> +			return -EBUSY;
> +		};
> +		udelay(250);
> +	} while (true);
> +
> +	return 0;
> +}
> +
>  static int _si5351_pll_reparent(struct si5351_driver_data *drvdata,
>  				int num, enum si5351_pll_src parent)
>  {
> @@ -519,6 +545,9 @@ static int si5351_pll_set_rate(struct clk_hw *hw, unsigned long rate,
>  		SI5351_CLK_INTEGER_MODE,
>  		(hwdata->params.p2 == 0) ? SI5351_CLK_INTEGER_MODE : 0);
>  
> +	/* reset pll after rate change */
> +	si5351_pll_reset(hwdata);
> +

What is the point of having a return code if it is not being used?

>  	dev_dbg(&hwdata->drvdata->client->dev,
>  		"%s - %s: p1 = %lu, p2 = %lu, p3 = %lu, parent_rate = %lu, rate = %lu\n",
>  		__func__, __clk_get_name(hwdata->hw.clk),
> -- 
> 2.1.0
> 

  reply	other threads:[~2015-04-30 18:49 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 17:45 [PATCH 0/4] clk: si5351: Some fixes Sebastian Hesselbarth
2015-04-30 17:45 ` Sebastian Hesselbarth
2015-04-30 17:45 ` Sebastian Hesselbarth
2015-04-30 17:45 ` [PATCH 1/4] clk: si5351: Mention clock-names in the binding documentation Sebastian Hesselbarth
2015-04-30 17:45   ` Sebastian Hesselbarth
2015-04-30 17:45 ` [PATCH 2/4] ARM: dove: Add clock-names to CuBox Si5351 clk generator Sebastian Hesselbarth
2015-04-30 17:45   ` Sebastian Hesselbarth
2015-04-30 17:45 ` [PATCH 3/4] clk: si5351: Do not pass struct clk in platform_data Sebastian Hesselbarth
2015-04-30 17:45   ` Sebastian Hesselbarth
2015-04-30 18:20   ` Fabio Estevam
2015-04-30 18:20     ` Fabio Estevam
2015-04-30 18:30     ` Michael Welling
2015-04-30 18:30       ` Michael Welling
2015-04-30 18:44       ` Sebastian Hesselbarth
2015-04-30 18:44         ` Sebastian Hesselbarth
2015-04-30 19:16         ` Fabio Estevam
2015-04-30 19:16           ` Fabio Estevam
2015-04-30 20:46           ` Sebastian Hesselbarth
2015-04-30 20:46             ` Sebastian Hesselbarth
2015-04-30 17:45 ` [PATCH 4/4] clk: si5351: Reset PLL after rate change Sebastian Hesselbarth
2015-04-30 17:45   ` Sebastian Hesselbarth
2015-04-30 18:49   ` Michael Welling [this message]
2015-04-30 18:49     ` Michael Welling
2015-04-30 18:58     ` Sebastian Hesselbarth
2015-04-30 18:58       ` Sebastian Hesselbarth
2015-04-30 18:47 ` [PATCH 0/4] clk: si5351: Some fixes Michael Welling
2015-04-30 18:47   ` Michael Welling
2015-04-30 19:33 ` Michael Welling
2015-04-30 19:33   ` Michael Welling
2015-04-30 19:33   ` Michael Welling
2015-04-30 20:44   ` Sebastian Hesselbarth
2015-04-30 20:44     ` Sebastian Hesselbarth
2015-04-30 20:44     ` Sebastian Hesselbarth
2015-04-30 21:20     ` Michael Welling
2015-04-30 21:20       ` Michael Welling
2015-04-30 21:20       ` Michael Welling
2015-04-30 22:21       ` Sebastian Hesselbarth
2015-04-30 22:21         ` Sebastian Hesselbarth
2015-04-30 22:21         ` Sebastian Hesselbarth
2015-04-30 22:36         ` Michael Welling
2015-04-30 22:36           ` Michael Welling
2015-04-30 22:36           ` Michael Welling
2015-05-01  8:17           ` Sebastian Hesselbarth
2015-05-01  8:17             ` Sebastian Hesselbarth
2015-05-01  8:17             ` Sebastian Hesselbarth
2015-05-08  0:52             ` Michael Welling
2015-05-08  0:52               ` Michael Welling
2015-05-01  9:14 ` Jean-Francois Moine
2015-05-01  9:14   ` Jean-Francois Moine
2015-05-01  9:14   ` Jean-Francois Moine
2015-05-01  9:14   ` Jean-Francois Moine
2015-05-01  9:30   ` Sebastian Hesselbarth
2015-05-01  9:30     ` Sebastian Hesselbarth
2015-05-02  8:53     ` Jean-Francois Moine
2015-05-02  8:55     ` Jean-Francois Moine
2015-05-02  8:55       ` Jean-Francois Moine
2015-05-02  8:55       ` Jean-Francois Moine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150430184932.GB22000@deathray \
    --to=mwelling@ieee.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=moinejf@free.fr \
    --cc=mturquette@linaro.org \
    --cc=rmk+linux@arm.linux.org.uk \
    --cc=sboyd@codeaurora.org \
    --cc=sebastian.hesselbarth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.