arm: k3: Add a wrapper to get tisci handle
authorLokesh Vutla <lokeshvutla@ti.com>
Fri, 8 Mar 2019 06:17:33 +0000 (11:47 +0530)
committerTom Rini <trini@konsulko.com>
Fri, 12 Apr 2019 12:05:51 +0000 (08:05 -0400)
Create a wrapper to get the ti sci handle.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
arch/arm/mach-k3/common.c
arch/arm/mach-k3/include/mach/sys_proto.h

index 5909bbfa8f5ac5dce697c496edec86aa2543a457..23cd37c3c774557883f81a56b631e2bfa1f6a981 100644 (file)
 #include "common.h"
 #include <dm.h>
 #include <remoteproc.h>
+#include <linux/soc/ti/ti_sci_protocol.h>
+
+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)
index 0b2007981a498648742bcdf3185f49cda5e72955..6c773ac7b64d621569ddd08ec64561253a874a21 100644 (file)
@@ -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