Subversion Repositories freemyipod

Rev

Rev 677 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
366 theseven 1
@
2
@
677 theseven 3
@    emCORE Loader for iPod Classic
366 theseven 4
@
5
@    Copyright 2010 TheSeven
6
@
7
@
677 theseven 8
@    This file is part of emCORE.
366 theseven 9
@
677 theseven 10
@    emCORE is free software: you can redistribute it and/or
366 theseven 11
@    modify it under the terms of the GNU General Public License as
12
@    published by the Free Software Foundation, either version 2 of the
13
@    License, or (at your option) any later version.
14
@
677 theseven 15
@    emCORE is distributed in the hope that it will be useful,
366 theseven 16
@    but WITHOUT ANY WARRANTY; without even the implied warranty of
17
@    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
@    See the GNU General Public License for more details.
19
@
20
@    You should have received a copy of the GNU General Public License along
677 theseven 21
@    with emCORE.  If not, see <http://www.gnu.org/licenses/>.
366 theseven 22
@
23
@
24
 
25
.global _start
26
_start:
27
 
28
	msr	cpsr_c, #0xd3
29
	mrc	p15, 0, r0,c1,c0
30
	bic	r0, r0, #1
31
	mcr	p15, 0, r0,c1,c0
32
	mov	r0, #0
33
	mcr	p15, 0, r0,c7,c5
34
	mcr	p15, 0, r0,c8,c7
35
	mcr	p15, 0, r0,c13,c0
797 theseven 36
	adr	r5, flushcache
37
	mov	r2, #0x22000000
38
	add	r1, r2, #0x50 + flushcache - _start
39
	adr	r4, _stubend + 4
40
	adr	lr, copyloop
366 theseven 41
 
42
flushcache:
43
	mrc	p15, 0, r15,c7,c14,3
44
	bne	flushcache
45
	mov	r0, #0
46
	mcr	p15, 0, r0,c7,c10,4
797 theseven 47
	mcr	p15, 0, r0,c7,c5
366 theseven 48
	bx	lr
49
 
797 theseven 50
copyloop:
51
	cmp	r1, r2
52
	ldrhi	r3, [r5], #4
53
	strhi	r3, [r2], #4
54
	bhi	copyloop
55
	add	lr, r1, #_start - flushcache - 0x50 + sramstart - flushcache
56
	b	flushcache
57
sramstart:
58
	cmp	r4, r5
59
	ldrhi	r3, [r5], #4
60
	strhi	r3, [r2], #4
61
	bhi	sramstart
62
	bl	flushcache
63
	str	r4, [r2]
64
 
366 theseven 65
	adr	sp, values1
66
	ldmia	sp!, {r10-r12}
67
	mcr	p15, 0, r11,c2,c0
68
	mov	r0, #-1
69
	mcr	p15, 0, r0,c3,c0
70
mmuloop:
71
	str	r12, [r11], #4
72
	add	r12, r12, #0x00100000
73
	cmp	r12, #0x38000000
74
	biccs	r12, r12, #0xc
75
	tst	r12, #0x40000000
76
	beq	mmuloop
77
	mcr	p15, 0, r10,c1,c0
78
	ldmia	sp!, {r0-r12}        @ R0 = SYSCONBASE (temporary)
