1/* SPDX-License-Identifier: GPL-2.0 */
2
3#include <linux/sys.h>
4#include <linux/init.h>
5#include <asm/unistd.h>
6#include <asm/setup.h>
7#include <asm/segment.h>
8#include <asm/linkage.h>
9#include <asm/asm-offsets.h>
10#include <asm/thread_info.h>
11#include <asm/errno.h>
12
13#if defined(CONFIG_CPU_H8300H)
14	.h8300h
15#define SYSCR 0xfee012
16#define IRAMTOP 0xffff20
17#endif
18#if defined(CONFIG_CPU_H8S)
19	.h8300s
20#define INTCR 0xffff31
21#define IRAMTOP 0xffc000
22#endif
23
24	__HEAD
25	.global	_start
26_start:
27	mov.l	#IRAMTOP,sp
28	/* .bss clear */
29	mov.l	#_sbss,er5
30	mov.l	#_ebss,er4
31	sub.l	er5,er4
32	shlr	er4
33	shlr	er4
34	sub.l	er2,er2
351:
36	mov.l	er2,@er5
37	adds	#4,er5
38	dec.l	#1,er4
39	bne	1b
40	jsr	@h8300_fdt_init
41
42	/* linux kernel start */
43#if defined(CONFIG_CPU_H8300H)
44	ldc	#0xd0,ccr	/* running kernel */
45	mov.l	#SYSCR,er0
46	bclr	#3,@er0
47#endif
48#if defined(CONFIG_CPU_H8S)
49	ldc	#0x07,exr
50	bclr	#4,@INTCR:8
51	bset	#5,@INTCR:8	/* Interrupt mode 2 */
52	ldc	#0x90,ccr	/* running kernel */
53#endif
54	mov.l	#init_thread_union,sp
55	add.l	#0x2000,sp
56	jsr	@start_kernel
57
581:
59	bra	1b
60
61	.end
62