[PATCH v2 15/16] clk: Detect failure to set defaults

Simon Glass sjg at chromium.org
Fri Aug 20 20:18:07 CEST 2021


Hi Harm,

On Wed, 18 Aug 2021 at 08:09, Harm Berntsen <harm.berntsen at nedap.com> wrote:
>
> On Thu, 2021-05-13 at 19:39 -0600, Simon Glass wrote:
> > When the default clocks cannot be set, the clock is silently probed and
> > the error is ignored. This is incorrect, since having the clocks at the
> > correct speed may be important for operation of the system.
> >
> > Fix it by checking the return code.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > (no changes since v1)
> >
> >  drivers/clk/clk-uclass.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
> > index 4ab3c402ed8..2a2e1cfbd61 100644
> > --- a/drivers/clk/clk-uclass.c
> > +++ b/drivers/clk/clk-uclass.c
> > @@ -796,13 +796,17 @@ void devm_clk_put(struct udevice *dev, struct clk
> > *clk)
> >
> >  int clk_uclass_post_probe(struct udevice *dev)
> >  {
> > +       int ret;
> > +
> >         /*
> >          * when a clock provider is probed. Call clk_set_defaults()
> >          * also after the device is probed. This takes care of cases
> >          * where the DT is used to setup default parents and rates
> >          * using assigned-clocks
> >          */
> > -       clk_set_defaults(dev, 1);
> > +       ret = clk_set_defaults(dev, 1);
> > +       if (ret)
> > +               return log_ret(ret);
> >
> >         return 0;
> >  }
>
> Note that this patch broke booting my imx8mn based board on U-Boot
> v2021.10-rc2. The failure is due to the clock-controller at 30380000
> configuration in the imx8mn.dtsi file. I had to remove the following
> clocks from the device tree to get my device to boot again (all from
> the assigned-clocks of clock-controller at 30380000):
>
> <&clk IMX8MN_CLK_A53_CORE>,
> <&clk IMX8MN_CLK_NOC>,
> <&clk IMX8MN_CLK_AUDIO_AHB>,
> <&clk IMX8MN_CLK_IPG_AUDIO_ROOT>,
> <&clk IMX8MN_SYS_PLL3>,
> <&clk IMX8MN_AUDIO_PLL1>,
> <&clk IMX8MN_AUDIO_PLL2>;
>
> I looked into the clk-imx8mn.c code and I see that we indeed miss
> clocks there. Unfortunately I could not port code from the Linux
> kernel: we are missing the imx_clk_hw_mux2 function for the
> IMX8MN_CLK_A53_CORE clock. I did not look into the other clocks.


Perhaps the iMX maintainer could help with this? It does sound like a bug.

Regards,
SImon

>
>
> -- Harm


More information about the U-Boot mailing list