1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * head.S - Common startup code for 68000 core 4 * 5 * 2012.10.21, Luis Alves <ljalvs@gmail.com>, S 6 * 68000 core based CPU's. Based o 7 * Coldfire by Greg Ungerer <gerg@s 8 * 68328 by D. Jeff Dionne <jeff@ry 9 * Kenneth Albanowski <kja 10 * The Silver Hammer Grou 11 * 12 */ 13 14 #include <linux/linkage.h> 15 #include <linux/init.h> 16 #include <asm/asm-offsets.h> 17 #include <asm/thread_info.h> 18 19 20 /********************************************* 21 * UCSIMM and UCDIMM use CONFIG_MEMORY_RESERVE 22 ********************************************* 23 #ifdef CONFIG_MEMORY_RESERVE 24 #define RAMEND (CONFIG_RAMBASE+CONFIG_RAMSIZE) 25 #else 26 #define RAMEND (CONFIG_RAMBASE+CONFIG_RAMSIZE) 27 #endif 28 /********************************************* 29 30 .global _start 31 .global _rambase 32 .global _ramvec 33 .global _ramstart 34 .global _ramend 35 36 #if defined(CONFIG_PILOT) || defined(CONFIG_IN 37 .global bootlogo_bits 38 #endif 39 40 /* Defining DEBUG_HEAD_CODE, serial port in 68 41 /* #define DEBUG_HEAD_CODE */ 42 #undef DEBUG_HEAD_CODE 43 44 .data 45 46 /********************************************* 47 * RAM setup pointers. Used by the kernel to d 48 ********************************************* 49 50 _rambase: 51 .long 0 52 _ramvec: 53 .long 0 54 _ramstart: 55 .long 0 56 _ramend: 57 .long 0 58 59 __HEAD 60 61 /********************************************* 62 * Entry point, where all begins! 63 ********************************************* 64 65 _start: 66 67 /* Pilot need this specific signature at the s 68 #ifdef CONFIG_PILOT 69 .byte 0x4e, 0xfa, 0x00, 0x0a 70 .byte 'b', 'o', 'o', 't' 71 .word 10000 72 nop 73 moveq #0, %d0 74 movew %d0, 0xfffff618 75 movel #0x00011f07, 0xfffff114 76 #endif /* CONFIG_PILOT */ 77 78 movew #0x2700, %sr 79 80 /********************************************* 81 * Setup PLL and wait for it to settle (in 68x 82 * Also, if enabled, init serial port. 83 ********************************************* 84 #if defined(CONFIG_M68328) || \ 85 defined(CONFIG_M68EZ328) || \ 86 defined(CONFIG_M68VZ328) 87 88 /* Serial port setup. Should only be needed if 89 #ifdef DEBUG_HEAD_CODE 90 movew #0x0800, 0xfffff906 91 movew #0x010b, 0xfffff902 92 movew #0xe100, 0xfffff900 93 #endif /* DEBUG_HEAD */ 94 95 #ifdef CONFIG_PILOT 96 movew #0x2410, 0xfffff200 97 #else 98 movew #0x2400, 0xfffff200 99 #endif 100 movew #0x0123, 0xfffff202 101 moveq #0, %d0 102 movew #16384, %d0 103 _pll_settle: 104 subw #1, %d0 105 bne _pll_settle 106 #endif /* CONFIG_M68x328 */ 107 108 109 /********************************************* 110 * If running kernel from ROM some specific in 111 * (Assuming that everything is already init'e 112 ********************************************* 113 #ifdef CONFIG_ROMKERNEL 114 115 /********************************************* 116 * Init chip registers (uCsimm specific) 117 ********************************************* 118 #ifdef CONFIG_UCSIMM 119 moveb #0x00, 0xfffffb0b /* Wat 120 moveb #0x10, 0xfffff000 /* SCR 121 moveb #0x00, 0xfffff40b /* ena 122 moveb #0x00, 0xfffff423 /* ena 123 moveb #0x08, 0xfffffd0d /* dis 124 moveb #0x07, 0xfffffd0e /* lev 125 movew #0x8600, 0xfffff100 /* FLA 126 movew #0x018b, 0xfffff110 /* 2Me 127 movew #0x8f00, 0xfffffc00 /* DRA 128 movew #0x9667, 0xfffffc02 /* DRA 129 movew #0x0000, 0xfffff106 /* DRA 130 movew #0x068f, 0xfffff116 /* 8Me 131 moveb #0x40, 0xfffff300 /* IVR 132 movel #0x007FFFFF, %d0 /* IMR 133 movel %d0, 0xfffff304 134 moveb 0xfffff42b, %d0 135 andb #0xe0, %d0 136 moveb %d0, 0xfffff42b 137 #endif 138 139 /********************************************* 140 * Init LCD controller. 141 * (Assuming that LCD controller is already in 142 ********************************************* 143 #ifdef CONFIG_INIT_LCD 144 #ifdef CONFIG_PILOT 145 moveb #0, 0xfffffA27 146 movel #_start, 0xfffffA00 147 moveb #0xa, 0xfffffA05 148 movew #0x9f, 0xFFFFFa08 149 movew #0x9f, 0xFFFFFa0a 150 moveb #9, 0xfffffa29 151 moveb #0, 0xfffffa25 152 moveb #0x04, 0xFFFFFa20 153 moveb #0x58, 0xfffffA27 154 moveb #0x85, 0xfffff429 155 moveb #0xd8, 0xfffffA27 156 moveb #0xc5, 0xfffff429 157 moveb #0xd5, 0xfffff429 158 movel #bootlogo_bits, 0xFFFFFA00 159 moveb #10, 0xFFFFFA05 160 movew #160, 0xFFFFFA08 161 movew #160, 0xFFFFFA0A 162 #else /* CONFIG_PILOT */ 163 movel #bootlogo_bits, 0xfffffA00 164 moveb #0x28, 0xfffffA05 165 movew #0x280, 0xFFFFFa08 166 movew #0x1df, 0xFFFFFa0a 167 moveb #0, 0xfffffa29 168 moveb #0, 0xfffffa25 169 moveb #0x08, 0xFFFFFa20 170 moveb #0x01, 0xFFFFFA21 171 moveb #0x81, 0xfffffA27 172 movew #0xff00, 0xfffff412 173 #endif /* CONFIG_PILOT */ 174 #endif /* CONFIG_INIT_LCD */ 175 176 /********************************************* 177 * Kernel is running from FLASH/ROM (XIP) 178 * Copy init text & data to RAM 179 ********************************************* 180 moveal #_etext, %a0 181 moveal #_sdata, %a1 182 moveal #__bss_start, %a2 183 _copy_initmem: 184 movel %a0@+, %a1@+ 185 cmpal %a1, %a2 186 bhi _copy_initmem 187 #endif /* CONFIG_ROMKERNEL */ 188 189 /********************************************* 190 * Setup basic memory information for kernel 191 ********************************************* 192 movel #CONFIG_VECTORBASE,_ramvec 193 movel #CONFIG_RAMBASE,_rambase 194 movel #RAMEND, _ramend 195 lea __bss_stop,%a1 196 movel %a1,_ramstart 197 198 /********************************************* 199 * If the kernel is in RAM, move romfs to righ 200 * adjust _ramstart to where romfs ends. 201 * 202 * (Do this only if CONFIG_MTD_UCLINUX is true 203 ********************************************* 204 205 #if defined(CONFIG_ROMFS_FS) && defined(CONFIG 206 defined(CONFIG_MTD_UCLINUX) 207 lea __bss_start, %a0 208 lea __bss_stop, %a1 209 movel %a0, %a2 210 211 movel 8(%a0), %d0 212 addql #8, %d0 213 andl #0xfffffffc, %d0 214 215 addl %d0, %a0 216 addl %d0, %a1 217 movel %a1, _ramstart 218 _copy_romfs: 219 movel -(%a0), -(%a1) 220 cmpl %a0, %a2 221 bne _copy_romfs 222 #endif /* CONFIG_ROMFS_FS && CONFIG_RAMKERNEL 223 224 /********************************************* 225 * Clear bss region 226 ********************************************* 227 lea __bss_start, %a0 228 lea __bss_stop, %a1 229 _clear_bss: 230 movel #0, (%a0)+ 231 cmpl %a0, %a1 232 bne _clear_bss 233 234 /********************************************* 235 * Load the current task pointer and stack. 236 ********************************************* 237 lea init_thread_union,%a0 238 lea THREAD_SIZE(%a0),%sp 239 jsr start_kernel 240 _exit: 241 jmp _exit
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.