Subversion Repositories freemyipod

Rev

Rev 530 | Rev 677 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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