Tests:R-CAR-GEN3-CPUFreq

Kernel Version Configuration
CPUFreq support for R-Car Gen3 H3 (ES1.*) is currently available in a topic branch:

https://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git topic/rcar-gen3-cpufreq-v4

The ARM64 renesas_defconfig present in the above branch was used.

Hardware Environment

 * Salvator-X/r8a7795 (Gen 3 R-Car H3 SoC) ES1.0
 * Salvator-XS/r8a7795 (Gen 3 R-Car H3 SoC) ES2.0
 * Salvator-X/r8a7796 (Gen 3 R-Car M3-W SoC) ES1.0

The results shown below are from tests performed on the Salvator-X/r8a7795.

The Salvator-XS/r8a7795 gives the same results.

The Salvator-X/r8a7796 gives similar results but with 2 CPU cores rather than 4.

Verify Driver Initialisation
Initialisation of CPUFreq can be checked by checking for the presence of cpufreq directories in sysfs

/sys/devices/system/cpu/cpu3/cpufreq /sys/devices/system/cpu/cpu1/cpufreq /sys/devices/system/cpu/cpufreq /sys/devices/system/cpu/cpu2/cpufreq /sys/devices/system/cpu/cpu0/cpufreq /sys/module/cpufreq
 * 1) find /sys -name cpufreq

Change to cpu sysfs directory

 * 1) cd /sys/devices/system/cpu

Inspect Available Frequencies
cpu0/cpufreq/scaling_available_frequencies:500000 1000000 1500000 cpu1/cpufreq/scaling_available_frequencies:500000 1000000 1500000 cpu2/cpufreq/scaling_available_frequencies:500000 1000000 1500000 cpu3/cpufreq/scaling_available_frequencies:500000 1000000 1500000
 * 1) grep . */cpufreq/scaling_available_frequencies

Change to cpu sysfs directory

 * 1) cd /sys/devices/system/cpu

On Boot

 * Z clock and Current CPU frequencies are ~1.5GHz.
 * Z clock is half of PLL0.
 * Z2 clock is half of PLL2.

.pll0                             0            0  2999999880          0 0 z                              0            0  1499999940          0 0 .pll2                             0            0  2399999904          0 0 z2                             0            0  1199999952          0 0 cpu0/cpufreq/cpuinfo_cur_freq:1499999 cpu0/cpufreq/scaling_cur_freq:1500000 cpu1/cpufreq/cpuinfo_cur_freq:1499999 cpu1/cpufreq/scaling_cur_freq:1500000 cpu2/cpufreq/cpuinfo_cur_freq:1499999 cpu2/cpufreq/scaling_cur_freq:1500000 cpu3/cpufreq/cpuinfo_cur_freq:1499999 cpu3/cpufreq/scaling_cur_freq:1500000
 * 1) grep -E -w "pll0|z" /sys/kernel/debug/clk/clk_summary
 * 1) grep -E -w "pll2|z2" /sys/kernel/debug/clk/clk_summary
 * 1) grep . cpu*/cpufreq/*cur*

Maximum Frequency Limited to 1.0GHz and then 500MHz.

 * Z clock and Current CPU frequencies correspond to the maximum set.
 * Z2 clock is unchanged because A53 CPUs are not in use.
 * PLL0 and PLL2 are fixed.

.pll0                             0            0  2999999880          0 0 z                              0            0  1031249959          0 0 .pll2                             0            0  2399999904          0 0 z2                             0            0  1199999952          0 0 cpu0/cpufreq/cpuinfo_cur_freq:1031249 cpu0/cpufreq/scaling_cur_freq:1000000 cpu1/cpufreq/cpuinfo_cur_freq:1031249 cpu1/cpufreq/scaling_cur_freq:1000000 cpu2/cpufreq/cpuinfo_cur_freq:1031249 cpu2/cpufreq/scaling_cur_freq:1000000 cpu3/cpufreq/cpuinfo_cur_freq:1031249 cpu3/cpufreq/scaling_cur_freq:1000000
 * 1) echo 1000000 > cpu0/cpufreq/scaling_max_freq
 * 2) grep -E -w "pll0|z" /sys/kernel/debug/clk/clk_summary
 * 1) grep -E -w "pll2|z2" /sys/kernel/debug/clk/clk_summary
 * 1) grep . cpu*/cpufreq/*cur*

.pll0                             0            0  2999999880          0 0 z                              0            0   468749981          0 0 .pll2                             0            0  2399999904          0 0 z2                             0            0  1199999952          0 0 cpu0/cpufreq/cpuinfo_cur_freq:468749 cpu0/cpufreq/scaling_cur_freq:500000 cpu1/cpufreq/cpuinfo_cur_freq:468749 cpu1/cpufreq/scaling_cur_freq:500000 cpu2/cpufreq/cpuinfo_cur_freq:468749 cpu2/cpufreq/scaling_cur_freq:500000 cpu3/cpufreq/cpuinfo_cur_freq:468749 cpu3/cpufreq/scaling_cur_freq:500000
 * 1) echo 500000 > cpu0/cpufreq/scaling_max_freq
 * 2) grep -E -w "pll0|z" /sys/kernel/debug/clk/clk_summary
 * 1) grep -E -w "pll2|z2" /sys/kernel/debug/clk/clk_summary
 * 1) grep . cpu*/cpufreq/*cur*