Merge https://gitlab.denx.de/u-boot/custodians/u-boot-socfpga
[oweals/u-boot.git] / arch / arm / mach-k3 / common.c
index 03f01d07eacf7c551f234c873a0d8a78a4e3e0ce..bab5ffdf403d9bc7b9e39d17a59e19787ffbfb58 100644 (file)
@@ -13,6 +13,7 @@
 #include <remoteproc.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <fdt_support.h>
+#include <asm/arch/sys_proto.h>
 
 struct ti_sci_handle *get_ti_sci_handle(void)
 {
@@ -29,8 +30,12 @@ struct ti_sci_handle *get_ti_sci_handle(void)
 #ifdef CONFIG_SYS_K3_SPL_ATF
 void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
 {
+       struct ti_sci_handle *ti_sci = get_ti_sci_handle();
        int ret;
 
+       /* Release all the exclusive devices held by SPL before starting ATF */
+       ti_sci->ops.dev_ops.release_exclusive_devices(ti_sci);
+
        /*
         * It is assumed that remoteproc device 1 is the corresponding
         * Cortex-A core which runs ATF. Make sure DT reflects the same.
@@ -51,7 +56,10 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
        if (ret)
                panic("%s: ATF failed to start on rproc (%d)\n", __func__, ret);
 
-       debug("ATF started. Waiting indefinitely...\n");
+       debug("Releasing resources...\n");
+       release_resources_for_core_shutdown();
+
+       debug("Finalizing core shutdown...\n");
        while (1)
                asm volatile("wfe");
 }
@@ -130,3 +138,9 @@ int fdt_fixup_msmc_ram(void *blob, char *parent_path, char *node_name)
        return 0;
 }
 #endif
+
+#ifndef CONFIG_SYSRESET
+void reset_cpu(ulong ignored)
+{
+}
+#endif