[U-Boot,08/12] rockchip: misc: read cpuid either from efuse or otp
diff mbox series

Message ID 20191024232803.10338-9-heiko@sntech.de
State Accepted
Commit e61350a5f5f711fc4427bb1303c54d853db941e0
Delegated to: Kever Yang
Headers show
Series
  • rockchip: add support for px30
Related show

Commit Message

Heiko Stuebner Oct. 24, 2019, 11:27 p.m. UTC
From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>

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>
---
 arch/arm/mach-rockchip/misc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Kever Yang Oct. 25, 2019, 2:11 a.m. UTC | #1
On 2019/10/25 上午7:27, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
>
> 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>

Thanks,
- Kever
> ---
>   arch/arm/mach-rockchip/misc.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-rockchip/misc.c b/arch/arm/mach-rockchip/misc.c
> index c0e4fdbc00..bed4317f7e 100644
> --- a/arch/arm/mach-rockchip/misc.c
> +++ b/arch/arm/mach-rockchip/misc.c
> @@ -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;

Patch
diff mbox series

diff --git a/arch/arm/mach-rockchip/misc.c b/arch/arm/mach-rockchip/misc.c
index c0e4fdbc00..bed4317f7e 100644
--- a/arch/arm/mach-rockchip/misc.c
+++ b/arch/arm/mach-rockchip/misc.c
@@ -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;