imx: imx8qm/qxp: check whether m4 partition booted
[oweals/u-boot.git] / arch / sh / lib / start.S
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2016 Vladimir Zapolskiy <vz@mleia.com>
4  * Copyright (C) 2007, 2010 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
5  */
6
7 #include <asm-offsets.h>
8 #include <config.h>
9
10         .text
11         .align  2
12
13         .global _start
14 _start:
15         mov.l   ._lowlevel_init, r0
16 100:    bsrf    r0
17         nop
18
19         bsr     1f
20         nop
21 1:      sts     pr, r5
22         mov.l   ._reloc_dst, r4
23         add     #(_start-1b), r5
24         mov.l   ._reloc_dst_end, r6
25 #ifdef CONFIG_OF_SEPARATE
26         mov.l   ._reloc_size, r0
27         add     r5, r0
28         add     #4, r0
29         mov.l   @r0, r0
30         swap.b  r0, r0
31         swap.w  r0, r0
32         swap.b  r0, r0
33         add     #4, r0
34         add     r0, r6
35 #endif
36
37 2:      mov.l   @r5+, r1
38         mov.l   r1, @r4
39         add     #4, r4
40         cmp/hs  r6, r4
41         bf      2b
42
43 #ifndef CONFIG_OF_SEPARATE
44         mov.l   ._bss_start, r4
45         mov.l   ._bss_end, r5
46         mov     #0, r1
47
48 3:      mov.l   r1, @r4                 /* bss clear */
49         add     #4, r4
50         cmp/hs  r5, r4
51         bf      3b
52 #endif
53
54         mov.l   ._gd_init, r13          /* global data */
55         mov.l   ._stack_init, r15       /* stack */
56
57         mov.l   ._sh_generic_init, r0
58         jsr     @r0
59         mov     #0, r4
60
61 loop:
62         bra     loop
63
64         .align  2
65
66 ._lowlevel_init:        .long   (lowlevel_init - (100b + 4))
67 ._reloc_dst:            .long   _start
68 ._reloc_dst_end:        .long   reloc_dst_end
69 ._reloc_size:           .long   (_end - _start)
70 ._bss_start:            .long   bss_start
71 ._bss_end:              .long   bss_end
72 ._gd_init:              .long   (_start - GENERATED_GBL_DATA_SIZE)
73 ._stack_init:           .long   (_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
74 ._sh_generic_init:      .long   board_init_f