devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Haylen Chu <heylenay@4d2.org>
To: Yixun Lan <dlan@gentoo.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Haylen Chu <heylenay@outlook.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	linux-riscv@lists.infradead.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	spacemit@lists.linux.dev, Inochi Amaoto <inochiama@outlook.com>,
	Chen Wang <unicornxdotw@foxmail.com>,
	Jisheng Zhang <jszhang@kernel.org>,
	Meng Zhang <zhangmeng.kevin@linux.spacemit.com>
Subject: Re: [PATCH v6 3/6] clk: spacemit: Add clock support for SpacemiT K1 SoC
Date: Thu, 10 Apr 2025 03:55:35 +0000	[thread overview]
Message-ID: <Z_dBN6b8LfeMq1gz@ketchup> (raw)
In-Reply-To: <20250410005522-GYB19359@gentoo>

On Thu, Apr 10, 2025 at 12:55:22AM +0000, Yixun Lan wrote:
> On 17:24 Tue 01 Apr     , Haylen Chu wrote:
> > The clock tree of K1 SoC contains three main types of clock hardware
> > (PLL/DDN/MIX) and has control registers split into several multifunction
> > devices: APBS (PLLs), MPMU, APBC and APMU.
> > 
> > All register operations are done through regmap to ensure atomiciy
> > between concurrent operations of clock driver and reset,
> > power-domain driver that will be introduced in the future.
> > 
> > Signed-off-by: Haylen Chu <heylenay@4d2.org>
> > ---
> >  drivers/clk/Kconfig               |    1 +
> >  drivers/clk/Makefile              |    1 +
> >  drivers/clk/spacemit/Kconfig      |   18 +
> >  drivers/clk/spacemit/Makefile     |    5 +
> >  drivers/clk/spacemit/apbc_clks    |  100 +++
> >  drivers/clk/spacemit/ccu-k1.c     | 1316 +++++++++++++++++++++++++++++
> >  drivers/clk/spacemit/ccu_common.h |   48 ++
> >  drivers/clk/spacemit/ccu_ddn.c    |   83 ++
> >  drivers/clk/spacemit/ccu_ddn.h    |   47 ++
> >  drivers/clk/spacemit/ccu_mix.c    |  268 ++++++
> >  drivers/clk/spacemit/ccu_mix.h    |  218 +++++
> >  drivers/clk/spacemit/ccu_pll.c    |  157 ++++
> >  drivers/clk/spacemit/ccu_pll.h    |   86 ++
> >  13 files changed, 2348 insertions(+)
> >  create mode 100644 drivers/clk/spacemit/Kconfig
> >  create mode 100644 drivers/clk/spacemit/Makefile
> >  create mode 100644 drivers/clk/spacemit/apbc_clks
> >  create mode 100644 drivers/clk/spacemit/ccu-k1.c
> >  create mode 100644 drivers/clk/spacemit/ccu_common.h
> >  create mode 100644 drivers/clk/spacemit/ccu_ddn.c
> >  create mode 100644 drivers/clk/spacemit/ccu_ddn.h
> >  create mode 100644 drivers/clk/spacemit/ccu_mix.c
> >  create mode 100644 drivers/clk/spacemit/ccu_mix.h
> >  create mode 100644 drivers/clk/spacemit/ccu_pll.c
> >  create mode 100644 drivers/clk/spacemit/ccu_pll.h
> > 

...

> > diff --git a/drivers/clk/spacemit/ccu-k1.c b/drivers/clk/spacemit/ccu-k1.c
> > new file mode 100644
> > index 000000000000..cd95c4f9c127
> > --- /dev/null
> > +++ b/drivers/clk/spacemit/ccu-k1.c
> > @@ -0,0 +1,1316 @@

...

