From: Yao Zi <ziyao@disroot.org>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: Yinbo Zhu <zhuyinbo@loongson.cn>,
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>,
WANG Xuerui <kernel@xen0n.name>,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, loongarch@lists.linux.dev,
Mingcong Bai <jeffbai@aosc.io>,
Kexy Biscuit <kexybiscuit@aosc.io>
Subject: Re: [PATCH v3 6/8] clk: loongson2: Add clock definitions for Loongson 2K0300 SoC
Date: Fri, 8 Aug 2025 03:13:03 +0000 [thread overview]
Message-ID: <aJVrP1kNfvx8k8r7@pie> (raw)
In-Reply-To: <CAAhV-H4=A=BaHsAKmTiS62gE6XQLD4rnYmU6snDFt1S0uMHr6A@mail.gmail.com>
On Thu, Aug 07, 2025 at 07:21:32PM +0800, Huacai Chen wrote:
> Hi, Yao,
>
> On Tue, Aug 5, 2025 at 11:05 PM Yao Zi <ziyao@disroot.org> wrote:
> >
> > The clock controller of Loongson 2K0300 consists of three PLLs, requires
> > an 120MHz external reference clock to function, and generates clocks in
> > various frequencies for SoC peripherals.
> >
> > Clock definitions for previous SoC generations could be reused for most
> > clock hardwares. There're two gates marked as critical, clk_node_gate
> > and clk_boot_gate, which supply the CPU cores and the system
> > configuration bus. Disabling them leads to a SoC hang.
> >
> > Signed-off-by: Yao Zi <ziyao@disroot.org>
> > ---
> > drivers/clk/clk-loongson2.c | 48 +++++++++++++++++++++++++++++++++++++
> > 1 file changed, 48 insertions(+)
> >
> > diff --git a/drivers/clk/clk-loongson2.c b/drivers/clk/clk-loongson2.c
> > index 52a9f1c2794a..1d210a7683ea 100644
> > --- a/drivers/clk/clk-loongson2.c
> > +++ b/drivers/clk/clk-loongson2.c
> > @@ -12,6 +12,7 @@
> > #include <linux/platform_device.h>
> > #include <linux/io-64-nonatomic-lo-hi.h>
> > #include <dt-bindings/clock/loongson,ls2k-clk.h>
> > +#include <dt-bindings/clock/loongson,ls2k0300-clk.h>
> >
> > enum loongson2_clk_type {
> > CLK_TYPE_PLL,
> > @@ -137,6 +138,52 @@ struct loongson2_clk_board_info {
> > .fixed_rate = _rate, \
> > }
> >
> > +static const struct loongson2_clk_board_info ls2k0300_clks[] = {
> > + /* Reference Clock */
> > + CLK_PLL(LS2K0300_PLL_NODE, "pll_node", 0x00, 15, 9, 8, 7),
> > + CLK_PLL(LS2K0300_PLL_DDR, "pll_ddr", 0x08, 15, 9, 8, 7),
> > + CLK_PLL(LS2K0300_PLL_PIX, "pll_pix", 0x10, 15, 9, 8, 7),
> > + CLK_FIXED(LS2K0300_CLK_STABLE, "clk_stable", NULL, 100000000),
> > + CLK_FIXED(LS2K0300_CLK_THSENS, "clk_thsens", NULL, 10000000),
> > + /* Node PLL */
> > + CLK_DIV(LS2K0300_CLK_NODE_DIV, "clk_node_div", "pll_node", 0x00, 24, 7),
> > + CLK_DIV(LS2K0300_CLK_GMAC_DIV, "clk_gmac_div", "pll_node", 0x04, 0, 7),
> > + CLK_DIV(LS2K0300_CLK_I2S_DIV, "clk_i2s_div", "pll_node", 0x04, 8, 7),
> > + CLK_GATE(LS2K0300_CLK_NODE_PLL_GATE, "clk_node_pll_gate", "clk_node_div", 0x00, 0),
> > + CLK_GATE(LS2K0300_CLK_GMAC_GATE, "clk_gmac_gate", "clk_gmac_div", 0x00, 1),
> > + CLK_GATE(LS2K0300_CLK_I2S_GATE, "clk_i2s_gate", "clk_i2s_div", 0x00, 2),
> > + CLK_GATE_FLAGS(LS2K0300_CLK_NODE_GATE, "clk_node_gate", "clk_node_scale",
> > + 0x24, 0, CLK_IS_CRITICAL),
> There is no 80 chars limit now, so feel free to define a clock in one line.
Thanks, will merge definitions into a single line in the next version.
Best regards,
Yao Zi
next prev parent reply other threads:[~2025-08-08 3:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-05 15:01 [PATCH v3 0/8] Add clock support for Loongson 2K0300 SoC Yao Zi
2025-08-05 15:01 ` [PATCH v3 1/8] dt-bindings: clock: loongson2: Add Loongson 2K0300 compatible Yao Zi
2025-08-06 8:01 ` Krzysztof Kozlowski
2025-08-06 8:36 ` Huacai Chen
2025-08-06 12:30 ` Yao Zi
2025-08-07 4:44 ` Huacai Chen
2025-08-07 10:04 ` Yanteng Si
2025-08-05 15:01 ` [PATCH v3 2/8] clk: loongson2: Allow specifying clock flags for gate clock Yao Zi
2025-08-05 15:01 ` [PATCH v3 3/8] clk: loongson2: Support scale clocks with an alternative mode Yao Zi
2025-08-07 11:18 ` Huacai Chen
2025-08-08 3:24 ` Yao Zi
2025-08-08 12:58 ` Huacai Chen
2025-08-05 15:01 ` [PATCH v3 4/8] clk: loongson2: Allow zero divisors for dividers Yao Zi
2025-08-05 15:01 ` [PATCH v3 5/8] clk: loongson2: Avoid hardcoding firmware name of the reference clock Yao Zi
2025-08-05 15:01 ` [PATCH v3 6/8] clk: loongson2: Add clock definitions for Loongson 2K0300 SoC Yao Zi
2025-08-07 11:21 ` Huacai Chen
2025-08-08 3:13 ` Yao Zi [this message]
2025-08-05 15:01 ` [PATCH v3 7/8] LoongArch: dts: Add clock tree for Loongson 2K0300 Yao Zi
2025-08-05 15:01 ` [PATCH v3 8/8] LoongArch: dts: Remove clock-frquency from UART0 of CTCISZ Forever Pi Yao Zi
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=aJVrP1kNfvx8k8r7@pie \
--to=ziyao@disroot.org \
--cc=chenhuacai@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jeffbai@aosc.io \
--cc=kernel@xen0n.name \
--cc=kexybiscuit@aosc.io \
--cc=krzk+dt@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=zhuyinbo@loongson.cn \
/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.