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.