Re: [RFC PATCH 1/4] dt-bindings: cpufreq-qcom-hw: Move clocks to CPU nodes

From: Viresh Kumar
Date: Tue Jul 19 2022 - 00:19:19 EST


On 18-07-22, 14:46, Rob Herring wrote:
> On Wed, Jul 13, 2022 at 12:22:56PM +0530, Viresh Kumar wrote:
> > cpufreq-hw is a hardware engine, which takes care of frequency
> > management for CPUs. The engine manages the clocks for CPU devices, but
> > it isn't the end consumer of the clocks, which are the CPUs in this
> > case.
>
> The question is really where does the clock mux live?

As Manivannan clarified in another email, these clocks are actually consumed by
the cpufreq-hw node, so existing code was fine.

> > For this reason, it looks incorrect to keep the clock related properties
> > in the cpufreq-hw node. They should really be present at the end user,
> > i.e. the CPUs.
>
> The issue is that the CPU itself probably only has 1 clock input (at
> least for its core frequency).

Right, and they (Qcom) have skipped adding that in DT currently. I have
suggested to him to add it there, which will solve the issue as well.

> Listing out all possible clock sources in CPU node 'clocks' is wrong too.

Yes, we need to mention only the clocks which are consumed directly by the CPU,
maybe just one of them which comes out of cpufreq-hw node.

> > The case was simple currently as all the devices, i.e. the CPUs, that
> > the engine manages share the same clock names. What if the clock names
> > are different for different CPUs or clusters ? How will keeping the
> > clock properties in the cpufreq-hw node work in that case ?
> >
> > This design creates further problems for frameworks like OPP, which
> > expects all such details (clocks) to be present in the end device node
> > itself, instead of another related node.
> >
> > Move the clocks properties to the node that uses them instead.
>
> What's the purpose of freq-domain binding now? I thought the idea was to
> use that instead of clocks directly.

Not always I think. It provides register access for programming or voting for
the clock, etc. Yes, the code won't do clk_set_rate() but the DT should still
mention the clock in the CPU node if it mentions an OPP table with frequencies
in it.

--
viresh