arm: k3: Use get_ti_sci_handle() where ever possible
authorLokesh Vutla <lokeshvutla@ti.com>
Mon, 9 Sep 2019 07:17:38 +0000 (12:47 +0530)
committerTom Rini <trini@konsulko.com>
Fri, 13 Sep 2019 15:56:30 +0000 (11:56 -0400)
Instead of calling uclass apis everywhere, use get_ti_sci_handle()
when ever ti_sci is needed.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
arch/arm/mach-k3/am6_init.c
arch/arm/mach-k3/security.c

index 6558fe0ef4bc055e2f282991c7588d52116d7688..0b564f7bd16647134a9e84be1044c9fa2e887b1f 100644 (file)
@@ -219,10 +219,9 @@ u32 spl_boot_device(void)
 
 void release_resources_for_core_shutdown(void)
 {
-       struct udevice *dev;
-       struct ti_sci_handle *ti_sci;
-       struct ti_sci_dev_ops *dev_ops;
-       struct ti_sci_proc_ops *proc_ops;
+       struct ti_sci_handle *ti_sci = get_ti_sci_handle();
+       struct ti_sci_dev_ops *dev_ops = &ti_sci->ops.dev_ops;
+       struct ti_sci_proc_ops *proc_ops = &ti_sci->ops.proc_ops;
        int ret;
        u32 i;
 
@@ -231,15 +230,6 @@ void release_resources_for_core_shutdown(void)
                AM6_DEV_MCU_RTI1,
        };
 
-       /* Get handle to Device Management and Security Controller (SYSFW) */
-       ret = uclass_get_device_by_name(UCLASS_FIRMWARE, "dmsc", &dev);
-       if (ret)
-               panic("Failed to get handle to SYSFW (%d)\n", ret);
-
-       ti_sci = (struct ti_sci_handle *)(ti_sci_get_handle_from_sysfw(dev));
-       dev_ops = &ti_sci->ops.dev_ops;
-       proc_ops = &ti_sci->ops.proc_ops;
-
        /* Iterate through list of devices to put (shutdown) */
        for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
                u32 id = put_device_ids[i];
index 52f49bf01fe2a1c360f920a885ec933e64c54b62..4e011ee10ef7038839c006eba92eaa915ac9d5fa 100644 (file)
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <mach/spl.h>
 #include <spl.h>
+#include <asm/arch/sys_proto.h>
 
 void board_fit_image_post_process(void **p_image, size_t *p_size)
 {
-       struct udevice *dev;
-       struct ti_sci_handle *ti_sci;
-       struct ti_sci_proc_ops *proc_ops;
+       struct ti_sci_handle *ti_sci = get_ti_sci_handle();
+       struct ti_sci_proc_ops *proc_ops = &ti_sci->ops.proc_ops;
        u64 image_addr;
        u32 image_size;
        int ret;
 
-       /* Get handle to Device Management and Security Controller (SYSFW) */
-       ret = uclass_get_device_by_name(UCLASS_FIRMWARE, "dmsc", &dev);
-       if (ret) {
-               printf("Failed to get handle to SYSFW (%d)\n", ret);
-               hang();
-       }
-       ti_sci = (struct ti_sci_handle *)(ti_sci_get_handle_from_sysfw(dev));
-       proc_ops = &ti_sci->ops.proc_ops;
-
        image_addr = (uintptr_t)*p_image;
 
        debug("Authenticating image at address 0x%016llx\n", image_addr);