Merge branch 'master' of git://git.denx.de/u-boot-video
[oweals/u-boot.git] / arch / arm / mach-k3 / common.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * K3: Common Architecture initialization
4  *
5  * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
6  *      Lokesh Vutla <lokeshvutla@ti.com>
7  */
8
9 #include <common.h>
10 #include <spl.h>
11 #include "common.h"
12 #include <dm.h>
13 #include <remoteproc.h>
14
15 #ifdef CONFIG_SYS_K3_SPL_ATF
16 void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
17 {
18         int ret;
19
20         /*
21          * It is assumed that remoteproc device 1 is the corresponding
22          * cortex A core which runs ATF. Make sure DT reflects the same.
23          */
24         ret = rproc_dev_init(1);
25         if (ret) {
26                 printf("%s: ATF failed to Initialize on rproc: ret= %d\n",
27                        __func__, ret);
28                 hang();
29         }
30
31         ret = rproc_load(1, spl_image->entry_point, 0x200);
32         if (ret) {
33                 printf("%s: ATF failed to load on rproc: ret= %d\n",
34                        __func__, ret);
35                 hang();
36         }
37
38         /* Add an extra newline to differentiate the ATF logs from SPL*/
39         printf("Starting ATF on ARM64 core...\n\n");
40
41         ret = rproc_start(1);
42         if (ret) {
43                 printf("%s: ATF failed to start on rproc: ret= %d\n",
44                        __func__, ret);
45                 hang();
46         }
47
48         debug("ATF started. Wait indefiniely\n");
49         while (1)
50                 asm volatile("wfe");
51 }
52 #endif