aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/platform/68328/head-pilot.S
blob: 2ebfd642081855acb3af3e35dac9066ed886038c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/*
 * linux/arch/m68knommu/platform/68328/head-pilot.S
 * - A startup file for the MC68328
 *
 * Copyright (C) 1998  D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>,
 *                     Kenneth Albanowski <kjahds@kjahds.com>,
 *                     The Silver Hammer Group, Ltd.
 *
 * (c) 1995, Dionne & Associates
 * (c) 1995, DKG Display Tech.
 */

#define ASSEMBLY

#define IMMED #
#define	DBG_PUTC(x)	moveb IMMED x, 0xfffff907


.global _stext
.global _start

.global _rambase
.global _ramvec
.global _ramstart
.global _ramend

.global bootlogo_bits

/*****************************************************************************/

.data

/*
 *      Set up the usable of RAM stuff. Size of RAM is determined then
 *      an initial stack set up at the end.
 */
.align 4
_ramvec:
.long   0
_rambase:
.long   0
_ramstart:
.long   0
_ramend:
.long   0

.text
	
_start:
_stext:


#ifdef CONFIG_M68328

#ifdef CONFIG_PILOT
	.byte 0x4e, 0xfa, 0x00, 0x0a /* Jmp +X bytes */
	.byte 'b', 'o', 'o', 't'
	.word 10000

	nop
#endif

	moveq	#0, %d0
	movew   %d0, 0xfffff618 /* Watchdog off */
	movel	#0x00011f07, 0xfffff114 /* CS A1 Mask */

	movew	#0x0800, 0xfffff906 /* Ignore CTS */
	movew	#0x010b, 0xfffff902 /* BAUD to 9600 */

	movew	#0x2410, 0xfffff200 /* PLLCR */
	movew	#0x123, 0xfffff202 /* PLLFSR */

#ifdef CONFIG_PILOT
	moveb	#0, 0xfffffA27 /* LCKCON */
	movel   #_start, 0xfffffA00 /* LSSA */
	moveb   #0xa, 0xfffffA05 /* LVPW */
	movew	#0x9f, 0xFFFFFa08 /* LXMAX */
	movew	#0x9f, 0xFFFFFa0a /* LYMAX */
	moveb   #9, 0xfffffa29 /* LBAR */
	moveb   #0, 0xfffffa25 /* LPXCD */
	moveb	#0x04, 0xFFFFFa20 /* LPICF */
	moveb	#0x58, 0xfffffA27 /* LCKCON */
	moveb	#0x85, 0xfffff429 /* PFDATA */
	moveb	#0xd8, 0xfffffA27 /* LCKCON */
	moveb	#0xc5, 0xfffff429 /* PFDATA */
	moveb	#0xd5, 0xfffff429 /* PFDATA */

	moveal	#0x00100000, %a3
	moveal	#0x100ffc00, %a4
#endif /* CONFIG_PILOT */

#endif /* CONFIG_M68328 */

	movew   #0x2700, %sr
	lea	%a4@(-4), %sp

	DBG_PUTC('\r')
	DBG_PUTC('\n')
	DBG_PUTC('A')

   	moveq   #0,%d0
	movew	#16384, %d0  /* PLL settle wait loop */
L0:
	subw	#1, %d0
	bne	L0

	DBG_PUTC('B')

	/* Copy command line from beginning of RAM (+16) to end of bss */
	movel	#CONFIG_VECTORBASE, %d7
	addl	#16, %d7
	moveal	%d7, %a0
	moveal	#_ebss, %a1
	lea	%a1@(512), %a2

	DBG_PUTC('C')

	/* Copy %a0 to %a1 until %a1 == %a2 */
L2:
	movel	%a0@+, %d0
	movel	%d0, %a1@+
	cmpal	%a1, %a2
	bhi	L2

	/* Copy data+init segment from ROM to RAM */
	moveal	#_etext, %a0
	moveal	#_sdata, %a1
	moveal	#__init_end, %a2

	DBG_PUTC('D')

	/* Copy %a0 to %a1 until %a1 == %a2 */
LD1:
	movel	%a0@+, %d0
	movel	%d0, %a1@+
	cmpal	%a1, %a2
	bhi	LD1

	DBG_PUTC('E')

	moveal	#_sbss, %a0
	moveal	#_ebss, %a1

	/* Copy 0 to %a0 until %a0 == %a1 */
L1:
	movel	#0, %a0@+
	cmpal	%a0, %a1
	bhi	L1

	DBG_PUTC('F')

	/* Copy command line from end of bss to command line */
	moveal	#_ebss, %a0
	moveal	#command_line, %a1
	lea	%a1@(512), %a2

	DBG_PUTC('G')

	/* Copy %a0 to %a1 until %a1 == %a2 */
L3:
	movel	%a0@+, %d0
	movel	%d0, %a1@+
	cmpal	%a1, %a2
	bhi	L3

	movel	#_sdata, %d0	
	movel	%d0, _rambase	
	movel	#_ebss,	%d0
	movel	%d0, _ramstart

	movel	%a4, %d0
	subl	#4096, %d0	/* Reserve 4K of stack */
	moveq	#79, %d7
	movel	%d0, _ramend

	pea	0
	pea	env
	pea	%sp@(4)
	pea	0

	DBG_PUTC('H')

#ifdef CONFIG_PILOT
	movel	#bootlogo_bits, 0xFFFFFA00
	moveb	#10, 0xFFFFFA05
	movew	#160, 0xFFFFFA08
	movew	#160, 0xFFFFFA0A
#endif /* CONFIG_PILOT */

	DBG_PUTC('I')

	lea	init_thread_union, %a0
	lea	0x2000(%a0), %sp

	DBG_PUTC('J')
	DBG_PUTC('\r')
	DBG_PUTC('\n')

	jsr	start_kernel
_exit:

	jmp	_exit


	.data
env:
	.long	0