From: Yao Zi <ziyao@disroot.org>
To: 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>,
Huacai Chen <chenhuacai@kernel.org>,
WANG Xuerui <kernel@xen0n.name>
Cc: 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>, Yao Zi <ziyao@disroot.org>
Subject: [PATCH v4 2/8] clk: loongson2: Allow specifying clock flags for gate clock
Date: Fri, 19 Sep 2025 14:26:43 +0000 [thread overview]
Message-ID: <20250919142649.58859-3-ziyao@disroot.org> (raw)
In-Reply-To: <20250919142649.58859-1-ziyao@disroot.org>
Some gate clocks need to be supplied with flags, e.g., it may be
required to specify CLK_IS_CRTICAL for CPU clocks.
Add a field to loongson2_clk_board_info for representing clock flags,
and specify it when registering gate clocks. A new helper macro,
CLK_GATE_FLAGS, is added to simplify definitions.
Signed-off-by: Yao Zi <ziyao@disroot.org>
---
drivers/clk/clk-loongson2.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk-loongson2.c b/drivers/clk/clk-loongson2.c
index 27e632edd484..cc3fb13e770f 100644
--- a/drivers/clk/clk-loongson2.c
+++ b/drivers/clk/clk-loongson2.c
@@ -50,6 +50,7 @@ struct loongson2_clk_board_info {
const char *name;
const char *parent_name;
unsigned long fixed_rate;
+ unsigned long flags;
u8 reg_offset;
u8 div_shift;
u8 div_width;
@@ -105,6 +106,18 @@ struct loongson2_clk_board_info {
.bit_idx = _bidx, \
}
+#define CLK_GATE_FLAGS(_id, _name, _pname, _offset, _bidx, \
+ _flags) \
+ { \
+ .id = _id, \
+ .type = CLK_TYPE_GATE, \
+ .name = _name, \
+ .parent_name = _pname, \
+ .reg_offset = _offset, \
+ .bit_idx = _bidx, \
+ .flags = _flags \
+ }
+
#define CLK_FIXED(_id, _name, _pname, _rate) \
{ \
.id = _id, \
@@ -332,7 +345,8 @@ static int loongson2_clk_probe(struct platform_device *pdev)
&clp->clk_lock);
break;
case CLK_TYPE_GATE:
- hw = devm_clk_hw_register_gate(dev, p->name, p->parent_name, 0,
+ hw = devm_clk_hw_register_gate(dev, p->name, p->parent_name,
+ p->flags,
clp->base + p->reg_offset,
p->bit_idx, 0,
&clp->clk_lock);
--
2.50.1
next prev parent reply other threads:[~2025-09-19 14:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 14:26 [PATCH v4 0/8] Add clock support for Loongson 2K0300 SoC Yao Zi
2025-09-19 14:26 ` [PATCH v4 1/8] dt-bindings: clock: loongson2: Add Loongson-2K0300 compatible Yao Zi
2025-09-21 19:50 ` Stephen Boyd
2025-09-19 14:26 ` Yao Zi [this message]
2025-09-21 19:50 ` [PATCH v4 2/8] clk: loongson2: Allow specifying clock flags for gate clock Stephen Boyd
2025-09-19 14:26 ` [PATCH v4 3/8] clk: loongson2: Support scale clocks with an alternative mode Yao Zi
2025-09-21 19:50 ` Stephen Boyd
2025-09-19 14:26 ` [PATCH v4 4/8] clk: loongson2: Allow zero divisors for dividers Yao Zi
2025-09-21 19:50 ` Stephen Boyd
2025-09-19 14:26 ` [PATCH v4 5/8] clk: loongson2: Avoid hardcoding firmware name of the reference clock Yao Zi
2025-09-21 19:50 ` Stephen Boyd
2025-09-19 14:26 ` [PATCH v4 6/8] clk: loongson2: Add clock definitions for Loongson-2K0300 SoC Yao Zi
2025-09-21 19:50 ` Stephen Boyd
2025-09-19 14:26 ` [PATCH v4 7/8] LoongArch: dts: Add clock tree for Loongson-2K0300 Yao Zi
2025-09-19 14:26 ` [PATCH v4 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=20250919142649.58859-3-ziyao@disroot.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox