From 6ce424a92022283db31f6ea278eea0d13c67777f Mon Sep 17 00:00:00 2001 From: Lokesh Vutla Date: Fri, 8 Mar 2019 11:47:33 +0530 Subject: [PATCH] arm: k3: Add a wrapper to get tisci handle Create a wrapper to get the ti sci handle. Signed-off-by: Lokesh Vutla --- arch/arm/mach-k3/common.c | 13 +++++++++++++ arch/arm/mach-k3/include/mach/sys_proto.h | 1 + 2 files changed, 14 insertions(+) diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c index 5909bbfa8f..23cd37c3c7 100644 --- a/arch/arm/mach-k3/common.c +++ b/arch/arm/mach-k3/common.c @@ -11,6 +11,19 @@ #include "common.h" #include #include +#include + +struct ti_sci_handle *get_ti_sci_handle(void) +{ + struct udevice *dev; + int ret; + + ret = uclass_get_device_by_name(UCLASS_FIRMWARE, "dmsc", &dev); + if (ret) + panic("Failed to get SYSFW (%d)\n", ret); + + return (struct ti_sci_handle *)ti_sci_get_handle_from_sysfw(dev); +} #ifdef CONFIG_SYS_K3_SPL_ATF void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) diff --git a/arch/arm/mach-k3/include/mach/sys_proto.h b/arch/arm/mach-k3/include/mach/sys_proto.h index 0b2007981a..6c773ac7b6 100644 --- a/arch/arm/mach-k3/include/mach/sys_proto.h +++ b/arch/arm/mach-k3/include/mach/sys_proto.h @@ -10,5 +10,6 @@ void sdelay(unsigned long loops); u32 wait_on_value(u32 read_bit_mask, u32 match_value, void *read_addr, u32 bound); +struct ti_sci_handle *get_ti_sci_handle(void); #endif