Re: [TEGRA194_CPUFREQ Patch 2/3] cpufreq: Add Tegra194 cpufreq driver

From: sumitg
Date: Wed Mar 25 2020 - 20:00:12 EST


Hi Viresh,

Sorry for the late reply.

On 04/12/19 4:57 PM, Viresh Kumar wrote:
On 04-12-19, 16:25, sumitg wrote:
In T194, CCPLEX doesn't have access to set clocks and the

clk_{get|set}_rate() functions set clocks by hook to BPMP R5.

CPU freq can be directly set by CCPLEX using MSR(NVFREQ_REQ_EL1).

As DVFS run's on BPMP, another MSR (NVFREQ_FEEDBACK_EL1) is

used to read the counters and calculate "actual" cpu freq at CCPLEX.

So, "cpuinfo_cur_freq" node gives the actual cpu frequency and not

given by node "scaling_cur_freq".
Right, but why can't this be hidden in the CPU's clk driver instead,
so cpufreq driver can just do clk_get_rate() and clk_set_rate() ?

- populating cpufreq table, you can probably add OPPs instead using
the same mechanism
We are reading available frequencies from BPMP to populate

cpufreq table and not using static opp table.
Right and lot of other platforms read it from firmware (I believe BBMP
is a firmware here), and create OPPs at runtime. Look at this for
example:

drivers/cpufreq/qcom-cpufreq-hw.c

and search for dev_pm_opp_add().

- I think we don't need separate CPU clock driver & to reuse

 cpufreq-dt driver as we will still have to replicate same logic

 from cpufreq driver to that dummy clock driver for calculating

 actual cpufreq from MSR value. So, it won't add much value.

ÂÂÂ - "qcom-cpufreq-hw.c" is using clk_get_rate() during init, but

ÂÂÂÂÂ the frequency ops "get/target_index" write to register directly

ÂÂÂÂÂ and not using clk api's. Also, the clock driver from gcc-msm*.c

ÂÂÂÂÂ seem to handle all clocks in CCPLEX.

ÂÂÂÂÂ Tegra SOC's which didn't have BPMP had the clock handling

ÂÂÂÂÂ done by CCPLEX. They were using clk_{get|set}_rate() api's

ÂÂÂÂÂ as you mentioned. But in Tegra194, all clock handling is done

ÂÂÂÂÂ within BPMP R5 core except CPU clock(which is through MSR).

- Adding OPP's with dev_pm_opp_add() is also not required as:

ÂÂ 1) We don't have any consumer like energy model or EAS in

ÂÂÂÂÂÂ Tegra194 which it seems was valid with "qcom-cpufreq-hw.c".

ÂÂÂÂÂÂ So, i think it won't be useful for T194.

ÂÂ 2) Also, there is no way to map ndiv to voltage in kernel. Kernel

ÂÂÂÂÂÂ driver passes ndiv value to BPMP(R5) which converts to vhint.

Please share your inputs.