Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/m68knommu/platform/68328/head-rom.S |
| 3 | * - A startup file for the MC68328 |
| 4 | * |
| 5 | * Copyright (C) 1998 D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>, |
| 6 | * Kenneth Albanowski <kjahds@kjahds.com>, |
| 7 | * The Silver Hammer Group, Ltd. |
| 8 | * |
| 9 | * (c) 1995, Dionne & Associates |
| 10 | * (c) 1995, DKG Display Tech. |
| 11 | */ |
| 12 | |
| 13 | #define ASSEMBLY |
| 14 | |
| 15 | #define IMMED # |
| 16 | #define DBG_PUTC(x) moveb IMMED x, 0xfffff907 |
| 17 | |
| 18 | #include <linux/config.h> |
| 19 | |
| 20 | .global _stext |
| 21 | .global _start |
| 22 | |
| 23 | .global _rambase |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | .global _ramvec |
| 25 | .global _ramstart |
| 26 | .global _ramend |
| 27 | |
| 28 | .global penguin_bits |
| 29 | |
| 30 | #ifdef CONFIG_PILOT |
| 31 | |
| 32 | #define IMR 0xFFFFF304 |
| 33 | |
| 34 | .data |
| 35 | .align 16 |
| 36 | |
| 37 | penguin_bits: |
| 38 | #include "bootlogo.rh" |
| 39 | |
| 40 | #endif |
| 41 | |
| 42 | /*****************************************************************************/ |
| 43 | |
| 44 | .data |
| 45 | |
| 46 | /* |
| 47 | * Set up the usable of RAM stuff. Size of RAM is determined then |
| 48 | * an initial stack set up at the end. |
| 49 | */ |
| 50 | .align 4 |
| 51 | _ramvec: |
| 52 | .long 0 |
| 53 | _rambase: |
| 54 | .long 0 |
| 55 | _ramstart: |
| 56 | .long 0 |
| 57 | _ramend: |
| 58 | .long 0 |
| 59 | |
| 60 | .text |
| 61 | |
| 62 | _start: |
| 63 | _stext: |
| 64 | |
| 65 | |
| 66 | #ifdef CONFIG_M68328 |
| 67 | |
| 68 | #ifdef CONFIG_PILOT |
| 69 | .byte 0x4e, 0xfa, 0x00, 0x0a /* Jmp +X bytes */ |
| 70 | .byte 'b', 'o', 'o', 't' |
| 71 | .word 10000 |
| 72 | |
| 73 | nop |
| 74 | #endif |
| 75 | |
| 76 | moveq #0, %d0 |
| 77 | movew %d0, 0xfffff618 /* Watchdog off */ |
| 78 | movel #0x00011f07, 0xfffff114 /* CS A1 Mask */ |
| 79 | |
| 80 | movew #0x0800, 0xfffff906 /* Ignore CTS */ |
| 81 | movew #0x010b, 0xfffff902 /* BAUD to 9600 */ |
| 82 | |
| 83 | movew #0x2410, 0xfffff200 /* PLLCR */ |
| 84 | movew #0x123, 0xfffff202 /* PLLFSR */ |
| 85 | |
| 86 | #ifdef CONFIG_PILOT |
| 87 | moveb #0, 0xfffffA27 /* LCKCON */ |
| 88 | movel #_start, 0xfffffA00 /* LSSA */ |
| 89 | moveb #0xa, 0xfffffA05 /* LVPW */ |
| 90 | movew #0x9f, 0xFFFFFa08 /* LXMAX */ |
| 91 | movew #0x9f, 0xFFFFFa0a /* LYMAX */ |
| 92 | moveb #9, 0xfffffa29 /* LBAR */ |
| 93 | moveb #0, 0xfffffa25 /* LPXCD */ |
| 94 | moveb #0x04, 0xFFFFFa20 /* LPICF */ |
| 95 | moveb #0x58, 0xfffffA27 /* LCKCON */ |
| 96 | moveb #0x85, 0xfffff429 /* PFDATA */ |
| 97 | moveb #0xd8, 0xfffffA27 /* LCKCON */ |
| 98 | moveb #0xc5, 0xfffff429 /* PFDATA */ |
| 99 | moveb #0xd5, 0xfffff429 /* PFDATA */ |
| 100 | |
| 101 | moveal #0x00100000, %a3 |
| 102 | moveal #0x100ffc00, %a4 |
| 103 | #endif /* CONFIG_PILOT */ |
| 104 | |
| 105 | #endif /* CONFIG_M68328 */ |
| 106 | |
| 107 | movew #0x2700, %sr |
| 108 | lea %a4@(-4), %sp |
| 109 | |
| 110 | DBG_PUTC('\r') |
| 111 | DBG_PUTC('\n') |
| 112 | DBG_PUTC('A') |
| 113 | |
| 114 | moveq #0,%d0 |
| 115 | movew #16384, %d0 /* PLL settle wait loop */ |
| 116 | L0: |
| 117 | subw #1, %d0 |
| 118 | bne L0 |
| 119 | |
| 120 | DBG_PUTC('B') |
| 121 | |
| 122 | /* Copy command line from beginning of RAM (+16) to end of bss */ |
Greg Ungerer | 2ae9cb6 | 2006-06-26 16:34:04 +1000 | [diff] [blame] | 123 | movel #CONFIG_VECTORBASE, %d7 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | addl #16, %d7 |
| 125 | moveal %d7, %a0 |
| 126 | moveal #_ebss, %a1 |
| 127 | lea %a1@(512), %a2 |
| 128 | |
| 129 | DBG_PUTC('C') |
| 130 | |
| 131 | /* Copy %a0 to %a1 until %a1 == %a2 */ |
| 132 | L2: |
| 133 | movel %a0@+, %d0 |
| 134 | movel %d0, %a1@+ |
| 135 | cmpal %a1, %a2 |
| 136 | bhi L2 |
| 137 | |
| 138 | /* Copy data+init segment from ROM to RAM */ |
| 139 | moveal #_etext, %a0 |
| 140 | moveal #_sdata, %a1 |
| 141 | moveal #__init_end, %a2 |
| 142 | |
| 143 | DBG_PUTC('D') |
| 144 | |
| 145 | /* Copy %a0 to %a1 until %a1 == %a2 */ |
| 146 | LD1: |
| 147 | movel %a0@+, %d0 |
| 148 | movel %d0, %a1@+ |
| 149 | cmpal %a1, %a2 |
| 150 | bhi LD1 |
| 151 | |
| 152 | DBG_PUTC('E') |
| 153 | |
| 154 | moveal #_sbss, %a0 |
| 155 | moveal #_ebss, %a1 |
| 156 | |
| 157 | /* Copy 0 to %a0 until %a0 == %a1 */ |
| 158 | L1: |
| 159 | movel #0, %a0@+ |
| 160 | cmpal %a0, %a1 |
| 161 | bhi L1 |
| 162 | |
| 163 | DBG_PUTC('F') |
| 164 | |
| 165 | /* Copy command line from end of bss to command line */ |
| 166 | moveal #_ebss, %a0 |
| 167 | moveal #command_line, %a1 |
| 168 | lea %a1@(512), %a2 |
| 169 | |
| 170 | DBG_PUTC('G') |
| 171 | |
| 172 | /* Copy %a0 to %a1 until %a1 == %a2 */ |
| 173 | L3: |
| 174 | movel %a0@+, %d0 |
| 175 | movel %d0, %a1@+ |
| 176 | cmpal %a1, %a2 |
| 177 | bhi L3 |
| 178 | |
| 179 | movel #_sdata, %d0 |
| 180 | movel %d0, _rambase |
| 181 | movel #_ebss, %d0 |
| 182 | movel %d0, _ramstart |
| 183 | |
| 184 | movel %a4, %d0 |
| 185 | subl #4096, %d0 /* Reserve 4K of stack */ |
| 186 | moveq #79, %d7 |
| 187 | movel %d0, _ramend |
| 188 | |
| 189 | movel %a3, %d0 |
| 190 | movel %d0, rom_length |
| 191 | |
| 192 | pea 0 |
| 193 | pea env |
| 194 | pea %sp@(4) |
| 195 | pea 0 |
| 196 | |
| 197 | DBG_PUTC('H') |
| 198 | |
| 199 | #ifdef CONFIG_PILOT |
| 200 | movel #penguin_bits, 0xFFFFFA00 |
| 201 | moveb #10, 0xFFFFFA05 |
| 202 | movew #160, 0xFFFFFA08 |
| 203 | movew #160, 0xFFFFFA0A |
| 204 | #endif /* CONFIG_PILOT */ |
| 205 | |
| 206 | DBG_PUTC('I') |
| 207 | |
| 208 | lea init_thread_union, %a0 |
| 209 | lea 0x2000(%a0), %sp |
| 210 | |
| 211 | DBG_PUTC('J') |
| 212 | DBG_PUTC('\r') |
| 213 | DBG_PUTC('\n') |
| 214 | |
| 215 | jsr start_kernel |
| 216 | _exit: |
| 217 | |
| 218 | jmp _exit |
| 219 | |
| 220 | |
| 221 | .data |
| 222 | env: |
| 223 | .long 0 |