All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Shawn Lin <shawn.lin@rock-chips.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org, Stable <stable@vger.kernel.org>
Subject: Re: [PATCH] clk: update cached phase to respect the fact when setting phase
Date: Thu, 08 Mar 2018 10:41:37 +0100	[thread overview]
Message-ID: <1520502097.4264.3.camel@baylibre.com> (raw)
In-Reply-To: <1520491781-132529-1-git-send-email-shawn.lin@rock-chips.com>

On Thu, 2018-03-08 at 14:49 +0800, Shawn Lin wrote:
> It's found that the final phase set by driver doesn't match that of
> the output from clk_summary:
> 
> dwmmc_rockchip fe310000.dwmmc: Successfully tuned phase to 346
> mmc0: new ultra high speed SDR104 SDIO card at address 0001
> 
> cat /sys/kernel/debug/clk/clk_summary | grep sdio_sample
> sdio_sample	0        1        0    50000000 0 0
> 
> It seems the cached core->phase isn't updated after the clk was
> registered. So fix this issue by updating the core->phase if setting
> phase successfully.
> 
> Fixes: 9e4d04adeb1a ("clk: add clk_core_set_phase_nolock function")
> Cc: Stable <stable@vger.kernel.org>
> Cc: Jerome Brunet <jbrunet@baylibre.com>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

Good catch Shawn.
Actually, I have had already sent a fix for this issue

https://patchwork.kernel.org/patch/10220811/

But I think yours is better as it updates the phase only if the phase has
actually been set

Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com>

> ---
> 
>  drivers/clk/clk.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 0f686a9..617e562 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -2309,8 +2309,11 @@ static int clk_core_set_phase_nolock(struct clk_core *core, int degrees)
>  
>  	trace_clk_set_phase(core, degrees);
>  
> -	if (core->ops->set_phase)
> +	if (core->ops->set_phase) {
>  		ret = core->ops->set_phase(core->hw, degrees);
> +		if (!ret)
> +			core->phase = degrees;
> +	}
>  
>  	trace_clk_set_phase_complete(core, degrees);
>  

  reply	other threads:[~2018-03-08  9:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-08  6:49 [PATCH] clk: update cached phase to respect the fact when setting phase Shawn Lin
2018-03-08  9:41 ` Jerome Brunet [this message]
2018-03-12  1:28 ` Michael Turquette
2018-03-12  1:28   ` Michael Turquette

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=1520502097.4264.3.camel@baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=heiko@sntech.de \
    --cc=linux-clk@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=stable@vger.kernel.org \
    /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.