Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 2 | /* |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 3 | * Copyright (C) 2016 Vladimir Zapolskiy <vz@mleia.com> |
| 4 | * Copyright (C) 2007, 2010 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 5 | */ |
| 6 | |
Wolfgang Denk | 0191e47 | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 7 | #include <asm-offsets.h> |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 8 | #include <config.h> |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 9 | |
| 10 | .text |
| 11 | .align 2 |
| 12 | |
| 13 | .global _start |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 14 | _start: |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 15 | mov.l ._lowlevel_init, r0 |
| 16 | 100: bsrf r0 |
| 17 | nop |
| 18 | |
| 19 | bsr 1f |
| 20 | nop |
| 21 | 1: sts pr, r5 |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 22 | mov.l ._reloc_dst, r4 |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 23 | add #(_start-1b), r5 |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 24 | mov.l ._reloc_dst_end, r6 |
Marek Vasut | 5d0cd63 | 2019-09-01 18:05:03 +0200 | [diff] [blame] | 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 |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 36 | |
| 37 | 2: mov.l @r5+, r1 |
| 38 | mov.l r1, @r4 |
| 39 | add #4, r4 |
| 40 | cmp/hs r6, r4 |
| 41 | bf 2b |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 42 | |
Marek Vasut | 5d0cd63 | 2019-09-01 18:05:03 +0200 | [diff] [blame] | 43 | #ifndef CONFIG_OF_SEPARATE |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 44 | mov.l ._bss_start, r4 |
| 45 | mov.l ._bss_end, r5 |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 46 | mov #0, r1 |
| 47 | |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 48 | 3: mov.l r1, @r4 /* bss clear */ |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 49 | add #4, r4 |
| 50 | cmp/hs r5, r4 |
| 51 | bf 3b |
Marek Vasut | 5d0cd63 | 2019-09-01 18:05:03 +0200 | [diff] [blame] | 52 | #endif |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 53 | |
| 54 | mov.l ._gd_init, r13 /* global data */ |
| 55 | mov.l ._stack_init, r15 /* stack */ |
Simon Glass | adad2d0 | 2023-09-26 08:14:27 -0600 | [diff] [blame] | 56 | #if CONFIG_IS_ENABLED(SYS_MALLOC_F) |
Marek Vasut | 9a9247c | 2020-05-09 22:02:50 +0200 | [diff] [blame] | 57 | mov.l ._gd_malloc_base, r14 |
| 58 | mov.l r15, @r14 |
| 59 | #endif |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 60 | mov.l ._sh_generic_init, r0 |
| 61 | jsr @r0 |
| 62 | mov #0, r4 |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 63 | |
| 64 | loop: |
| 65 | bra loop |
| 66 | |
| 67 | .align 2 |
| 68 | |
| 69 | ._lowlevel_init: .long (lowlevel_init - (100b + 4)) |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 70 | ._reloc_dst: .long _start |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 71 | ._reloc_dst_end: .long reloc_dst_end |
Marek Vasut | 5d0cd63 | 2019-09-01 18:05:03 +0200 | [diff] [blame] | 72 | ._reloc_size: .long (_end - _start) |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 73 | ._bss_start: .long bss_start |
| 74 | ._bss_end: .long bss_end |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 75 | ._gd_init: .long (_start - GENERATED_GBL_DATA_SIZE) |
Simon Glass | adad2d0 | 2023-09-26 08:14:27 -0600 | [diff] [blame] | 76 | #if CONFIG_IS_ENABLED(SYS_MALLOC_F) |
Marek Vasut | 9a9247c | 2020-05-09 22:02:50 +0200 | [diff] [blame] | 77 | ._gd_malloc_base: .long (_start - GENERATED_GBL_DATA_SIZE + GD_MALLOC_BASE) |
| 78 | #endif |
Vladimir Zapolskiy | 946c8c8 | 2016-11-28 00:15:33 +0200 | [diff] [blame] | 79 | ._stack_init: .long (_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16) |
| 80 | ._sh_generic_init: .long board_init_f |