rockchip: misc: read cpuid either from efuse or otp
authorHeiko Stuebner <heiko.stuebner@theobroma-systems.com>
Wed, 25 Sep 2019 18:21:21 +0000 (20:21 +0200)
committerKever Yang <kever.yang@rock-chips.com>
Sun, 17 Nov 2019 09:23:18 +0000 (17:23 +0800)
Newer Rockchip socs use a different ip block to handle one-time-
programmable memory, so depending on what got enabled get the cpuid
from either source.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
arch/arm/mach-rockchip/misc.c

index c0e4fdbc00fec8b5779b792d1f36940bb6a1dc9b..bed4317f7ecee173538f8f56a19ac06a55d95d6c 100644 (file)
@@ -57,13 +57,18 @@ int rockchip_cpuid_from_efuse(const u32 cpuid_offset,
                              const u32 cpuid_length,
                              u8 *cpuid)
 {
-#if CONFIG_IS_ENABLED(ROCKCHIP_EFUSE)
+#if CONFIG_IS_ENABLED(ROCKCHIP_EFUSE) || CONFIG_IS_ENABLED(ROCKCHIP_OTP)
        struct udevice *dev;
        int ret;
 
        /* retrieve the device */
+#if CONFIG_IS_ENABLED(ROCKCHIP_EFUSE)
        ret = uclass_get_device_by_driver(UCLASS_MISC,
                                          DM_GET_DRIVER(rockchip_efuse), &dev);
+#elif CONFIG_IS_ENABLED(ROCKCHIP_OTP)
+       ret = uclass_get_device_by_driver(UCLASS_MISC,
+                                         DM_GET_DRIVER(rockchip_otp), &dev);
+#endif
        if (ret) {
                debug("%s: could not find efuse device\n", __func__);
                return -1;