79
	str	r1, [r0,#0x48]
80
	str	r2, [r0,#0x4c]
81
	mov	r2, #0               @ R2 = 0
82
	str	r2, [r0]
83
	str	r2, [r0,#0x4]
84
	mov	r1, #7
85
	str	r1, [r0,#0x44]
86
	mov	r1, #0x30
87
	str	r1, [r0,#0x44]
88
	str	r2, [r0,#0x60]
89
	str	r3, [r0,#0x28]
90
	str	r4, [r0,#0x38]
91
	mov	r1, #0x34
92
	str	r1, [r0,#0x44]
93
	orr	r1, r1, #0x40000
94
	str	r1, [r0,#0x44]
95
waitpll:
96
	ldr	r1, [r0,#0x40]
97
	tst	r1, #4
98
	beq	waitpll
99
	str	r5, [r0,#0x04]
100
	mov	r1, #0x3000
101
	str	r1, [r0]
102
	mov	r1, #0x8000
103
	orr	r3, r1, #0x80000000
104
	str	r3, [r0,#0x8]
105
	str	r3, [r0,#0xc]
106
	str	r1, [r0,#0x10]
107
	str	r1, [r0,#0x14]
108
	mov	r3, #3
109
	str	r3, [r6]
110
	orr	r1, r0, #0x00200000  @ R1 = TIMERBASE
111
	mov	r4, #0x440
112
	str	r4, [r1,#0xa0]
113
	mov	r4, #0xb
114
	str	r4, [r1,#0xb0]
115
	mvn	r4, r2
116
	str	r4, [r1,#0xa8]
117
	str	r3, [r1,#0xa4]
118
	orr	r3, r1, #0x00800000  @ R3 = GPIOBASE (temporary)
119
gpioloop:
120
	ldr	r4, [sp], #4
121
	str	r4, [r3], #0xc
122
	str	r2, [r3], #0x4
123
	str	r2, [r3], #0x10
124
	tst	r3, #0x200
125
	beq	gpioloop
126
	str	r7, [r3]
127
	add	r7, r7, #0x100
128
	str	r7, [r3]
129
	ldr	r7, [r3,#-0x30]
130
	bic	r7, r7, #0x40
131
	str	r7, [r3,#-0x30]
132
	ldr	r7, [r3,#-0x34]
133
	orr	r7, r7, #0x40
134
	str	r7, [r3,#-0x34]
135
	add	r5, r0, #0x00100000  @ R5 = I2CBASE
136
	bl	i2cwaitrdy           @ R3 = I2C address (temporary)
137
	mov	r7, #0x40            @ R4 = I2C data (temporary)
138
	str	r7, [r5,#8]          @ R6 = I2C scratch register (temporary)
139
	bl	i2cwaitrdy           @ R7 = I2C return address (temporary)
140
	str	r2, [r5,#0x14]       @ R0 = coldboot flag (temporary)
141
	bl	i2cwaitrdy
142
	str	r2, [r5,#0x18]
143
	bl	i2cwaitrdy
144
	mov	r6, #0x80
145
	str	r6, [r5,#0x4]
146
	bl	i2cwaitrdy
147
	str	r2, [r5]
148
	bl	i2cwaitrdy
149
	str	r2, [r5,#0x4]
150
	bl	i2cwaitrdy
151
	str	r7, [r5,#0xc]
152
	bl	i2cwaitrdy
153
	mov	r6, #0x184
154
	str	r6, [r5]
155
	bl	i2cwaitrdy
156
	mov	r6, #0x10
157
	str	r6, [r5,#0x4]
158
	bl	i2cwaitrdy
159
	mov	r3, #0x16
160
	mvn	r4, r2
161
	bl	pmutransfer
162
	and	r0, r4, #7
163
	mov	r3, #0xc
164
	mvn	r4, r2
165
	bl	pmutransfer
166
	and	r4, r4, #8
167
	orr	r0, r0, r4
168
pmuloop:
169
	ldrb	r3, [sp], #1
170
	ldrb	r4, [sp], #1
171
	cmp	r3, #0xff
172
	adrne	lr, pmuloop
173
	bne	pmutransfer
174
	mov	r3, #0x19
175
	mvn	r4, r2
176
	bl	pmutransfer
177
	tst	r4, #1
178
	beq	pwrok
179
	mov	r3, #0x4b
180
	mvn	r4, r2
181
	bl	pmutransfer
182
	tst	r4, #4
183
	bne	pwrok
184
	mov	r3, #0x12
185
	mvn	r4, r2
186
	bl	pmutransfer
187
	tst	r4, #4
188
	bne	pwrok
189
poweroff:
190
	mov	r3, #0xc
191
	mov	r4, #1
192
	bl	pmutransfer
193
	b	poweroff
194
 
195
values1:
196
	.word 0x0005107D @ R10 - CP15r1
197
	.word 0x2203C000 @ R11 - First level page table
198
	.word 0x00000C1E @ R12 - Default segment flags
199
	.word 0x3C500000 @ R0 - SYSCON base
561 theseven 200
	.word 0xFDFFFFE5 @ R1 - PWRCON(0)
201
	.word 0xFFFFEFCD @ R2 - PWRCON(1)
366 theseven 202
	.word 0x01002401 @ R3
203
	.word 0x00007E90 @ R4
204
	.word 0x00404101 @ R5
205
	.word 0x38501000 @ R6
206
	.word 0x00060400 @ R7
207
	.word 0x0000080D @ R8
208
	.word 0x0006105D @ R9
209
	.word 0x001FB621 @ R10
210
	.word 0x0790682B @ R11
211
	.word 0x00008040 @ R12
212
 
213
	.word 0x5322222F @ PCON0
214
	.word 0xEEEEEE00 @ PCON1
215
	.word 0x2332EEEE @ PCON2
216
	.word 0x3333E222 @ PCON3
217
	.word 0x33333333 @ PCON4
218
	.word 0x33333333 @ PCON5
219
	.word 0x3F000E33 @ PCON6
220
	.word 0xEEEEEEEE @ PCON7
221
	.word 0xEEEEEEEE @ PCON8
222
	.word 0xEEEEEEEE @ PCON9
223
	.word 0xE0EEEEEE @ PCONA
224
	.word 0xEF00EE0E @ PCONB
225
	.word 0xEEEE0EEF @ PCONC
226
	.word 0xEEEEEEEE @ PCOND
227
	.word 0x202222EE @ PCONE
228
	.word 0xEEEE0E22 @ PCONF
229
 
230
	.byte 0x0c, 0    @ PMU init address-data pairs
231
	.byte 0x2d, 0x15
232
	.byte 0x2e, 1
233
	.byte 0x37, 0x15
234
	.byte 0x38, 4
235
	.byte 0x2f, 0x15
236
	.byte 0x30, 1
237
	.byte 0x3b, 0
238
	.byte 0x3c, 0x8c
239
	.byte 0x13, 3
240
	.byte 0x14, 0
241
	.byte 0x15, 0
242
	.byte 0x22, 0x2f
243
	.byte 0x23, 1
244
	.byte 0x24, 0
245
	.byte 0x25, 0x10
246
	.byte 0x26, 9
247
	.byte 0x27, 1
248
	.byte 0x1a, 0x6f
249
	.byte 0x1c, 0
250
	.byte 0x1d, 0x59
251
	.byte 0x33, 9
252
	.byte 0x34, 1
253
	.byte 0x39, 0x18
254
	.byte 0x3a, 0
255
	.byte 0x18, 0xa
256
	.byte 0x19, 4
257
	.byte 0x58, 0
258
	.byte 0x07, 0xb0
259
	.byte 0x08, 3
260
	.byte 0x09, 0xfe
261
	.byte 0x0a, 0xfc
262
	.byte 0x0b, 0xff
263
	.byte 0x86, 0xfd
264
	.byte 0x0d, 0xdf
265
	.byte 0x0e, 0xaa
266
	.byte 0x0f, 0x4a
267
	.byte 0x10, 5
268
	.byte 0x11, 0x27
269
	.byte 0x17, 1
270
	.byte 0x2a, 5
271
	.byte 0xff, 0xff @ PMU init terminator
272
 
273
lcddata_ref:
274
	.hword lcddata_0 - lcddata_ref
275
	.hword lcddata_1 - lcddata_ref - 2
276
	.hword lcddata_2 - lcddata_ref - 4
277
	.hword lcddata_3 - lcddata_ref - 6
278
lcddata_0:
279
	.hword 0x4011
280
	.hword 0xc78f
281
	.hword 0x8135
282
	.byte 0x00
283
	.hword 0x813a
284
	.byte 0x06
285
	.hword 0x8136
286
	.byte 0x00
287
	.hword 0x4013
288
	.hword 0x4029
289
	.hword 0xc000
290
lcddata_1:
291
	.hword 0x95b0
292
	.byte 0x3a
293
	.byte 0x3a
294
	.byte 0x80
295
	.byte 0x80
296
	.byte 0x0a
297
	.byte 0x0a
298
	.byte 0x0a
299
	.byte 0x0a
300
	.byte 0x0a
301
	.byte 0x0a
302
	.byte 0x0a
303
	.byte 0x0a
304
	.byte 0x3c
305
	.byte 0x30
306
	.byte 0x0f
307
	.byte 0x00
308
	.byte 0x01
309
	.byte 0x54
310
	.byte 0x06
311
	.byte 0x66
312
	.byte 0x66
313
	.hword 0x81b8
314
	.byte 0xd8
315
	.hword 0x9eb1
316
	.byte 0x14
317
	.byte 0x59
318
	.byte 0x00
319
	.byte 0x15
320
	.byte 0x57
321
	.byte 0x27
322
	.byte 0x04
323
	.byte 0x85
324
	.byte 0x14
325
	.byte 0x59
326
	.byte 0x00
327
	.byte 0x15
328
	.byte 0x57
329
	.byte 0x27
330
	.byte 0x04
331
	.byte 0x85
332
	.byte 0x14
333
	.byte 0x09
334
	.byte 0x15
335
	.byte 0x57
336
	.byte 0x27
337
	.byte 0x04
338
	.byte 0x05
339
	.byte 0x14
340
	.byte 0x09
341
	.byte 0x15
342
	.byte 0x57
343
	.byte 0x27
344
	.byte 0x04
345
	.byte 0x05
346
	.hword 0x40d2
347
	.hword 0x0101
348
	.hword 0x8de0
349
	.byte 0x00
350
	.byte 0x00
351
	.byte 0x00
352
	.byte 0x05
353
	.byte 0x0b
354
	.byte 0x12
355
	.byte 0x16
356
	.byte 0x1f
357
	.byte 0x25
358
	.byte 0x22
359
	.byte 0x24
360
	.byte 0x29
361
	.byte 0x1c
362
	.hword 0x8de1
363
	.byte 0x08
364
	.byte 0x01
365
	.byte 0x01
366
	.byte 0x06
367
	.byte 0x0b
368
	.byte 0x11
369
	.byte 0x15
370
	.byte 0x1f
371
	.byte 0x27
372
	.byte 0x26
373
	.byte 0x29
374
	.byte 0x2f
375
	.byte 0x1e
376
	.hword 0x8de2
377
	.byte 0x07
378
	.byte 0x01
379
	.byte 0x01
380
	.byte 0x05
381
	.byte 0x09
382
	.byte 0x0f
383
	.byte 0x13
384
	.byte 0x1e
385
	.byte 0x26
386
	.byte 0x25
387
	.byte 0x28
388
	.byte 0x2e
389
	.byte 0x1e
390
	.hword 0x8de3
391
	.byte 0x0d
392
	.byte 0x00
393
	.byte 0x00
394
	.byte 0x00
395
	.byte 0x05
396
	.byte 0x0b
397
	.byte 0x12
398
	.byte 0x16
399
	.byte 0x1f
400
	.byte 0x25
401
	.byte 0x22
402
	.byte 0x24
403
	.byte 0x29
404
	.byte 0x1c
405
	.hword 0x8de4
406
	.byte 0x08
407
	.byte 0x01
408
	.byte 0x01
409
	.byte 0x06
410
	.byte 0x0b
411
	.byte 0x11
412
	.byte 0x15
413
	.byte 0x1f
414
	.byte 0x27
415
	.byte 0x26
416
	.byte 0x29
417
	.byte 0x2f
418
	.byte 0x1e
419
	.hword 0x8de5
420
	.byte 0x07
421
	.byte 0x01
422
	.byte 0x01
423
	.byte 0x05
424
	.byte 0x09
425
	.byte 0x0f
426
	.byte 0x13
427
	.byte 0x1e
428
	.byte 0x26
429
	.byte 0x25
430
	.byte 0x28
431
	.byte 0x2e
432
	.byte 0x1e
433
	.hword 0x813a
434
	.byte 0x06
435
	.hword 0x81c2
436
	.byte 0x00
437
	.hword 0x8135
438
	.byte 0x00
439
	.hword 0x4011
440
	.hword 0xce88
441
	.hword 0x4013
442
	.hword 0x4029
378 theseven 443
	.hword 0xc000
366 theseven 444
lcddata_2:
445
lcddata_3:
419 theseven 446
	.hword 0xc010
366 theseven 447
	.hword 0x4008
448
	.hword 0x0808
449
	.hword 0x8110
450
	.byte 0x13
451
	.hword 0x4011
452
	.hword 0x0300
453
	.hword 0x4012
454
	.hword 0x0101
455
	.hword 0x4013
456
	.hword 0x0a03
457
	.hword 0x4014
458
	.hword 0x0a0e
459
	.hword 0x4015
460
	.hword 0x0a19
461
	.hword 0x4016
462
	.hword 0x2402
463
	.hword 0x8118
464
	.byte 0x01
465
	.hword 0x8190
466
	.byte 0x21
467
	.hword 0x4300
378 theseven 468
	.hword 0x0307
366 theseven 469
	.hword 0x4301
378 theseven 470
	.hword 0x0003
471
	.hword 0x4302
366 theseven 472
	.hword 0x0402
473
	.hword 0x4303
474
	.hword 0x0303
475
	.hword 0x4304
378 theseven 476
	.hword 0x0300
366 theseven 477
	.hword 0x4305
378 theseven 478
	.hword 0x0407
366 theseven 479
	.hword 0x4306
378 theseven 480
	.hword 0x1c04
366 theseven 481
	.hword 0x4307
378 theseven 482
	.hword 0x0307
366 theseven 483
	.hword 0x4308
378 theseven 484
	.hword 0x0003
485
	.hword 0x4309
366 theseven 486
	.hword 0x0402
487
	.hword 0x430a
488
	.hword 0x0303
489
	.hword 0x430b
378 theseven 490
	.hword 0x0300
366 theseven 491
	.hword 0x430c
378 theseven 492
	.hword 0x0407
366 theseven 493
	.hword 0x430d
378 theseven 494
	.hword 0x1c04
366 theseven 495
	.hword 0x4310
378 theseven 496
	.hword 0x0707
366 theseven 497
	.hword 0x4311
378 theseven 498
	.hword 0x0407
366 theseven 499
	.hword 0x4312
378 theseven 500
	.hword 0x0306
366 theseven 501
	.hword 0x4313
502
	.hword 0x0303
503
	.hword 0x4314
378 theseven 504
	.hword 0x0300
366 theseven 505
	.hword 0x4315
378 theseven 506
	.hword 0x0407
366 theseven 507
	.hword 0x4316
378 theseven 508
	.hword 0x1c01
366 theseven 509
	.hword 0x4317
378 theseven 510
	.hword 0x0707
366 theseven 511
	.hword 0x4318
378 theseven 512
	.hword 0x0407
366 theseven 513
	.hword 0x4319
378 theseven 514
	.hword 0x0306
366 theseven 515
	.hword 0x431a
516
	.hword 0x0303
517
	.hword 0x431b
378 theseven 518
	.hword 0x0300
366 theseven 519
	.hword 0x431c
378 theseven 520
	.hword 0x0407
366 theseven 521
	.hword 0x431d
378 theseven 522
	.hword 0x1c01
366 theseven 523
	.hword 0x4320
378 theseven 524
	.hword 0x0206
366 theseven 525
	.hword 0x4321
378 theseven 526
	.hword 0x0102
366 theseven 527
	.hword 0x4322
378 theseven 528
	.hword 0x0404
366 theseven 529
	.hword 0x4323
530
	.hword 0x0303
531
	.hword 0x4324
532
	.hword 0x0300
533
	.hword 0x4325
378 theseven 534
	.hword 0x0407
366 theseven 535
	.hword 0x4326
378 theseven 536
	.hword 0x1c1f
366 theseven 537
	.hword 0x4327
378 theseven 538
	.hword 0x0206
366 theseven 539
	.hword 0x4328
378 theseven 540
	.hword 0x0102
366 theseven 541
	.hword 0x4329
378 theseven 542
	.hword 0x0404
366 theseven 543
	.hword 0x432a
544
	.hword 0x0303
545
	.hword 0x432b
546
	.hword 0x0300
547
	.hword 0x432c
378 theseven 548
	.hword 0x0407
366 theseven 549
	.hword 0x432d
378 theseven 550
	.hword 0x1c1f
366 theseven 551
	.hword 0x4400
552
	.hword 0x001d
553
	.hword 0x4401
554
	.hword 0x0001
555
	.hword 0x4205
556
	.hword 0x0060
557
	.hword 0x8107
558
	.byte 0x01
559
	.hword 0x8131
560
	.byte 0x71
561
	.hword 0x4110
562
	.hword 0x0001
563
	.hword 0x4100
564
	.hword 0x17b0
565
	.hword 0x4101
566
	.hword 0x0220
567
	.hword 0x4102
378 theseven 568
	.hword 0x00bd
366 theseven 569
	.hword 0x4103
378 theseven 570
	.hword 0x1500
366 theseven 571
	.hword 0x4105
572
	.hword 0x0103
573
	.hword 0x4106
574
	.hword 0x0105
575
	.hword 0x8107
576
	.byte 0x21
577
	.hword 0x4102
578
	.hword 0x00bd
579
	.hword 0x4001
580
	.hword 0x0110
581
	.hword 0x4003
582
	.hword 0x0230
583
	.hword 0x4002
584
	.hword 0x0500
585
	.hword 0x8107
586
	.byte 0x31
378 theseven 587
	.hword 0x8130
366 theseven 588
	.byte 0x07
589
	.hword 0xc744
590
	.hword 0x4030
591
	.hword 0x03ff
592
	.hword 0xce88
593
	.hword 0x8107
594
	.byte 0x72
595
	.hword 0xe454
596
	.hword 0x4007
597
	.hword 0x0173
598
	.hword 0xc000
599
 
378 theseven 600
	.align 2
601
 
366 theseven 602
lcdbyteseq:
603
	mov	r9, r0,lsr#8
604
	and	r0, r0, #0xff
605
	bl	sendlcdc
606
lcdbyteseqloop:
607
	ldrb	r0, [sp], #1
608
	bl	sendlcdd
609
	subs	r9, r9, #1
610
	bne	lcdbyteseqloop
611
	b	lcdloop
612
 
613
sendlcdc:
614
	ldr	r6, [r4,#0x1c]
615
	ands	r6, r6, #0x10
616
	bne	sendlcdc
617
	str	r0, [r4,#0x04]
618
	mov	pc, lr
619
 
620
sendlcdd:
621
	ldr	r6, [r4,#0x1c]
622
	ands	r6, r6, #0x10
623
	bne	sendlcdd
624
	str	r0, [r4,#0x40]
625
	mov	pc, lr
626
 
627
i2cwaitrdy:
628
	ldr	r6, [r5,#0x10]
629
	cmp	r6, #0
630
	bne	i2cwaitrdy
631
	mov	pc, lr
632
 
633
i2cwait:
634
	ldr	r6, [r5]
635
	tst	r6, #0x10
636
	beq	i2cwait
637
	mov	pc, lr
638
 
639
pmutransfer:
640
	mov	r7, lr
641
	mov	lr, #0xb7
642
	str	lr, [r5]
643
	mov	lr, #0xe6
644
	str	lr, [r5,#0xc]
645
	mov	lr, #0xf0
646
	str	lr, [r5,#0x4]
647
	bl	i2cwait
648
	str	r3, [r5,#0xc]
649
	mov	lr, #0xb7
650
	str	lr, [r5]
651
	bl	i2cwait
652
	cmn	r4, #1
653
	beq	pmuskip
654
	str	r4, [r5,#0xc]
655
	mov	lr, #0xb7
656
	str	lr, [r5]
657
	bl	i2cwait
658
	mov	lr, #0xd0
659
	b	pmudone
660
pmuskip:
661
	mov	lr, #0xe7
662
	str	lr, [r5,#0xc]
663
	mov	lr, #0xb0
664
	str	lr, [r5,#0x4]
665
	mov	lr, #0xb7
666
	str	lr, [r5]
667
	bl	i2cwait
668
	mov	lr, #0x37
669
	str	lr, [r5]
670
	bl	i2cwait
671
	ldr	r3, [r5,#0xc]
672
	mov	lr, #0x90
673
pmudone:
674
	str	lr, [r5,#0x4]
675
	mov	lr, #0xb7
676
	str	lr, [r5]
677
pmuwait:
678
	ldr	lr, [r5,#0x4]
679
	tst	lr, #0x20
680
	bne	pmuwait
681
	mov	pc, r7
682
 
683
udelay:
684
	ldr	r6, [r1,#0xb4]
685
	add	r0, r0, r6
686
udelayloop:
687
	ldr	r6, [r1,#0xb4]
688
	cmp	r6, r0
689
	bmi	udelayloop
690
	mov	pc, lr
691
 
692
 
693
pwrok:
694
	sub	r7, r5, #0x04500000  @ R7 = MIUBASE (temporary)
695
	cmp	r0, #0
696
	moveq	r6, #0x11
697
	streq	r6, [r7]
698
	str	r8, [r7]
699
	str	r2, [r7,#0xf0]
700
	str	r9, [r7,#0x8]
701
	str	r10, [r7,#0x10]
702
	mov	r8, #0x1800
703
	orr	r6, r8, #0x45
704
	str	r6, [r7,#0x200]
705
	str	r6, [r7,#0x204]
706
	str	r8, [r7,#0x210]
707
	str	r8, [r7,#0x214]
708
	str	r6, [r7,#0x220]
709
	str	r6, [r7,#0x224]
710
	add	r6, r6, #0x40
711
	str	r6, [r7,#0x230]
712
	str	r6, [r7,#0x234]
713
	mov	r6, #0x19
714
	str	r6, [r7,#0x14]
715
	str	r6, [r7,#0x18]
716
	str	r11, [r7,#0x1c]
717
	ldr	r6, [r7,#0x314]
718
	bic	r6, r6, #0x10
719
	str	r6, [r7,#0x314]
720
	add	r8, r7, #0x2c
721
	mov	r9, #0x24
722
sdramloop:
723
	ldr	r6, [r8]
724
	bic	r6, r6, #0x01000000
725
	str	r6, [r8], #4
726
	subs	r9, r9, #1
727
	bne	sdramloop
728
	mov	r6, #0x540
729
	str	r6, [r7,#0x1cc]
730
	ldr	r6, [r7,#0x1d4]
731
	orr	r6, r6, #0x80
732
	str	r6, [r7,#0x1d4]
733
	mov	r6, #0x33
734
	str	r6, [r7,#0x4]
735
	str	r6, [r7,#0x4]
736
	orr	r8, r6, #0x200
737
	str	r8, [r7,#0x4]
738
	str	r6, [r7,#0x4]
739
	str	r6, [r7,#0x4]
740
	str	r6, [r7,#0x4]
741
	orr	r8, r8, #0x100
742
	str	r8, [r7,#0x4]
743
	str	r6, [r7,#0x4]
744
	str	r6, [r7,#0x4]
745
	str	r6, [r7,#0x4]
746
	str	r8, [r7,#0x4]
747
	str	r6, [r7,#0x4]
748
	str	r6, [r7,#0x4]
749
	str	r6, [r7,#0x4]
750
	cmp	r0, #0
751
	strne	r6, [r7,#0xc]
752
	bicne	r8, r8, #0x200
753
	strne	r8, [r7,#0x4]
754
	strne	r6, [r7,#0x4]
755
	strne	r6, [r7,#0x4]
756
	strne	r6, [r7,#0x4]
757
	strne	r12, [r7,#0xc]
758
	strne	r8, [r7,#0x4]
759
	strne	r6, [r7,#0x4]
760
	strne	r6, [r7,#0x4]
761
	strne	r6, [r7,#0x4]
762
	ldr	r6, [r7,#0x8]
763
	orr	r6, r6, #0x61000
764
	str	r6, [r7,#0x8]
765
	orr	r3, r1, #0x00800000  @ R3 = GPIOBASE
766
	sub	r4, r1, #0x04400000  @ R4 = LCDBASE
767
	ldr	r0, [r3,#0xc4]
768
	and	r8, r0, #0x30        @ R8 = LCD type GPIO bits << 4
378 theseven 769
	mov	r6, #0x80000000
366 theseven 770
	add	sp, sp, r8,lsr#3
378 theseven 771
	tst	r8, #0x20
366 theseven 772
	ldrh	r0, [sp]
378 theseven 773
	orrne	r6, r6, #0x188
366 theseven 774
	add	sp, sp, r0
378 theseven 775
	orr	r6, r6, #0xc20
366 theseven 776
	mov	r0, #0x33
378 theseven 777
	str	r6, [r4]
366 theseven 778
	str	r0, [r4,#0x20]
779
lcdloop:
780
	adr	lr, lcdloop
781
	ldrb	r6, [sp], #1
782
	ldrb	r7, [sp], #1
783
	orr	r6, r6, r7,lsl#8
784
	mov	r7, r6,lsr#14
785
	bics	r0, r6, #0xc000
786
	add	pc, pc, r7,lsl#2
787
val_80100db0:
788
	.word 0x80100db0
789
	b	sendlcdd
790
	b	sendlcdc
791
	bne	lcdbyteseq
792
	movne	r0, r0,lsl#4
793
	bne	udelay
797 theseven 794
	ldr	r1, _stubend + 4
419 theseven 795
	ldr	r6, val_80100db0
366 theseven 796
	ldr	r0, _stubend
419 theseven 797
	str	r6, [r4]
366 theseven 798
	add	r0, r1, r0
799
	mov	r2, #0x08000000
800
movepayloadloop:
801
	cmp	r0, r1
802
	ldrhi	r3, [r1], #4
803
	strhi	r3, [r2], #4
804
	bhi	movepayloadloop
805
	bl	flushcache
806
	mov	pc, #0x08000000
807
 
808
_stubend: