Hi all!
It seems that there’s a flag in the kernel that controls the way the clocks are set during the kernel boot. Especially for Tegra TK1 there’s a flag that is called ‘chip_personality’.
In file arch/arm/mach-tegra/board.h
/* Usage Model */
enum chip_personality {
normal = 0,
always_on,
};
It seems that is an early_param in arch/arm/mach-tegra/common.c, so I expect that in the cmd_line this can be added either as ‘chip_personality=1’ or ‘chip_personality=0’
static int __init tegra_chip_personality(char *id)
{
char *p = id;
chip_personality = memparse(p, &p);
return 0;
}
early_param("chip_personality", tegra_chip_personality);
What it really does is defined in several files, but the important one is the arch/arm/mach-tegra/tegra12_speedo.c
static void rev_sku_to_speedo_ids(int rev, int sku)
{
int can_boost = tegra_get_sku_override();
int chip_personality = tegra_get_chip_personality();
switch (sku) {
...
case 0x1F:
case 0x87:
case 0x27:
case 0x24:
cpu_speedo_id = 5;
soc_speedo_id = 0;
gpu_speedo_id = 1;
threshold_index = 0;
if (sku == 0x87 && chip_personality == always_on) {
cpu_speedo_id = 6;
gpu_speedo_id = 4;
}
break;
...
}
}
SKU it seems to be common for all TK1s and it’s 0x87. You can see than in the boot log:
[ 0.000000] Tegra12: CPU Speedo ID 5, Soc Speedo ID 0, Gpu Speedo ID 1
[ 0.000000] Tegra12: CPU Process ID 0,Soc Process ID 1,Gpu Process ID 0
[ 0.000000] Tegra Revision: A01 SKU: 0x87 CPU Process: 0 Core Process: 1
Also from the above log you can see that the CPU speedo ID is 5 and GPU speedo ID is 1. Which means that chip_personality defaults to 0.
Also in arch/arm/mach-tegra/tegra12_dvfs.c, there are several static structs that define some default parameters and clocks for a few ids. Therefore, in there you can see that the static struct gpu_cvb_dvfs gpu_cvb_dvfs_table defines the clocks for speedo_id =3, 4, 5, 6 and -1. These clocks are for he GPU. Also static struct cpu_cvb_dvfs cpu_cvb_dvfs_table defines the clocks for the CPU.
Now, there are quite a few TK1 chips. The Jetson board has the CD580M chip and everything works just fine. But, there are plenty chips that their part number is CD575M. The only difference in the specs it seems to be the max cpu frequency, but it seems that there’s more than that. I’ve found out that not all chips can work with the max clocks that are set by default in CD580M chips, which means that these chips may crash. Therefore, you need to lower the frequencies for the GPU and CPU.
There’s a way to do that, by limiting the frequencies in /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq and /sys/kernel/debug/clock/override.gbus/rate for CPU and GPU. But that’s not good enough because this can be overridden any time from any script or application. Therefore, the max frequencies must be limited by using the correct clocks and speedo_ids.
I’ve also found that on CD575M, when the chip_personality is set to 1 in the cmd_line then the kernel doesn’t even boot.
Therefore, the question are: What is chip_personality? What are the correct speedo_ids for each chip? How you set the correct speedo_ids, so nothing can override these clocks?