Re: [PATCH v2 1/2] cpufreq: mediatek-hw: Add support for Mediatek cpufreq HW driver

From: Hector Yuan
Date: Thu Aug 27 2020 - 04:58:18 EST


On Thu, 2020-08-27 at 09:56 +0530, Viresh Kumar wrote:
> On 26-08-20, 20:57, Hector Yuan wrote:
> > On Mon, 2020-08-24 at 15:36 +0530, Viresh Kumar wrote:
> > > On 13-08-20, 15:07, Hector Yuan wrote:
> > > > CONFIG_ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM=m
> > > > CONFIG_ARM_ARMADA_37XX_CPUFREQ=y
> > > > +CONFIG_ARM_MEDIATEK_CPUFREQ_HW=m
> > >
> > > What about a 'default m' in Kconfig itself ?
> > > OK, will update in V3.
>
> Hector, you need to remove (or not add) the right bracket (>) before the
> beginning of your lines. This makes it incredibly difficult to read.

OK, I get it. Sorry for the inconvenience.
> > > > + for (i = 0; i < LUT_MAX_ENTRIES; i++) {
> > > > + data = readl_relaxed(base + (i * LUT_ROW_SIZE));
> > > > + freq = FIELD_GET(LUT_FREQ, data) * 1000;
> > > > + volt = FIELD_GET(LUT_VOLT, data);
> > > > + if (freq != prev_freq) {
> > > > + table[i].frequency = freq;
> > > > + dev_pm_opp_add(cpu_dev, freq * 1000, volt);
> > >
> > > Why are you adding OPPs here and rather why using OPP specific stuff
> > > at all in the driver ?
> > > yes, the opp information is read from CPU HW engine.Then add it to the CPU dev OPP one by one.
>
> I asked a different question, why are you adding OPPs ? You don't need the OPPs
> at all in my opinion. You can just create the frequency table and that's it.

I just add OPP info to OPP framework so that others modules can get it
from OPP framework.
But like you said, I don't need it in this driver. I will remove this
code segment in V4.
I already send V3 yesterday but not including this modification.

> > > > + for_each_possible_cpu(cpu) {
> > > > + cpu_np = of_cpu_device_node_get(cpu);
> > > > + if (!cpu_np)
> > > > + continue;
> > > > +
> > > > + ret = of_parse_phandle_with_args(cpu_np, "mtk,freq-domain",
> > >
> > > Where are bindings of this node and how does this look ?
> > > Can refer to the same patch series, I split it to another patch.Each cpu will be group into one frequency domain for the CPU DVFS.
>
> That binding only defines "mediatek,cpufreq-hw" and not "mtk,freq-domain".

Please refer to the dt binding in V3, thank you. (lkml not show up yet,
so I post the below link instead)
https://www.spinics.net/lists/arm-kernel/msg832592.html
>