Re: [PATCH v9 -next 04/12] clk: rp1: Add support for clocks provided by RP1

Andrea della Porta
2025-05-08T21:27:22Z

Hi Stephen,

On 13:01 Wed 07 May , Stephen Boyd wrote:
> Quoting Andrea della Porta (2025-04-22 11:53:13)
> > diff --git a/drivers/clk/clk-rp1.c b/drivers/clk/clk-rp1.c
> > new file mode 100644

...

> > +
> > + /* There must be a gap for the AUX selector */
> > + if (WARN_ON_ONCE(clock_data->num_std_parents > AUX_SEL &&
> > + desc->hw.init->parent_data[AUX_SEL].index != -1))
>
> Why is there a gap? Can't the parents that the clk framework sees be
>
> [0, num_std_parents) + [num_std_parents, num_aux_parents + num_std_parents)
>
> without an empty parent in the middle?
>

The pos 1 in the parent index array is used to select one of the AUX clocks.
Besides this, the index maps directly to the value that should be written in hw,
avoiding remapping. It's possible to use a numbering scheme like the one you
proposed, but in this case we need to complicate the code adding the renumbering
where the index is written in hw.

...

> > +
> > +static const struct clk_parent_data clk_sys_parents[] = {
> > + { .index = 0 },
> > + { .index = -1 },
>
> Why is there a gap here?
>

Same answer as above.

Many thanks,
Andrea