Re: [PATCH v2 02/11] clk: rockchip: introduce auxiliary GRFs
From: Heiko Stübner
Date: Thu May 01 2025 - 08:39:13 EST
Hi Nicolas,
Am Donnerstag, 10. April 2025, 21:39:54 Mitteleuropäische Sommerzeit schrieb Nicolas Frattaroli:
> The MUXGRF clock branch type depends on having access to some sort of
> GRF as a regmap to be registered. So far, we could easily get away with
> only ever having one GRF stowed away in the context.
>
> However, newer Rockchip SoCs, such as the RK3576, have several GRFs
> which are relevant for clock purposes. It already depends on the pmu0
> GRF for MUXGRF reasons, but could get away with not refactoring this
> because it didn't need the sysgrf at all, so could overwrite the pointer
> in the clock provider to the pmu0 grf regmap handle.
>
> In preparation for needing to finally access more than one GRF per SoC,
> let's untangle this. Introduce an auxiliary GRF hashmap, and a GRF type
> enum. The hasmap is keyed by the enum, and clock branches now have a
> struct member to store the value of that enum, which defaults to the
> system GRF.
>
> The SoC-specific _clk_init function can then insert pointers to GRF
> regmaps into the hashmap based on the grf type.
>
> During clock branch registration, we then pick the right GRF for each
> branch from the hashmap if something other than the sys GRF is
> requested.
>
> The reason for doing it with this grf type indirection in the clock
> branches is so that we don't need to define the MUXGRF branches in a
> separate step, just to have a direct pointer to a regmap available
> already.
>
> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@xxxxxxxxxxxxx>
like the concept and also implementation :-) .
> ---
> drivers/clk/rockchip/clk-rk3328.c | 6 +++---
> drivers/clk/rockchip/clk-rk3568.c | 2 +-
> drivers/clk/rockchip/clk-rk3576.c | 32 ++++++++++++++++++++++----------
the only "hair in the soup" are some missing socs ;-) .
As you're changing the MUXGRF type, you should adapt all socs using it
please. Missing rk3288 and rv1126 it seems - ARM32, which may have helped
these slipping through.
Heiko