From: Sean Anderson <seanga2@gmail.com>
To: Patrick Delaunay <patrick.delaunay@foss.st.com>, u-boot@lists.denx.de
Cc: Tero Kristo <kristo@kernel.org>,
Sean Anderson <sean.anderson@seco.com>,
Tero Kristo <t-kristo@ti.com>, Lukasz Majewski <lukma@denx.de>,
U-Boot STM32 <uboot-stm32@st-md-mailman.stormreply.com>
Subject: Re: [RESEND PATCH v2] clk: update clk_clean_rate_cache to use private clk struct
Date: Sat, 13 Aug 2022 00:11:36 -0400 [thread overview]
Message-ID: <b778f10b-7c13-e4a9-1f91-9408f39eed98@gmail.com> (raw)
In-Reply-To: <20220712142352.RESEND.v2.1.Ifa06360115ffa3f3307372e6cdd98ec16759d6ba@changeid>
Hi Patrick,
Sorry for the (very late) response.
On 7/12/22 8:24 AM, Patrick Delaunay wrote:
> In clk_clean_rate_cache, clk->rate should update the private clock
> struct, in particular when CCF is activated, to save the cached
> rate value.
>
> When clk_get_parent_rate is called, the cached information
> is read from pclk->rate, with pclk = clk_get_parent(clk).
>
> As the cached is read from private clk data, the update should
> be done also on it.
>
> Fixes: 6b7fd3128f7 ("clk: fix set_rate to clean up cached rates for the hierarchy")
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
> Changes in v2:
> - set *clkp = clk when CCF is not activated and when the clock is not found
>
> drivers/clk/clk-uclass.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
> index b89c77bf794..5cfa022a6dc 100644
> --- a/drivers/clk/clk-uclass.c
> +++ b/drivers/clk/clk-uclass.c
> @@ -544,6 +544,19 @@ ulong clk_round_rate(struct clk *clk, ulong rate)
> return ops->round_rate(clk, rate);
> }
>
> +static void clk_get_priv(struct clk *clk, struct clk **clkp)
> +{
> + *clkp = clk;
> +
> + /* get private clock struct associated to the provided clock */
> + if (CONFIG_IS_ENABLED(CLK_CCF)) {
> + /* Take id 0 as a non-valid clk, such as dummy */
> + if (clk->id)
> + clk_get_by_id(clk->id, clkp);
> + }
> +}
> +
> +/* clean cache, called with private clock struct */
> static void clk_clean_rate_cache(struct clk *clk)
> {
> struct udevice *child_dev;
> @@ -563,6 +576,7 @@ static void clk_clean_rate_cache(struct clk *clk)
> ulong clk_set_rate(struct clk *clk, ulong rate)
> {
> const struct clk_ops *ops;
> + struct clk *clkp;
>
> debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate);
> if (!clk_valid(clk))
> @@ -572,8 +586,10 @@ ulong clk_set_rate(struct clk *clk, ulong rate)
> if (!ops->set_rate)
> return -ENOSYS;
>
> + /* get private clock struct used for cache */
> + clk_get_priv(clk, &clkp);
> /* Clean up cached rates for us and all child clocks */
> - clk_clean_rate_cache(clk);
> + clk_clean_rate_cache(clkp);
>
> return ops->set_rate(clk, rate);
> }
>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
prev parent reply other threads:[~2022-08-13 4:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-12 12:24 [RESEND PATCH v2] clk: update clk_clean_rate_cache to use private clk struct Patrick Delaunay
2022-08-13 4:11 ` Sean Anderson [this message]
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=b778f10b-7c13-e4a9-1f91-9408f39eed98@gmail.com \
--to=seanga2@gmail.com \
--cc=kristo@kernel.org \
--cc=lukma@denx.de \
--cc=patrick.delaunay@foss.st.com \
--cc=sean.anderson@seco.com \
--cc=t-kristo@ti.com \
--cc=u-boot@lists.denx.de \
--cc=uboot-stm32@st-md-mailman.stormreply.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox