[PATCH v2 5/7] clk: bcm: Add BCMBCA PMB clocks

Linus Walleij linusw at kernel.org
Thu Nov 5 15:06:20 PST 2026


Hi Brian,

thanks for reviewing!

On Wed, Nov 4, 2026 at 11:21 PM Brian Masney <masneyb at kernel.org> wrote:

> > +static int bcmbca_pmb_clock_prepare(struct clk_hw *hw)
> > +{
> > +     struct bcmbca_pmb_clock *clock = to_pmb_clock(hw);
> > +     const struct bcmbca_pmb_clock_desc *desc = clock->desc;
> > +     unsigned int shift = (desc->channel % 2) * 16;
> > +     unsigned int reg = BCMBCA_PMB_REG(desc->bus, desc->device, desc->reg);
> > +     u32 value;
> > +     int ret;
> > +
> > +     switch (desc->type) {
> > +     case PMB_PLL_CHANNEL: {
> > +             unsigned int regs[] = {
> > +                     BCMBCA_PMB_REG(desc->bus, desc->device, desc->pll->status),
> > +                     BCMBCA_PMB_REG(desc->bus, desc->device,
> > +                                    desc->pll->ch01 + desc->channel / 2),
> > +             };
> > +             u32 values[ARRAY_SIZE(regs)];
> > +
> > +             ret = regmap_multi_reg_read(clock->regmap, regs, values, ARRAY_SIZE(regs));
> > +             if (ret)
> > +                     return ret;
> > +             /* Firmware owns PLL power and reset. */
> > +             if (!(values[0] & PLL_LOCK))
> > +                     return -EAGAIN;
>
> Should this be -EPROBE_DEFER instead?

Not here since it is a .prepare() callback which is called at runtime,
it would be weird to get this return code from preparing a clock?

> > +static int bcmbca_pmb_clock_probe(struct platform_device *pdev)
> > +{
> > +     struct device *dev = &pdev->dev;
> > +     struct regmap *regmap = dev_get_regmap(dev->parent, NULL);
> > +     struct clk_hw_onecell_data *data;
> > +     struct bcmbca_pmb_clock *clocks;
> > +     struct clk *ref;
> > +     unsigned int i;
> > +     int ret;
> > +
> > +     if (!regmap)
> > +             return -ENODEV;
> > +
> > +     ref = devm_clk_get(dev, "ref");
>
> This is never used. Is this to defer probe until the ref exists?

Yep.

> > +     for (i = 0; i < data->num; i++) {
> > +             const struct bcmbca_pmb_clock_desc *desc = &bcm6846_clocks[i];
> > +             struct clk_parent_data parent = {};
> > +             struct clk_init_data init = {
> > +                     .ops = &bcmbca_pmb_clock_ops,
> > +                     .flags = CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED,
>
> The CLK_IGNORE_UNUSED has no effect since there's no disable /
> disable_unused ops.
>
> Also why CLK_GET_RATE_NOCACHE on all clocks?

The latter is only needed on PLL outputs as they need to read
the state of some hardware dividers. I'll restrict it to those.

I fixed the rest!

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list