On lun. 12 oct. 2026 at 14:59, Alex Elder <[email protected]> wrote:
>>> + TC9564_CLOCK_INIT0(MAC0_TX, 7), >>> + TC9564_CLOCK_INIT0(MAC0_RX, 14), >>> + TC9564_CLOCK_INIT0(MAC0_125M, 29), >>> + TC9564_CLOCK_INIT0(MAC0_312_5M, 30), >> >> Are those really just providing the oscillator parent ? >> That is what they will appear to do without a proper recalc_rate() > > They are fixed clocks that can be gated, but their > rate cannot be changed. It is not a problem if the rate cannot be changed but still a consumer could call clk_get_rate() and change its behavior based on the result, so it is better if it does reflect the reality to some extent. Just add fixed_factor clock elements on the path of clocks where do know the output does not match the input osc > > Looking at __clk_core_init(), should I define a > recalc_rate() callback that just returns the > equivalent of get_rate()? > >> Their names suggest that maybe, it is not the osc coming out >> of them ... > > We have requested a clock tree that explains exactly > how these clock rates are derived from the 25 MHz > oscillator. They're all fixed rates, and although > we could easily speculate how they're derived, we > don't have the documentation. If you know the input and output, you have enough to figure out a fixed factor. If later on someone gets more information than you, they'll just modify the clock tree. If you no idea what the ouput rate is, at least clearly say so in the comment so a future user or contributor can easily understand the situation. >>> + TC9564_CLOCK_INIT0(MAC0_ALL, 31), [...] >>> + >>> + clk = devm_clk_get(dev, NULL); >>> + if (IS_ERR(clk)) >>> + return dev_err_probe(dev, PTR_ERR(clk), >>> + "failed to get input clock\n"); >> >> Nothing is using this. This is not how you set the parent. See above > > It will once I have the clocks get properly parented. No it won't. You don't need a consumer clock reference. just drop it. > >>> + >>> + clocks = tc9564_clk_init(dev); >>> + if (IS_ERR(clocks)) >>> + return dev_err_probe(dev, PTR_ERR(clocks), >>> + "failed to initialize clocks\n"); >>> + >>> + /* Force all clocks to be initially disabled */ >>> + tc9564_clock_disable_all(clocks); >> >> Why is this needed ? In general a provider should never act the provided >> clock on its own. Let the framework deal with the used clocks > > The intent was to start with everything disabled--a known > state. Sashiko pointed out this races with a user that > could get the clock right away, so I intend to do this > by initially disabling all the clocks before they're > all registered. We do not do that because (in general) there maybe devices already using a clock provided by your device and setup at a prior stage (like the bootloader). Doing so would break them. Leave this alone, the framework will disable the unused clock for you once the init is done and most devices have probed. -- Jerome

