From: Haylen Chu <heylenay@4d2.org>
To: Alex Elder <elder@riscstar.com>,
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>, Yixun Lan <dlan@gentoo.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>
Cc: 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 4/6] clk: spacemit: k1: Add TWSI8 bus and function clocks
Date: Thu, 10 Apr 2025 04:09:02 +0000 [thread overview]
Message-ID: <Z_dEXjck56Q_M6r3@ketchup> (raw)
In-Reply-To: <89385654-11bc-4cf0-b94e-15bf841ac215@riscstar.com>
On Tue, Apr 08, 2025 at 02:37:29PM -0500, Alex Elder wrote:
> On 4/1/25 12:24 PM, Haylen Chu wrote:
> > The control register for TWSI8 clocks, APBC_TWSI8_CLK_RST, contains mux
> > selection bits, reset assertion bit and enable bits for function and bus
> > clocks. It has a quirk that reading always results in zero.
> >
> > As a workaround, let's hardcode the mux value as zero to select
> > pll1_d78_31p5 as parent and treat twsi8_clk as a gate, whose enable mask
> > is combined from the real bus and function clocks to avoid the
> > write-only register being shared between two clk_hws, in which case
> > updates of one clk_hw zero the other's bits.
> >
> > With a 1:1 factor serving as placeholder for the bus clock, the I2C-8
> > controller could be brought up, which is essential for boards attaching
> > power-management chips to it.
> >
> > Signed-off-by: Haylen Chu <heylenay@4d2.org>
>
> Now that I understand why, I'm glad you put this into a separate
> patch. However I think you should make a note in the code to
> indicate there's something different about this one clock.
> People can then go back (with "git blame") to see the explanation
> above.
>
> Please consider adding such a comment in your next version.
Sure I'm willing to.
> Reviewed-by: Alex Elder <elder@riscstar.com>
Best regards,
Haylen Chu
> > ---
> > drivers/clk/spacemit/ccu-k1.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/clk/spacemit/ccu-k1.c b/drivers/clk/spacemit/ccu-k1.c
> > index cd95c4f9c127..5804c2f85407 100644
> > --- a/drivers/clk/spacemit/ccu-k1.c
> > +++ b/drivers/clk/spacemit/ccu-k1.c
> > @@ -397,6 +397,8 @@ CCU_MUX_GATE_DEFINE(twsi6_clk, twsi_parents, APBC_TWSI6_CLK_RST, 4, 3, BIT(1),
> > 0);
> > CCU_MUX_GATE_DEFINE(twsi7_clk, twsi_parents, APBC_TWSI7_CLK_RST, 4, 3, BIT(1),
> > 0);
> > +CCU_GATE_DEFINE(twsi8_clk, CCU_PARENT_HW(pll1_d78_31p5), APBC_TWSI8_CLK_RST,
> > + BIT(1) | BIT(0), 0);
> > static const struct clk_parent_data timer_parents[] = {
> > CCU_PARENT_HW(pll1_d192_12p8),
> > @@ -528,6 +530,7 @@ CCU_GATE_DEFINE(twsi6_bus_clk, CCU_PARENT_HW(apb_clk), APBC_TWSI6_CLK_RST,
> > BIT(0), 0);
> > CCU_GATE_DEFINE(twsi7_bus_clk, CCU_PARENT_HW(apb_clk), APBC_TWSI7_CLK_RST,
> > BIT(0), 0);
> > +CCU_FACTOR_DEFINE(twsi8_bus_clk, CCU_PARENT_HW(apb_clk), 1, 1);
> > CCU_GATE_DEFINE(timers1_bus_clk, CCU_PARENT_HW(apb_clk), APBC_TIMERS1_CLK_RST,
> > BIT(0), 0);
> > @@ -1059,6 +1062,7 @@ static struct clk_hw *k1_ccu_apbc_hws[] = {
> > [CLK_TWSI5] = &twsi5_clk.common.hw,
> > [CLK_TWSI6] = &twsi6_clk.common.hw,
> > [CLK_TWSI7] = &twsi7_clk.common.hw,
> > + [CLK_TWSI8] = &twsi8_clk.common.hw,
> > [CLK_TIMERS1] = &timers1_clk.common.hw,
> > [CLK_TIMERS2] = &timers2_clk.common.hw,
> > [CLK_AIB] = &aib_clk.common.hw,
> > @@ -1110,6 +1114,7 @@ static struct clk_hw *k1_ccu_apbc_hws[] = {
> > [CLK_TWSI5_BUS] = &twsi5_bus_clk.common.hw,
> > [CLK_TWSI6_BUS] = &twsi6_bus_clk.common.hw,
> > [CLK_TWSI7_BUS] = &twsi7_bus_clk.common.hw,
> > + [CLK_TWSI8_BUS] = &twsi8_bus_clk.common.hw,
> > [CLK_TIMERS1_BUS] = &timers1_bus_clk.common.hw,
> > [CLK_TIMERS2_BUS] = &timers2_bus_clk.common.hw,
> > [CLK_AIB_BUS] = &aib_bus_clk.common.hw,
>
next prev parent reply other threads:[~2025-04-10 4:09 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
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 [this message]
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_dEXjck56Q_M6r3@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=elder@riscstar.com \
--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).