Re: [PATCH v3 2/3] clk: renesas: Add family-specific clock driver for RZ/V2H(P)
From: Lad, Prabhakar
Date: Fri Jul 12 2024 - 11:29:52 EST
Hi Geert,
On Fri, Jul 12, 2024 at 4:23 PM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
>
> Hi Prabhakar,
>
> On Fri, Jul 12, 2024 at 5:14 PM Lad, Prabhakar
> <prabhakar.csengg@xxxxxxxxx> wrote:
> > On Fri, Jul 12, 2024 at 12:59 PM Geert Uytterhoeven
> > > On Thu, Jun 27, 2024 at 6:14 PM Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> > > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
> > > >
> > > > Add family-specific clock driver for RZ/V2H(P) SoCs.
> > > >
> > > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
> > > > ---
> > > > v2->v3
> > > > - Dropped num_hw_resets from struct rzv2h_cpg_priv
> > > > - Dropped range_check for module clocks
> > > > - Made mon_index to s8 instead of u8 in struct rzv2h_mod_clk
> > > > - Added support for critical module clocks with DEF_MOD_CRITICAL
> > > > - Added check for mon_index in rzv2h_mod_clock_endisable and
> > > > rzv2h_mod_clock_is_enabled()
>
> > > > --- /dev/null
> > > > +++ b/drivers/clk/renesas/rzv2h-cpg.h
>
> > > > +/**
> > > > + * struct rzv2h_reset - Reset definitions
> > > > + *
> > > > + * @reset_index: reset register index
> > > > + * @reset_bit: reset bit
> > > > + * @mon_index: monitor register index
> > > > + * @mon_bit: monitor bit
> > > > + */
> > > > +struct rzv2h_reset {
> > > > + u8 reset_index;
> > > > + u8 reset_bit;
> > > > + u8 mon_index;
> > > > + u8 mon_bit;
> > > > +};
> > > > +
> > > > +#define RST_ID(x, y) ((((x) * 16)) + (y))
> > > > +
> > > > +#define DEF_RST_BASE(_id, _resindex, _resbit, _monindex, _monbit) \
> > > > + [_id] = { \
> > >
> > > Indexing by _id means the reset array will be very sparse. E.g. the
> > > innocent-looking r9a09g057_resets[] with only a single entry takes
> > > 600 bytes.
> > >
> > > If you do need the full array for indexing, please allocate and
> > > populate it at runtime.
> > >
> > OK, I will use the radix tree for resets (is that OK)?
>
> You mean XArray? include/linux/radix-tree.h has:
>
> /* Keep unconverted code working */
> #define radix_tree_root xarray
> #define radix_tree_node xa_node
>
Yes, I meant the above.
> Given a single xa_node is already 576 bytes, just allocating the full
> linear reset array at runtime is probably better.
>
Agreed, I will create a linear reset array and loop through the array
based on reset index and reset bit to match with id whenever required.
Cheers,
Prabhakar