rockchip: board: Add support for cpu-id parsed from otp

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I27350a847dd13cc7d1eb0cad481adccfead23bce
This commit is contained in:
Sugar Zhang 2020-09-27 11:41:10 +08:00 committed by Jianhong Chen
parent a4c57e8a07
commit d3cb8b064e
1 changed files with 12 additions and 6 deletions

View File

@ -125,22 +125,28 @@ static int rockchip_set_serialno(void)
env_set("serial#", serialno_str);
} else {
#endif
#ifdef CONFIG_ROCKCHIP_EFUSE
#if defined(CONFIG_ROCKCHIP_EFUSE) || defined(CONFIG_ROCKCHIP_OTP)
struct udevice *dev;
/* retrieve the device */
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_GET_DRIVER(rockchip_efuse),
&dev);
if (IS_ENABLED(CONFIG_ROCKCHIP_EFUSE))
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_GET_DRIVER(rockchip_efuse),
&dev);
else
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_GET_DRIVER(rockchip_otp),
&dev);
if (ret) {
printf("%s: could not find efuse device\n", __func__);
printf("%s: could not find efuse/otp device\n", __func__);
return ret;
}
/* read the cpu_id range from the efuses */
ret = misc_read(dev, CPUID_OFF, &cpuid, sizeof(cpuid));
if (ret) {
printf("%s: read cpuid from efuses failed, ret=%d\n",
printf("%s: read cpuid from efuse/otp failed, ret=%d\n",
__func__, ret);
return ret;
}