Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 1 | /* |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 2 | * Copyright (C) 2016 Vladimir Zapolskiy <vz@mleia.com> |
| 3 | * Copyright (C) 2007, 2010 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 6 | */ |
| 7 | |
Wolfgang Denk | 0191e47 | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 8 | #include <asm-offsets.h> |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 9 | #include <config.h> |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 10 | |
| 11 | .text |
| 12 | .align 2 |
| 13 | |
| 14 | .global _start |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 15 | _start: |
Vladimir Zapolskiy | 41e163f | 2016-11-28 00:15:34 +0200 | [diff] [blame^] | 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 |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 22 | mov.l ._lowlevel_init, r0 |
| 23 | 100: bsrf r0 |
| 24 | nop |
| 25 | |
| 26 | bsr 1f |
| 27 | nop |
| 28 | 1: sts pr, r5 |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 29 | mov.l ._reloc_dst, r4 |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 30 | add #(_start-1b), r5 |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 31 | mov.l ._reloc_dst_end, r6 |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 32 | |
| 33 | 2: mov.l @r5+, r1 |
| 34 | mov.l r1, @r4 |
| 35 | add #4, r4 |
| 36 | cmp/hs r6, r4 |
| 37 | bf 2b |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 38 | |
| 39 | mov.l ._bss_start, r4 |
| 40 | mov.l ._bss_end, r5 |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 41 | mov #0, r1 |
| 42 | |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 43 | 3: mov.l r1, @r4 /* bss clear */ |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 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 | |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 51 | mov.l ._sh_generic_init, r0 |
| 52 | jsr @r0 |
| 53 | mov #0, r4 |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 54 | |
| 55 | loop: |
| 56 | bra loop |
| 57 | |
| 58 | .align 2 |
| 59 | |
| 60 | ._lowlevel_init: .long (lowlevel_init - (100b + 4)) |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 61 | ._reloc_dst: .long _start |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 62 | ._reloc_dst_end: .long reloc_dst_end |
| 63 | ._bss_start: .long bss_start |
| 64 | ._bss_end: .long bss_end |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 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 |