1 /* SPDX-License-Identifier: GPL-2.0 */
3 * linux/arch/arm/boot/compressed/head-sharpsl.S
5 * Copyright (C) 2004-2005 Richard Purdie <rpurdie@rpsys.net>
7 * Sharp's bootloader doesn't pass any kind of machine ID
8 * so we have to figure out the machine for ourselves...
10 * Support for Poodle, Corgi (SL-C700), Shepherd (SL-C750)
11 * Husky (SL-C760), Tosa (SL-C6000), Spitz (SL-C3000),
12 * Akita (SL-C1000) and Borzoi (SL-C3100).
16 #include <linux/linkage.h>
17 #include <asm/mach-types.h>
19 #ifndef CONFIG_PXA_SHARPSL
20 #error What am I doing here...
23 .section ".start", "ax"
27 /* Check for TC6393 - if found we have a Tosa */
29 mov r1, #0x10000000 @ Base address of TC6393 chip
31 ldrh r3, [r1, #8] @ Load TC6393XB Revison: This is 0x0003
33 beq .SHARPEND @ Success -> tosa
35 /* Check for pxa270 - if found, branch */
36 mrc p15, 0, r4, c0, c0 @ Get Processor ID
37 and r4, r4, #0xffffff00
42 /* Check for w100 - if not found we have a Poodle */
43 ldr r1, .W100ADDR @ Base address of w100 chip + regs offset
45 mov r6, #0x31 @ Load Magic Init value
46 str r6, [r1, #0x280] @ to SCRATCH_UMSK
51 mov r6, #0x30 @ Load 2nd Magic Init value
52 str r6, [r1, #0x280] @ to SCRATCH_UMSK
54 ldr r6, [r1, #0] @ Load Chip ID
58 bne .SHARPEND @ We have no w100 - Poodle
60 /* Check for pxa250 - if found we have a Corgi */
64 blo .SHARPEND @ We have a PXA250 - Corgi
66 /* Check for 64MiB flash - if found we have a Shepherd */
69 cmp r3, #0x76 @ 64MiB flash
70 beq .SHARPEND @ We have Shepherd
73 ldr r7, .HUSKYID @ Must be Husky
77 /* Check for 16MiB flash - if found we have Spitz */
80 cmp r3, #0x73 @ 16MiB flash
81 beq .SHARPEND @ We have Spitz
83 /* Check for a second SCOOP chip - if found we have Borzoi */
90 beq .SHARPEND @ We have Borzoi
94 b .SHARPEND @ We have Borzoi
97 .word 0x69052d00 @ PXA255 Processor ID
99 .word 0x69054100 @ PXA270 Processor ID
101 .word 0x57411002 @ w100 Chip ID
103 .word 0x08010000 @ w100 Chip ID Reg Address
107 .word MACH_TYPE_POODLE
109 .word MACH_TYPE_CORGI
111 .word MACH_TYPE_SHEPHERD
113 .word MACH_TYPE_HUSKY
117 .word MACH_TYPE_SPITZ
119 .word MACH_TYPE_AKITA
121 .word MACH_TYPE_BORZOI
124 * Return: r2 - NAND Manufacturer ID
129 mov r1, #0x0c000000 @ Base address of NAND chip
130 ldrb r3, [r1, #24] @ Load FLASHCTL
131 bic r3, r3, #0x11 @ SET NCE
132 orr r3, r3, #0x0a @ SET CLR + FLWP
133 strb r3, [r1, #24] @ Save to FLASHCTL
134 mov r2, #0x90 @ Command "readid"
135 strb r2, [r1, #20] @ Save to FLASHIO
136 bic r3, r3, #2 @ CLR CLE
137 orr r3, r3, #4 @ SET ALE
138 strb r3, [r1, #24] @ Save to FLASHCTL
139 mov r2, #0 @ Address 0x00
140 strb r2, [r1, #20] @ Save to FLASHIO
141 bic r3, r3, #4 @ CLR ALE
142 strb r3, [r1, #24] @ Save to FLASHCTL
144 ldrb r3, [r1, #24] @ Load FLASHCTL
145 tst r3, #32 @ Is chip ready?
147 ldrb r2, [r1, #20] @ NAND Manufacturer ID
148 ldrb r3, [r1, #20] @ NAND Chip ID