Re: [PATCH 0/6] riscv: spacemit: k1: RCPU2 PWM clocks and the BPI-F3 fan

From: Yao Zi

Date: Wed Nov 18 2026 - 11:05:06 EST


On Tue, Nov 17, 2026 at 09:59:45PM +0100, Frédéric Mahé wrote:
> 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(-)

I think spacemit,k1-syscon.yaml should probably be updated to make
'#clock-cells' property mandatory for rcpu2 node? And probably also
the other blocks capable of clock stuff as fix...

--
Thanks,
Yao Zi

Meow-mrrp-mrow, I'm a cat.