/* SPDX-License-Identifier: GPL-2.0 */
/*
* head . S - Common startup code for 68000 core based CPU ' s
*
* 2012 . 10 . 21 , Luis Alves < ljalvs @ gmail . com > , Single head . S file for all
* 68000 core based CPU ' s . Based on the sources from :
* Coldfire by Greg Ungerer < gerg @ snapgear . com >
* 68328 by D . Jeff Dionne < jeff @ ryeham . ee . ryerson . ca > ,
* Kenneth Albanowski < kjahds @ kjahds . com > ,
* The Silver Hammer Group , Ltd .
*
*/
#include <linux/linkage.h>
#include <linux/init.h>
#include <asm/asm-offsets.h>
#include <asm/thread_info.h>
/*****************************************************************************
* UCSIMM and UCDIMM use CONFIG_MEMORY_RESERVE to reserve some RAM
*****************************************************************************/
#ifdef CONFIG_MEMORY_RESERVE
#define RAMEND (CONFIG_RAMBASE+CONFIG_RAMSIZE)-(CONFIG_MEMORY_RESERVE*0 x100000)
#else
#define RAMEND (CONFIG_RAMBASE+CONFIG_RAMSIZE)
#endif
/*****************************************************************************/
.global _start
.global _rambase
.global _ramvec
.global _ramstart
.global _ramend
#if defined(CONFIG_PILOT) || defined(CONFIG_INIT_LCD)
.global bootlogo_bits
#endif
/* Defining DEBUG_HEAD_CODE, serial port in 68x328 is inited */
/* #define DEBUG_HEAD_CODE */
#undef DEBUG_HEAD_CODE
.data
/*****************************************************************************
* RAM setup pointers . Used by the kernel to determine RAM location and size .
*****************************************************************************/
_rambase:
.long 0
_ramvec:
.long 0
_ramstart:
.long 0
_ramend:
.long 0
__HEAD
/*****************************************************************************
* Entry point , where all begins !
*****************************************************************************/
_start:
/* Pilot need this specific signature at the start of ROM */
#ifdef CONFIG_PILOT
.byte 0 x4e, 0 xfa, 0 x00, 0 x0a /* bra opcode (jmp 10 bytes) */
.byte 'b' , 'o' , 'o' , 't'
.word 10000
nop
moveq #0 , %d0
movew %d0, 0 xfffff618 /* Watchdog off */
movel #0 x00011f07, 0 xfffff114 /* CS A1 Mask */
#endif /* CONFIG_PILOT */
movew #0 x2700, %sr /* disable all interrupts */
/*****************************************************************************
* Setup PLL and wait for it to settle ( in 68 x328 cpu ' s ) .
* Also , if enabled , init serial port .
*****************************************************************************/
#if defined(CONFIG_M68328) || \
defined(CONFIG_M68EZ328) || \
defined(CONFIG_M68VZ328)
/* Serial port setup. Should only be needed if debugging this startup code. */
#ifdef DEBUG_HEAD_CODE
movew #0 x0800, 0 xfffff906 /* Ignore CTS */
movew #0 x010b, 0 xfffff902 /* BAUD to 9600 */
movew #0 xe100, 0 xfffff900 /* enable */
#endif /* DEBUG_HEAD */
#ifdef CONFIG_PILOT
movew #0 x2410, 0 xfffff200 /* PLLCR */
#else
movew #0 x2400, 0 xfffff200 /* PLLCR */
#endif
movew #0 x0123, 0 xfffff202 /* PLLFSR */
moveq #0 , %d0
movew #16384 , %d0 /* PLL settle wait loop */
_pll_settle:
subw #1 , %d0
bne _pll_settle
#endif /* CONFIG_M68x328 */
/*****************************************************************************
* If running kernel from ROM some specific initialization has to be done .
* ( Assuming that everything is already init ' ed when running from RAM )
*****************************************************************************/
#ifdef CONFIG_ROMKERNEL
/*****************************************************************************
* Init chip registers ( uCsimm specific )
*****************************************************************************/
#ifdef CONFIG_UCSIMM
moveb #0 x00, 0 xfffffb0b /* Watchdog off */
moveb #0 x10, 0 xfffff000 /* SCR */
moveb #0 x00, 0 xfffff40b /* enable chip select */
moveb #0 x00, 0 xfffff423 /* enable /DWE */
moveb #0 x08, 0 xfffffd0d /* disable hardmap */
moveb #0 x07, 0 xfffffd0e /* level 7 interrupt clear */
movew #0 x8600, 0 xfffff100 /* FLASH at 0x10c00000 */
movew #0 x018b, 0 xfffff110 /* 2Meg, enable, 0ws */
movew #0 x8f00, 0 xfffffc00 /* DRAM configuration */
movew #0 x9667, 0 xfffffc02 /* DRAM control */
movew #0 x0000, 0 xfffff106 /* DRAM at 0x00000000 */
movew #0 x068f, 0 xfffff116 /* 8Meg, enable, 0ws */
moveb #0 x40, 0 xfffff300 /* IVR */
movel #0 x007FFFFF, %d0 /* IMR */
movel %d0, 0 xfffff304
moveb 0 xfffff42b, %d0
andb #0 xe0, %d0
moveb %d0, 0 xfffff42b
#endif
/*****************************************************************************
* Init LCD controller .
* ( Assuming that LCD controller is already init ' ed when running from RAM )
*****************************************************************************/
#ifdef CONFIG_INIT_LCD
#ifdef CONFIG_PILOT
moveb #0 , 0 xfffffA27 /* LCKCON */
movel #_start, 0 xfffffA00 /* LSSA */
moveb #0 xa, 0 xfffffA05 /* LVPW */
movew #0 x9f, 0 xFFFFFa08 /* LXMAX */
movew #0 x9f, 0 xFFFFFa0a /* LYMAX */
moveb #9 , 0 xfffffa29 /* LBAR */
moveb #0 , 0 xfffffa25 /* LPXCD */
moveb #0 x04, 0 xFFFFFa20 /* LPICF */
moveb #0 x58, 0 xfffffA27 /* LCKCON */
moveb #0 x85, 0 xfffff429 /* PFDATA */
moveb #0 xd8, 0 xfffffA27 /* LCKCON */
moveb #0 xc5, 0 xfffff429 /* PFDATA */
moveb #0 xd5, 0 xfffff429 /* PFDATA */
movel #bootlogo_bits, 0 xFFFFFA00 /* LSSA */
moveb #10 , 0 xFFFFFA05 /* LVPW */
movew #160 , 0 xFFFFFA08 /* LXMAX */
movew #160 , 0 xFFFFFA0A /* LYMAX */
#else /* CONFIG_PILOT */
movel #bootlogo_bits, 0 xfffffA00 /* LSSA */
moveb #0 x28, 0 xfffffA05 /* LVPW */
movew #0 x280, 0 xFFFFFa08 /* LXMAX */
movew #0 x1df, 0 xFFFFFa0a /* LYMAX */
moveb #0 , 0 xfffffa29 /* LBAR */
moveb #0 , 0 xfffffa25 /* LPXCD */
moveb #0 x08, 0 xFFFFFa20 /* LPICF */
moveb #0 x01, 0 xFFFFFA21 /* -ve pol */
moveb #0 x81, 0 xfffffA27 /* LCKCON */
movew #0 xff00, 0 xfffff412 /* LCD pins */
#endif /* CONFIG_PILOT */
#endif /* CONFIG_INIT_LCD */
/*****************************************************************************
* Kernel is running from FLASH / ROM ( XIP )
* Copy init text & data to RAM
*****************************************************************************/
moveal #_etext, %a0
moveal #_sdata, %a1
moveal #__bss_start, %a2
_copy_initmem:
movel %a0@+, %a1@+
cmpal %a1, %a2
bhi _copy_initmem
#endif /* CONFIG_ROMKERNEL */
/*****************************************************************************
* Setup basic memory information for kernel
*****************************************************************************/
movel #CONFIG_VECTORBASE,_ramvec /* set vector base location */
movel #CONFIG_RAMBASE,_rambase /* set the base of RAM */
movel #RAMEND, _ramend /* set end ram addr */
lea __bss_stop,%a1
movel %a1,_ramstart
/*****************************************************************************
* If the kernel is in RAM , move romfs to right above bss and
* adjust _ ramstart to where romfs ends .
*
* ( Do this only if CONFIG_MTD_UCLINUX is true )
*****************************************************************************/
#if defined(CONFIG_ROMFS_FS) && defined(CONFIG_RAMKERNEL) && \
defined(CONFIG_MTD_UCLINUX)
lea __bss_start, %a0 /* get start of bss */
lea __bss_stop, %a1 /* set up destination */
movel %a0, %a2 /* copy of bss start */
movel 8 (%a0), %d0 /* get size of ROMFS */
addql #8 , %d0 /* allow for rounding */
andl #0 xfffffffc, %d0 /* whole words */
addl %d0, %a0 /* copy from end */
addl %d0, %a1 /* copy from end */
movel %a1, _ramstart /* set start of ram */
_copy_romfs:
movel -(%a0), -(%a1) /* copy dword */
cmpl %a0, %a2 /* check if at end */
bne _copy_romfs
#endif /* CONFIG_ROMFS_FS && CONFIG_RAMKERNEL && CONFIG_MTD_UCLINUX */
/*****************************************************************************
* Clear bss region
*****************************************************************************/
lea __bss_start, %a0 /* get start of bss */
lea __bss_stop, %a1 /* get end of bss */
_clear_bss:
movel #0 , (%a0)+ /* clear each word */
cmpl %a0, %a1 /* check if at end */
bne _clear_bss
/*****************************************************************************
* Load the current task pointer and stack .
*****************************************************************************/
lea init_thread_union,%a0
lea THREAD_SIZE(%a0),%sp
jsr start_kernel /* start Linux kernel */
_exit:
jmp _exit /* should never get here */
Messung V0.5 in Prozent C=94 H=85 G=89
¤ Dauer der Verarbeitung: 0.5 Sekunden
¤
*© Formatika GbR, Deutschland