> > +/* APBC clocks start */
> > +static const struct clk_parent_data uart_clk_parents[] = {
> > +	CCU_PARENT_HW(pll1_m3d128_57p6),
> > +	CCU_PARENT_HW(slow_uart1_14p74),
> > +	CCU_PARENT_HW(slow_uart2_48),
> > +};
> > +CCU_MUX_GATE_DEFINE(uart0_clk, uart_clk_parents, APBC_UART1_CLK_RST, 4, 3,
> > +		    BIT(1), CLK_IS_CRITICAL);
> I'd request adding an explict documents for why need CLK_IS_CRITICAL flag
> (there are more place, I won't add comments)
> 
> Can you check this one? I think it's probably not necessary here,
> I can understand your concern of afraid of serial console breakage once clk
> driver merged, since we already enabled uart driver and using a dummy clk.. 
> 
> I think we probably could handle this carefully, sending an incrimental
> patch of uart to enable clk along with clk merged..

Yes, I've seen Alex's series on adding bus clocks to UART nodes and
could then depend on the series and add the correct UART clocks in
devicetree, then CLK_IS_CRITICAL to uart0_clk and uart0_bus_clk could go
away.

For other places applying CLK_IS_CRITICAL: it should be unnecessary for
cpu_c1_hi_clk, which is only a possible parent of CPU cluster 1's clock.
cci550_clk, cpu_c0_{core,ace,tcm}_clk and cpu_c1_{core,ace}_clk are
clocks for CPU cores. I think there's no good way to describe the
dependency in devicetree for now as we're lacking of a proper CPUfreq
driver, so I'd like to keep them as is (and may add a comment).

If there's a better way to handle these CPU clocks, I'd like to remove
the CLK_IS_CRITICAL flag as well.

> [...]
> -- 
> Yixun Lan (dlan)
> Gentoo Linux Developer
> GPG Key ID AABEFD55

Thanks,
Haylen Chu

  reply	other threads:[~2025-04-10  4:17 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01 17:24 [PATCH v6 0/6] Add clock controller support for SpacemiT K1 Haylen Chu
2025-04-01 17:24 ` [PATCH v6 1/6] dt-bindings: soc: spacemit: Add spacemit,k1-syscon Haylen Chu
2025-04-08 19:37   ` Alex Elder
2025-04-01 17:24 ` [PATCH v6 2/6] dt-bindings: clock: spacemit: Add spacemit,k1-pll Haylen Chu
2025-04-08 19:37   ` Alex Elder
2025-04-01 17:24 ` [PATCH v6 3/6] clk: spacemit: Add clock support for SpacemiT K1 SoC Haylen Chu
2025-04-08 19:37   ` Alex Elder
2025-04-10  0:37     ` Yixun Lan
2025-04-10  0:54       ` Inochi Amaoto
2025-04-10  0:57         ` Inochi Amaoto
2025-04-10  1:10           ` Alex Elder
2025-04-10  1:20             ` Inochi Amaoto
2025-04-10  1:55               ` Yixun Lan
2025-04-10  3:47                 ` Inochi Amaoto
2025-04-10 12:30                   ` Alex Elder
2025-04-10 12:32                     ` Alex Elder
2025-04-10  4:07                 ` Haylen Chu
2025-04-11 17:14                 ` Goko Son
2025-04-10  1:16           ` Yixun Lan
2025-04-10  1:35             ` Inochi Amaoto
2025-04-10  6:54     ` Haylen Chu
2025-04-10  0:55   ` Yixun Lan
2025-04-10  3:55     ` Haylen Chu [this message]
2025-04-01 17:24 ` [PATCH v6 4/6] clk: spacemit: k1: Add TWSI8 bus and function clocks Haylen Chu
2025-04-08 19:37   ` Alex Elder
2025-04-10  4:09     ` Haylen Chu
2025-04-01 17:24 ` [PATCH v6 5/6] riscv: dts: spacemit: Add clock tree for SpacemiT K1 Haylen Chu
2025-04-08 19:37   ` Alex Elder
2025-04-01 17:24 ` [PATCH v6 6/6] riscv: defconfig: enable clock controller unit support " Haylen Chu
2025-04-08 19:37   ` Alex Elder
2025-04-10  4:12     ` Haylen Chu
2025-04-08 19:37 ` [PATCH v6 0/6] Add clock controller " Alex Elder

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=Z_dBN6b8LfeMq1gz@ketchup \
    --to=heylenay@4d2.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@gentoo.org \
    --cc=heylenay@outlook.com \
    --cc=inochiama@outlook.com \
    --cc=jszhang@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mturquette@baylibre.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=spacemit@lists.linux.dev \
    --cc=unicornxdotw@foxmail.com \
    --cc=zhangmeng.kevin@linux.spacemit.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;
as well as URLs for NNTP newsgroup(s).