xref: /openbmc/u-boot/arch/sh/lib/start.S (revision e47b2d67)
1/*
2 * Copyright (C) 2016 Vladimir Zapolskiy <vz@mleia.com>
3 * Copyright (C) 2007, 2010 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
4 *
5 * SPDX-License-Identifier:	GPL-2.0+
6 */
7
8#include <asm-offsets.h>
9#include <config.h>
10
11	.text
12	.align	2
13
14	.global	_start
15_start:
16#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
22	mov.l	._lowlevel_init, r0
23100:	bsrf	r0
24	nop
25
26	bsr	1f
27	nop
281:	sts	pr, r5
29	mov.l	._reloc_dst, r4
30	add	#(_start-1b), r5
31	mov.l	._reloc_dst_end, r6
32
332:	mov.l	@r5+, r1
34	mov.l	r1, @r4
35	add	#4, r4
36	cmp/hs	r6, r4
37	bf	2b
38
39	mov.l	._bss_start, r4
40	mov.l	._bss_end, r5
41	mov	#0, r1
42
433:	mov.l	r1, @r4			/* bss clear */
44	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
51	mov.l	._sh_generic_init, r0
52	jsr	@r0
53	mov     #0, r4
54
55loop:
56	bra	loop
57
58	.align	2
59
60._lowlevel_init:	.long	(lowlevel_init - (100b + 4))
61._reloc_dst:		.long	_start
62._reloc_dst_end:	.long	reloc_dst_end
63._bss_start:		.long	bss_start
64._bss_end:		.long	bss_end
65._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
68