All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Xuyang Dong" <dongxuyang@eswincomputing.com>
To: "Troy Mitchell" <troy.mitchell@linux.dev>,
	"Bo Gan" <ganboing@gmail.com>,
	mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, bmasney@redhat.com
Cc: ningyu@eswincomputing.com, linmin@eswincomputing.com,
	huangyifeng@eswincomputing.com, pinkesh.vaghela@einfochips.com
Subject: Re: Re: [PATCH v8 2/3] clock: eswin: Add eic7700 clock driver
Date: Mon, 22 Dec 2025 17:29:48 +0800 (GMT+08:00)	[thread overview]
Message-ID: <6077b3be.17c4.19b4564be0d.Coremail.dongxuyang@eswincomputing.com> (raw)
In-Reply-To: <aUYXPBFhqz3Frdmo@troy-wujie14pro-arch>

> > 
> > ...
> > 
> > > > +static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
> > > > +			    unsigned long parent_rate)
> > > > +{
> > > > +	struct eswin_clk_pll *clk = to_pll_clk(hw);
> > > > +	struct clk *clk_cpu_lp_pll = NULL;
> > > > +	struct clk *clk_cpu_mux = NULL;
> > > > +	struct clk *clk_cpu_pll = NULL;
> > > > +	u32 postdiv1_val = 0, refdiv_val = 1;
> > > > +	u32 frac_val, fbdiv_val, val;
> > > > +	bool lock_flag = false;
> > > > +	int try_count = 0;
> > > > +	int ret;
> > > > +
> > > > +	ret = eswin_calc_pll(&frac_val,  &fbdiv_val, (u64)rate, clk);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	/* Must switch the CPU to other CLK before we change the CPU PLL. */
> > > > +	if (clk->id == EIC7700_CLK_PLL_CPU) {
> > > > +		clk_cpu_mux = __clk_lookup("mux_cpu_root_3mux1_gfree");
> > > It seems you want to switch to a safe clock source before setting up the
> > > PLL, right?
> > > 
> > > I am not sure whether your approach is correct, but the use of
> > > __clk_lookup() should be avoided whenever possible.
> > > Would it be feasible to obtain a proper clock handle somewhere and
> > > perform the necessary configuration from within a clk_notifier instead?
> > > > +		if (!clk_cpu_mux) {
> > > > +			pr_err("failed to get clk: %s\n",
> > > > +			       "mux_cpu_root_3mux1_gfree");
> > > > +			return -EINVAL;
> > > > +		}
> > 
> > I have a strong feeling that this switch to safe clock and back to PLL
> > can be done with something very similar to this:
> > 
> > "Add notifier for PLL0 clock and set it 1.5GHz on the JH7110 SoC"
> > https://lore.kernel.org/all/20240826080430.179788-1-xingyu.wu@starfivetech.com/
> > 
> YES, That's what I want.
> Thanks for your link!
> 
>                     - Troy
> > Please take a look. Thanks!
> > 
> > Bo

Thanks. The mentioned problems will be corrected in the subsequent patch version.

Regards,
Xuyang Dong


  reply	other threads:[~2025-12-22  9:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-13  1:36 [PATCH v8 0/3] Add driver support for ESWIN eic700 SoC clock controller dongxuyang
2025-11-13  1:38 ` [PATCH v8 1/3] dt-bindings: clock: eswin: Documentation for eic7700 SoC dongxuyang
2025-11-13  1:38 ` [PATCH v8 2/3] clock: eswin: Add eic7700 clock driver dongxuyang
2025-12-19  2:50   ` Troy Mitchell
2025-12-19 22:39     ` Bo Gan
2025-12-20  3:25       ` Troy Mitchell
2025-12-22  9:29         ` Xuyang Dong [this message]
2025-11-13  1:39 ` [PATCH v8 3/3] MAINTAINERS: Add entry for ESWIN EIC7700 " dongxuyang
2025-11-26  7:54 ` [PATCH v8 0/3] Add driver support for ESWIN eic700 SoC clock controller Xuyang Dong
2025-12-15  2:44   ` Xuyang Dong

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=6077b3be.17c4.19b4564be0d.Coremail.dongxuyang@eswincomputing.com \
    --to=dongxuyang@eswincomputing.com \
    --cc=bmasney@redhat.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ganboing@gmail.com \
    --cc=huangyifeng@eswincomputing.com \
    --cc=krzk+dt@kernel.org \
    --cc=linmin@eswincomputing.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=ningyu@eswincomputing.com \
    --cc=pinkesh.vaghela@einfochips.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=troy.mitchell@linux.dev \
    /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.