blob: 37d38d5fb8498450a5c619c5b0527a0e381ba811 [file] [log] [blame]
Nobuhiro Iwamatsu970dc332007-05-13 20:58:00 +09001/*
Vladimir Zapolskiy946c8c82016-11-28 00:15:33 +02002 * Copyright (C) 2016 Vladimir Zapolskiy <vz@mleia.com>
3 * Copyright (C) 2007, 2010 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Nobuhiro Iwamatsu970dc332007-05-13 20:58:00 +09004 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsu970dc332007-05-13 20:58:00 +09006 */
7
Wolfgang Denk0191e472010-10-26 14:34:52 +02008#include <asm-offsets.h>
Nobuhiro Iwamatsu970dc332007-05-13 20:58:00 +09009#include <config.h>
Nobuhiro Iwamatsu970dc332007-05-13 20:58:00 +090010
11 .text
12 .align 2
13
14 .global _start
Vladimir Zapolskiy946c8c82016-11-28 00:15:33 +020015_start:
Vladimir Zapolskiy41e163f2016-11-28 00:15:34 +020016#ifdef CONFIG_CPU_SH2
17 .long 0x00000010 /* Ppower ON reset PC*/
18 .long 0x00000000
19 .long 0x00000010 /* Manual reset PC */
20 .long 0x00000000
21#endif
Nobuhiro Iwamatsu970dc332007-05-13 20:58:00 +090022 mov.l ._lowlevel_init, r0
23100: bsrf r0
24 nop
25
26 bsr 1f
27 nop
281: sts pr, r5
Wolfgang Denk0a5c2142007-12-27 01:52:50 +010029 mov.l ._reloc_dst, r4
Vladimir Zapolskiy946c8c82016-11-28 00:15:33 +020030 add #(_start-1b), r5
Wolfgang Denk0a5c2142007-12-27 01:52:50 +010031 mov.l ._reloc_dst_end, r6
Nobuhiro Iwamatsu970dc332007-05-13 20:58:00 +090032
332: mov.l @r5+, r1
34 mov.l r1, @r4
35 add #4, r4
36 cmp/hs r6, r4
37 bf 2b
Wolfgang Denk0a5c2142007-12-27 01:52:50 +010038
39 mov.l ._bss_start, r4
40 mov.l ._bss_end, r5
Nobuhiro Iwamatsu970dc332007-05-13 20:58:00 +090041 mov #0, r1
42
Wolfgang Denk0a5c2142007-12-27 01:52:50 +0100433: mov.l r1, @r4 /* bss clear */
Nobuhiro Iwamatsu970dc332007-05-13 20:58:00 +090044 add #4, r4
45 cmp/hs r5, r4
46 bf 3b
47
48 mov.l ._gd_init, r13 /* global data */
49 mov.l ._stack_init, r15 /* stack */
50
Vladimir Zapolskiy946c8c82016-11-28 00:15:33 +020051 mov.l ._sh_generic_init, r0
52 jsr @r0
53 mov #0, r4
Nobuhiro Iwamatsu970dc332007-05-13 20:58:00 +090054
55loop:
56 bra loop
57
58 .align 2
59
60._lowlevel_init: .long (lowlevel_init - (100b + 4))
Vladimir Zapolskiy946c8c82016-11-28 00:15:33 +020061._reloc_dst: .long _start
Nobuhiro Iwamatsu970dc332007-05-13 20:58:00 +090062._reloc_dst_end: .long reloc_dst_end
63._bss_start: .long bss_start
64._bss_end: .long bss_end
Vladimir Zapolskiy946c8c82016-11-28 00:15:33 +020065._gd_init: .long (_start - GENERATED_GBL_DATA_SIZE)
66._stack_init: .long (_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
67._sh_generic_init: .long board_init_f