Page MenuHomeFreeBSD

imx clk: Skip reconfiguring the clock if we don't have a new best_parent
ClosedPublic

Authored by thj on Fri, Sep 13, 1:19 PM.
Tags
None
Referenced Files
F98505587: D46662.diff
Thu, Oct 3, 3:33 PM
Unknown Object (File)
Fri, Sep 27, 1:48 PM
Unknown Object (File)
Wed, Sep 25, 6:14 PM
Unknown Object (File)
Wed, Sep 25, 2:23 PM
Unknown Object (File)
Wed, Sep 25, 1:46 PM
Unknown Object (File)
Tue, Sep 24, 4:21 AM
Unknown Object (File)
Fri, Sep 20, 3:34 PM
Unknown Object (File)
Thu, Sep 19, 2:24 PM
Subscribers

Details

Summary

imx_clk_composite_find_best_parent can fail, when it does for all the
clocks checked we attempt to configure an uninitialized best_parent
leading to a panic.

Initialize best_parent and skip reconfiguring the clock if we
don't find a new best_parent to use.

Test Plan

A change like this is needed for me to boot on imx8mp, I was skipping the call
to clknode_set_parent_by_idx for testing of other stuff. Skipping all the
following clock configuration doesn't have any noticable impact on my test
system.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 59473
Build 56360: arc lint + arc unit

Event Timeline

thj requested review of this revision.Fri, Sep 13, 1:19 PM
This revision is now accepted and ready to land.Mon, Sep 16, 9:45 AM
mmel added inline comments.
sys/arm64/freescale/imx/clk/imx_clk_composite.c
249

This doesn't looks right, the <foo>_set_freq() in case of not-errored exit must set fout to real output frequency of given clock block.

However, at first glance, there are more problems in this feature:

  • best_diff should be initialized to INT64_MAX (and I think this is the correct fix for your problem).
  • It seems that READ4() is not followed by WRITE4() at the end of the function, so all calculated values are not written to hw.

Thanks for checking this over!

I think I assume that fout was starting with a good value and didn't dig beyond clearing the panic.

There are lot of issues with devices under this clock right now, so maybe writing out the selected clock will help.

I'll draft something up and tag you this week.