[PATCH 0/6] riscv: spacemit: k1: RCPU2 PWM clocks and the BPI-F3 fan
From: Frédéric Mahé
Date: Tue Nov 17 2026 - 16:00:55 EST
The BPI-F3 fan header (J27) has a PWM line driven by an RCPU2 PWM
(GPIO 79). This series adds the RCPU2 PWM clocks and DT nodes and
enables the fan on the BPI-F3.
Patch 2 keeps pll1_aud_245p7 enabled: once clk_disable_unused() gates
it, accesses to the RCPU2 block hang the CPU (the vendor kernel keeps
it on through its RCPU firmware). It may be better tied to a power
domain once the K1 power domain driver lands; comments welcome.
Tested on a BPI-F3 on v7.4-rc1 (no fan with a PWM input at hand, so
with a multimeter on J27 pin 3): 0.86, 1.76, 2.74 and 4.66 V at 25,
50, 75 and 100% duty (0.04 V off), as with the vendor kernel, and
the fan goes to level 1 when the package reaches 40 C under load.
Trees: 1-3 clk, 4-5 SpacemiT DT (4 needs the IDs from 1), 6 riscv
defconfig. Depends on "reset: spacemit: Fix the RCPU2 PWM reset
registers" (reset/fixes).
Written with help from Claude (Anthropic); reviewed and tested on
hardware.
Signed-off-by: Frédéric Mahé <frederic.mahe@xxxxxxxx>
Frédéric Mahé (6):
dt-bindings: clock: spacemit: k1: Add RCPU2 PWM clocks
clk: spacemit: k1: Keep pll1_aud_245p7 enabled
clk: spacemit: k1: Add RCPU2 PWM clocks
riscv: dts: spacemit: k1: Add RCPU2 PWM nodes
riscv: dts: spacemit: k1-bananapi-f3: Add PWM fan
riscv: defconfig: Enable PWM fan support
.../boot/dts/spacemit/k1-bananapi-f3.dts | 63 +++++++++++++
arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi | 7 ++
arch/riscv/boot/dts/spacemit/k1.dtsi | 91 +++++++++++++++++++
arch/riscv/configs/defconfig | 1 +
drivers/clk/spacemit/ccu-k1.c | 45 ++++++++-
.../dt-bindings/clock/spacemit,k1-syscon.h | 12 +++
6 files changed, 218 insertions(+), 1 deletion(-)
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
prerequisite-patch-id: 76613a144ac2f5db5511e6f3dc8645510933c14c
--
2.47.3