[PATCH v2 0/2] clk: sophgo: sg2042: Keep gates used by firmware enabled
From: Han Gao via B4 Relay
Date: Sat Nov 21 2026 - 13:18:27 EST
On Milk-V Pioneer, firmware uses I2C0 for the EFI RTC and the serial
flash for its own image and EFI variables. Both sit behind clock gates
shared with devices Linux drives, so runtime PM on the Linux side can
turn them off under the firmware, and GetTime() returns EFI_NOT_READY.
Let firmware list such gates in protected-clocks on the clkgen node,
and keep them enabled.
qcom, the only current user of protected-clocks, does not register such
clocks at all. That would break the I2C controllers Linux uses, as the
DesignWare driver needs the clock rate, so here they stay registered and
are only kept on. I'm not sure this fits the intended use; suggestions
welcome.
Tested on Milk-V Pioneer.
Signed-off-by: Han Gao <gaohan@xxxxxxxxxxx>
---
Changes in v2:
- Drop the EFI MMIO patch, Ard is taking it through the EFI tree
- Use protected-clocks instead of scanning reserved nodes under /soc
(Krzysztof)
- Document protected-clocks in the binding
- Link to v1: https://patch.msgid.link/20261121-b4-sg2042-efi-rtc-v1-0-19898b8ad497@xxxxxxxxxxx
To: Stephen Boyd <sboyd@xxxxxxxxxx>
To: Brian Masney <bmasney+clk@xxxxxxxxxx>
To: Jerome Brunet <jbrunet+clk@xxxxxxxxxxxx>
To: Rob Herring <robh@xxxxxxxxxx>
To: Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>
To: Conor Dooley <conor+dt@xxxxxxxxxx>
To: Chen Wang <chen.wang@xxxxxxxxx>
To: Inochi Amaoto <inochiama@xxxxxxxxx>
Cc: Chen Wang <unicorn_wang@xxxxxxxxxxx>
Cc: linux-clk@xxxxxxxxxxxxxxx
Cc: devicetree@xxxxxxxxxxxxxxx
Cc: sophgo@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
Han Gao (2):
dt-bindings: clock: sophgo: Allow protected gate clocks on SG2042
clk: sophgo: Keep SG2042 gates listed in protected-clocks enabled
.../devicetree/bindings/clock/sophgo,sg2042-clkgen.yaml | 2 ++
drivers/clk/sophgo/clk-sg2042-clkgen.c | 16 ++++++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
---
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
change-id: 20261121-b4-sg2042-efi-rtc-e4d5222513ae
Best regards,
--
Han Gao <gaohan@xxxxxxxxxxx>