From: Krzysztof Kozlowski <krzk@kernel.org>
To: gaohan@iscas.ac.cn, Ard Biesheuvel <ardb@kernel.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Atish Patra <atish.patra@linux.dev>,
Stephen Boyd <sboyd@kernel.org>,
Brian Masney <bmasney+clk@redhat.com>,
Jerome Brunet <jbrunet+clk@baylibre.com>,
Chen Wang <chen.wang@linux.dev>,
Inochi Amaoto <inochiama@gmail.com>
Cc: Han Gao <rabenda.cn@gmail.com>,
linux-efi@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
sophgo@lists.linux.dev
Subject: Re: [PATCH 2/2] clk: sophgo: sg2042-clkgen: Keep gates of reserved devices enabled
Date: Sat, 21 Nov 2026 17:11:15 +0100 [thread overview]
Message-ID: <b64cf863-e50d-455f-826c-13cd9ec66c6b@kernel.org> (raw)
In-Reply-To: <20261121-b4-sg2042-efi-rtc-v1-2-19898b8ad497@iscas.ac.cn>
On 21/11/2026 11:38, Han Gao via B4 Relay wrote:
> From: Han Gao <gaohan@iscas.ac.cn>
>
> On Milk-V Pioneer, firmware can own I2C0 to back the EFI RTC, with the
> node marked status = "reserved". I2C0 shares GATE_CLK_APB_I2C with the
> I2C controllers Linux uses. When those runtime-suspend, the gate is
> switched off under the firmware and GetTime() returns EFI_NOT_READY.
>
> Walk the reserved children of /soc and match their clock references,
> as done in commit 6aa175476490 ("clk: renesas: cpg-mssr: Ignore all
> clocks assigned to non-Linux system"). Unlike that driver, use
> CLK_IS_CRITICAL rather than CLK_IGNORE_UNUSED: the gate is shared with
> devices Linux drives, and their runtime PM would still turn it off.
>
> Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
> ---
> drivers/clk/sophgo/clk-sg2042-clkgen.c | 38 +++++++++++++++++++++++++++++++++-
> 1 file changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/sophgo/clk-sg2042-clkgen.c b/drivers/clk/sophgo/clk-sg2042-clkgen.c
> index 6abc2c973c49..414904965edf 100644
> --- a/drivers/clk/sophgo/clk-sg2042-clkgen.c
> +++ b/drivers/clk/sophgo/clk-sg2042-clkgen.c
> @@ -11,6 +11,8 @@
> #include <linux/clk.h>
> #include <linux/clk-provider.h>
> #include <linux/io.h>
> +#include <linux/of.h>
> +#include <linux/of_clk.h>
> #include <linux/platform_device.h>
> #include <asm/div64.h>
>
> @@ -840,6 +842,35 @@ static int sg2042_clk_register_divs(struct device *dev,
> return ret;
> }
>
> +static bool sg2042_clk_is_reserved(struct device_node *clkgen, unsigned int id)
> +{
> + struct device_node *soc __free(device_node) = of_find_node_by_path("/soc");
Where did you document the ABI? Soc is implied but not enforced. commit
6aa175476490 makes the same mistake.
Reserved nodes might not even appear in DTB passed to Linux, because
they are not the hardware exposed to the OS, so this entire approach is
fragile. IMO, the list of clocks which are not controller by Linux
should be static in the driver, but if you insist on using some ABI then
you must document it.
Best regards,
Krzysztof
prev parent reply other threads:[~2026-11-21 16:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 10:38 [PATCH 0/2] riscv/clk: sophgo: Fix EFI RTC on Milk-V Pioneer Han Gao via B4 Relay
2026-11-21 10:38 ` [PATCH 1/2] riscv: efi: Map runtime MMIO with device attributes Han Gao via B4 Relay
2026-11-21 12:42 ` Ard Biesheuvel
2026-11-21 14:48 ` Han Gao
2026-11-21 18:15 ` Ard Biesheuvel
2026-11-21 10:38 ` [PATCH 2/2] clk: sophgo: sg2042-clkgen: Keep gates of reserved devices enabled Han Gao via B4 Relay
2026-11-21 16:11 ` Krzysztof Kozlowski [this message]
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=b64cf863-e50d-455f-826c-13cd9ec66c6b@kernel.org \
--to=krzk@kernel.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=ardb@kernel.org \
--cc=atish.patra@linux.dev \
--cc=bmasney+clk@redhat.com \
--cc=chen.wang@linux.dev \
--cc=gaohan@iscas.ac.cn \
--cc=ilias.apalodimas@linaro.org \
--cc=inochiama@gmail.com \
--cc=jbrunet+clk@baylibre.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=rabenda.cn@gmail.com \
--cc=sboyd@kernel.org \
--cc=sophgo@lists.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®