Merge "ipq6018: Add support to patch up cpu_type and soc version"

This commit is contained in:
Linux Build Service Account 2019-06-07 15:35:30 -07:00 committed by Gerrit - the friendly Code Review server
commit b91946abd7

View file

@ -1126,6 +1126,48 @@ void reset_board(void)
void ipq_fdt_fixup_socinfo(void *blob)
{
uint32_t cpu_type;
uint32_t soc_version, soc_version_major, soc_version_minor;
int nodeoff, ret;
nodeoff = fdt_path_offset(blob, "/");
if (nodeoff < 0) {
printf("ipq: fdt fixup cannot find root node\n");
return;
}
ret = ipq_smem_get_socinfo_cpu_type(&cpu_type);
if (!ret) {
ret = fdt_setprop(blob, nodeoff, "cpu_type",
&cpu_type, sizeof(cpu_type));
if (ret)
printf("%s: cannot set cpu type %d\n", __func__, ret);
} else {
printf("%s: cannot get socinfo\n", __func__);
}
ret = ipq_smem_get_socinfo_version((uint32_t *)&soc_version);
if (!ret) {
soc_version_major = SOCINFO_VERSION_MAJOR(soc_version);
soc_version_minor = SOCINFO_VERSION_MINOR(soc_version);
ret = fdt_setprop(blob, nodeoff, "soc_version_major",
&soc_version_major,
sizeof(soc_version_major));
if (ret)
printf("%s: cannot set soc_version_major %d\n",
__func__, soc_version_major);
ret = fdt_setprop(blob, nodeoff, "soc_version_minor",
&soc_version_minor,
sizeof(soc_version_minor));
if (ret)
printf("%s: cannot set soc_version_minor %d\n",
__func__, soc_version_minor);
} else {
printf("%s: cannot get soc version\n", __func__);
}
return;
}