Path: blob/master/arch/cris/arch-v10/kernel/head.S
15125 views
/*1* Head of the kernel - alter with care2*3* Copyright (C) 2000, 2001 Axis Communications AB4*5* Authors: Bjorn Wesen ([email protected])6*7*/89#define ASSEMBLER_MACROS_ONLY10/* The IO_* macros use the ## token concatenation operator, so11-traditional must not be used when assembling this file. */12#include <arch/sv_addr_ag.h>1314#define CRAMFS_MAGIC 0x28cd3d4515#define RAM_INIT_MAGIC 0x5690238716#define COMMAND_LINE_MAGIC 0x871095631718#define START_ETHERNET_CLOCK IO_STATE(R_NETWORK_GEN_CONFIG, enable, on) |\19IO_STATE(R_NETWORK_GEN_CONFIG, phy, mii_clk)2021;; exported symbols2223.globl etrax_irv24.globl romfs_start25.globl romfs_length26.globl romfs_in_flash27.globl swapper_pg_dir2829.text3031;; This is the entry point of the kernel. We are in supervisor mode.32;; 0x00000000 if Flash, 0x40004000 if DRAM33;; since etrax actually starts at address 2 when booting from flash, we34;; put a nop (2 bytes) here first so we dont accidentally skip the di35;;36;; NOTICE! The registers r8 and r9 are used as parameters carrying37;; information from the decompressor (if the kernel was compressed).38;; They should not be used in the code below until read.3940nop41di4243;; First setup the kseg_c mapping from where the kernel is linked44;; to 0x40000000 (where the actual DRAM resides) otherwise45;; we cannot do very much! See arch/cris/README.mm46;;47;; Notice that since we're potentially running at 0x00 or 0x40 right now,48;; we will get a fault as soon as we enable the MMU if we dont49;; temporarily map those segments linearily.50;;51;; Due to a bug in Etrax-100 LX version 1 we need to map the memory52;; slightly different. The bug is that you can't remap bit 31 of53;; an address. Though we can check the version register for54;; whether the bug is present, some constants would then have to55;; be variables, so we don't. The drawback is that you can "only" map56;; 1G per process with CONFIG_CRIS_LOW_MAP.5758#ifdef CONFIG_CRIS_LOW_MAP59; kseg mappings, temporary map of 0xc0->0x4060move.d IO_FIELD (R_MMU_KBASE_HI, base_c, 4) \61| IO_FIELD (R_MMU_KBASE_HI, base_b, 0xb) \62| IO_FIELD (R_MMU_KBASE_HI, base_9, 9) \63| IO_FIELD (R_MMU_KBASE_HI, base_8, 8), $r064move.d $r0, [R_MMU_KBASE_HI]6566; temporary map of 0x40->0x40 and 0x60->0x4067move.d IO_FIELD (R_MMU_KBASE_LO, base_6, 4) \68| IO_FIELD (R_MMU_KBASE_LO, base_4, 4), $r069move.d $r0, [R_MMU_KBASE_LO]7071; mmu enable, segs e,c,b,a,6,5,4,0 segment mapped72move.d IO_STATE (R_MMU_CONFIG, mmu_enable, enable) \73| IO_STATE (R_MMU_CONFIG, inv_excp, enable) \74| IO_STATE (R_MMU_CONFIG, acc_excp, enable) \75| IO_STATE (R_MMU_CONFIG, we_excp, enable) \76| IO_STATE (R_MMU_CONFIG, seg_f, page) \77| IO_STATE (R_MMU_CONFIG, seg_e, seg) \78| IO_STATE (R_MMU_CONFIG, seg_d, page) \79| IO_STATE (R_MMU_CONFIG, seg_c, seg) \80| IO_STATE (R_MMU_CONFIG, seg_b, seg) \81| IO_STATE (R_MMU_CONFIG, seg_a, seg) \82| IO_STATE (R_MMU_CONFIG, seg_9, page) \83| IO_STATE (R_MMU_CONFIG, seg_8, page) \84| IO_STATE (R_MMU_CONFIG, seg_7, page) \85| IO_STATE (R_MMU_CONFIG, seg_6, seg) \86| IO_STATE (R_MMU_CONFIG, seg_5, seg) \87| IO_STATE (R_MMU_CONFIG, seg_4, seg) \88| IO_STATE (R_MMU_CONFIG, seg_3, page) \89| IO_STATE (R_MMU_CONFIG, seg_2, page) \90| IO_STATE (R_MMU_CONFIG, seg_1, page) \91| IO_STATE (R_MMU_CONFIG, seg_0, seg), $r092move.d $r0, [R_MMU_CONFIG]93#else94; kseg mappings95move.d IO_FIELD (R_MMU_KBASE_HI, base_e, 8) \96| IO_FIELD (R_MMU_KBASE_HI, base_c, 4) \97| IO_FIELD (R_MMU_KBASE_HI, base_b, 0xb), $r098move.d $r0, [R_MMU_KBASE_HI]99100; temporary map of 0x40->0x40 and 0x00->0x00101move.d IO_FIELD (R_MMU_KBASE_LO, base_4, 4), $r0102move.d $r0, [R_MMU_KBASE_LO]103104; mmu enable, segs f,e,c,b,4,0 segment mapped105move.d IO_STATE (R_MMU_CONFIG, mmu_enable, enable) \106| IO_STATE (R_MMU_CONFIG, inv_excp, enable) \107| IO_STATE (R_MMU_CONFIG, acc_excp, enable) \108| IO_STATE (R_MMU_CONFIG, we_excp, enable) \109| IO_STATE (R_MMU_CONFIG, seg_f, seg) \110| IO_STATE (R_MMU_CONFIG, seg_e, seg) \111| IO_STATE (R_MMU_CONFIG, seg_d, page) \112| IO_STATE (R_MMU_CONFIG, seg_c, seg) \113| IO_STATE (R_MMU_CONFIG, seg_b, seg) \114| IO_STATE (R_MMU_CONFIG, seg_a, page) \115| IO_STATE (R_MMU_CONFIG, seg_9, page) \116| IO_STATE (R_MMU_CONFIG, seg_8, page) \117| IO_STATE (R_MMU_CONFIG, seg_7, page) \118| IO_STATE (R_MMU_CONFIG, seg_6, page) \119| IO_STATE (R_MMU_CONFIG, seg_5, page) \120| IO_STATE (R_MMU_CONFIG, seg_4, seg) \121| IO_STATE (R_MMU_CONFIG, seg_3, page) \122| IO_STATE (R_MMU_CONFIG, seg_2, page) \123| IO_STATE (R_MMU_CONFIG, seg_1, page) \124| IO_STATE (R_MMU_CONFIG, seg_0, seg), $r0125move.d $r0, [R_MMU_CONFIG]126#endif127128;; Now we need to sort out the segments and their locations in RAM or129;; Flash. The image in the Flash (or in DRAM) consists of 3 pieces:130;; 1) kernel text, 2) kernel data, 3) ROM filesystem image131;; But the linker has linked the kernel to expect this layout in132;; DRAM memory:133;; 1) kernel text, 2) kernel data, 3) kernel BSS134;; (the location of the ROM filesystem is determined by the krom driver)135;; If we boot this from Flash, we want to keep the ROM filesystem in136;; the flash, we want to copy the text and need to copy the data to DRAM.137;; But if we boot from DRAM, we need to move the ROMFS image138;; from its position after kernel data, to after kernel BSS, BEFORE the139;; kernel starts using the BSS area (since its "overlayed" with the ROMFS)140;;141;; In both cases, we start in un-cached mode, and need to jump into a142;; cached PC after we're done fiddling around with the segments.143;;144;; arch/etrax100/etrax100.ld sets some symbols that define the start145;; and end of each segment.146147;; Check if we start from DRAM or FLASH by testing PC148149move.d $pc,$r0150and.d 0x7fffffff,$r0 ; get rid of the non-cache bit151cmp.d 0x10000,$r0 ; arbitrary... just something above this code152blo _inflash0153nop154155jump _inram ; enter cached ram156157;; Jumpgate for branches.158_inflash0:159jump _inflash160161;; Put this in a suitable section where we can reclaim storage162;; after init.163.section ".init.text", "ax"164_inflash:165#ifdef CONFIG_ETRAX_ETHERNET166;; Start MII clock to make sure it is running when tranceiver is reset167move.d START_ETHERNET_CLOCK, $r0168move.d $r0, [R_NETWORK_GEN_CONFIG]169#endif170171;; Set up waitstates etc according to kernel configuration.172#ifndef CONFIG_SVINTO_SIM173move.d CONFIG_ETRAX_DEF_R_WAITSTATES, $r0174move.d $r0, [R_WAITSTATES]175176move.d CONFIG_ETRAX_DEF_R_BUS_CONFIG, $r0177move.d $r0, [R_BUS_CONFIG]178#endif179180;; We need to initialze DRAM registers before we start using the DRAM181182cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?183beq _dram_init_finished184nop185186#include "../lib/dram_init.S"187188_dram_init_finished:189;; Copy text+data to DRAM190;; This is fragile - the calculation of r4 as the image size depends191;; on that the labels below actually are the first and last positions192;; in the linker-script.193;;194;; Then the locating of the cramfs image depends on the aforementioned195;; image being located in the flash at 0. This is most often not true,196;; thus the following does not work (normally there is a rescue-block197;; between the physical start of the flash and the flash-image start,198;; and when run with compression, the kernel is actually unpacked to199;; DRAM and we never get here in the first place :))200201moveq 0, $r0 ; source202move.d text_start, $r1 ; destination203move.d __vmlinux_end, $r2 ; end destination204move.d $r2, $r4205sub.d $r1, $r4 ; r4=__vmlinux_end in flash, used below2061: move.w [$r0+], $r3207move.w $r3, [$r1+]208cmp.d $r2, $r1209blo 1b210nop211212;; We keep the cramfs in the flash.213;; There might be none, but that does not matter because214;; we don't do anything than read some bytes here.215216moveq 0, $r0217move.d $r0, [romfs_length] ; default if there is no cramfs218219move.d [$r4], $r0 ; cramfs_super.magic220cmp.d CRAMFS_MAGIC, $r0221bne 1f222nop223move.d [$r4 + 4], $r0 ; cramfs_super.size224move.d $r0, [romfs_length]225#ifdef CONFIG_CRIS_LOW_MAP226add.d 0x50000000, $r4 ; add flash start in virtual memory (cached)227#else228add.d 0xf0000000, $r4 ; add flash start in virtual memory (cached)229#endif230move.d $r4, [romfs_start]2311:232moveq 1, $r0233move.d $r0, [romfs_in_flash]234235jump _start_it ; enter code, cached this time236237_inram:238;; Move the ROM fs to after BSS end. This assumes that the cramfs239;; second longword contains the length of the cramfs240241moveq 0, $r0242move.d $r0, [romfs_length] ; default if there is no cramfs243244;; The kernel could have been unpacked to DRAM by the loader, but245;; the cramfs image could still be in the Flash directly after the246;; compressed kernel image. The loader passes the address of the247;; byte succeeding the last compressed byte in the flash in the248;; register r9 when starting the kernel. Check if r9 points to a249;; decent cramfs image!250;; (Notice that if this is not booted from the loader, r9 will be251;; garbage but we do sanity checks on it, the chance that it points252;; to a cramfs magic is small.. )253254cmp.d 0x0ffffff8, $r9255bhs _no_romfs_in_flash ; r9 points outside the flash area256nop257move.d [$r9], $r0 ; cramfs_super.magic258cmp.d CRAMFS_MAGIC, $r0259bne _no_romfs_in_flash260nop261move.d [$r9+4], $r0 ; cramfs_super.length262move.d $r0, [romfs_length]263#ifdef CONFIG_CRIS_LOW_MAP264add.d 0x50000000, $r9 ; add flash start in virtual memory (cached)265#else266add.d 0xf0000000, $r9 ; add flash start in virtual memory (cached)267#endif268move.d $r9, [romfs_start]269270moveq 1, $r0271move.d $r0, [romfs_in_flash]272273jump _start_it ; enter code, cached this time274275_no_romfs_in_flash:276277;; Check if there is a cramfs (magic value).278;; Notice that we check for cramfs magic value - which is279;; the "rom fs" we'll possibly use in 2.4 if not JFFS (which does280;; not need this mechanism anyway)281282move.d __init_end, $r0; the image will be after the end of init283move.d [$r0], $r1 ; cramfs assumes same endian on host/target284cmp.d CRAMFS_MAGIC, $r1; magic value in cramfs superblock285bne 2f286nop287288;; Ok. What is its size ?289290move.d [$r0 + 4], $r2 ; cramfs_super.size (again, no need to swapwb)291292;; We want to copy it to the end of the BSS293294move.d _end, $r1295296;; Remember values so cramfs and setup can find this info297298move.d $r1, [romfs_start] ; new romfs location299move.d $r2, [romfs_length]300301;; We need to copy it backwards, since they can be overlapping302303add.d $r2, $r0304add.d $r2, $r1305306;; Go ahead. Make my loop.307308lsrq 1, $r2 ; size is in bytes, we copy words3093101: move.w [$r0=$r0-2],$r3311move.w $r3,[$r1=$r1-2]312subq 1, $r2313bne 1b314nop3153162:317;; Dont worry that the BSS is tainted. It will be cleared later.318319moveq 0, $r0320move.d $r0, [romfs_in_flash]321322jump _start_it ; better skip the additional cramfs check below323324_start_it:325326;; Check if kernel command line is supplied327cmp.d COMMAND_LINE_MAGIC, $r10328bne no_command_line329nop330331move.d 256, $r13332move.d cris_command_line, $r10333or.d 0x80000000, $r11 ; Make it virtual3341:335move.b [$r11+], $r12336move.b $r12, [$r10+]337subq 1, $r13338bne 1b339nop340341no_command_line:342343;; the kernel stack is overlayed with the task structure for each344;; task. thus the initial kernel stack is in the same page as the345;; init_task (but starts in the top of the page, size 8192)346move.d init_thread_union + 8192, $sp347move.d ibr_start,$r0 ; this symbol is set by the linker script348move $r0,$ibr349move.d $r0,[etrax_irv] ; set the interrupt base register and pointer350351;; Clear BSS region, from _bss_start to _end352353move.d __bss_start, $r0354move.d _end, $r13551: clear.d [$r0+]356cmp.d $r1, $r0357blo 1b358nop359360#ifdef CONFIG_BLK_DEV_ETRAXIDE361;; disable ATA before enabling it in genconfig below362moveq 0,$r0363move.d $r0,[R_ATA_CTRL_DATA]364move.d $r0,[R_ATA_TRANSFER_CNT]365move.d $r0,[R_ATA_CONFIG]366#if 0367move.d R_PORT_G_DATA, $r1368move.d $r0, [$r1]; assert ATA bus-reset369nop370nop371nop372nop373nop374nop375move.d 0x08000000,$r0376move.d $r0,[$r1]377#endif378#endif379380#ifdef CONFIG_JULIETTE381;; configure external DMA channel 0 before enabling it in genconfig382383moveq 0,$r0384move.d $r0,[R_EXT_DMA_0_ADDR]385; cnt enable, word size, output, stop, size 0386move.d IO_STATE (R_EXT_DMA_0_CMD, cnt, enable) \387| IO_STATE (R_EXT_DMA_0_CMD, rqpol, ahigh) \388| IO_STATE (R_EXT_DMA_0_CMD, apol, ahigh) \389| IO_STATE (R_EXT_DMA_0_CMD, rq_ack, burst) \390| IO_STATE (R_EXT_DMA_0_CMD, wid, word) \391| IO_STATE (R_EXT_DMA_0_CMD, dir, output) \392| IO_STATE (R_EXT_DMA_0_CMD, run, stop) \393| IO_FIELD (R_EXT_DMA_0_CMD, trf_count, 0),$r0394move.d $r0,[R_EXT_DMA_0_CMD]395396;; reset dma4 and wait for completion397398moveq IO_STATE (R_DMA_CH4_CMD, cmd, reset),$r0399move.b $r0,[R_DMA_CH4_CMD]4001: move.b [R_DMA_CH4_CMD],$r0401and.b IO_MASK (R_DMA_CH4_CMD, cmd),$r0402cmp.b IO_STATE (R_DMA_CH4_CMD, cmd, reset),$r0403beq 1b404nop405406;; reset dma5 and wait for completion407408moveq IO_STATE (R_DMA_CH5_CMD, cmd, reset),$r0409move.b $r0,[R_DMA_CH5_CMD]4101: move.b [R_DMA_CH5_CMD],$r0411and.b IO_MASK (R_DMA_CH5_CMD, cmd),$r0412cmp.b IO_STATE (R_DMA_CH5_CMD, cmd, reset),$r0413beq 1b414nop415#endif416417;; Etrax product HW genconfig setup418419moveq 0,$r0420421;; Select or disable serial port 2422#ifdef CONFIG_ETRAX_SERIAL_PORT2423or.d IO_STATE (R_GEN_CONFIG, ser2, select),$r0424#else425or.d IO_STATE (R_GEN_CONFIG, ser2, disable),$r0426#endif427428;; Init interfaces (disable them).429or.d IO_STATE (R_GEN_CONFIG, scsi0, disable) \430| IO_STATE (R_GEN_CONFIG, ata, disable) \431| IO_STATE (R_GEN_CONFIG, par0, disable) \432| IO_STATE (R_GEN_CONFIG, mio, disable) \433| IO_STATE (R_GEN_CONFIG, scsi1, disable) \434| IO_STATE (R_GEN_CONFIG, scsi0w, disable) \435| IO_STATE (R_GEN_CONFIG, par1, disable) \436| IO_STATE (R_GEN_CONFIG, ser3, disable) \437| IO_STATE (R_GEN_CONFIG, mio_w, disable) \438| IO_STATE (R_GEN_CONFIG, usb1, disable) \439| IO_STATE (R_GEN_CONFIG, usb2, disable) \440| IO_STATE (R_GEN_CONFIG, par_w, disable),$r0441442;; Init DMA channel muxing (set to unused clients).443or.d IO_STATE (R_GEN_CONFIG, dma2, ata) \444| IO_STATE (R_GEN_CONFIG, dma3, ata) \445| IO_STATE (R_GEN_CONFIG, dma4, scsi1) \446| IO_STATE (R_GEN_CONFIG, dma5, scsi1) \447| IO_STATE (R_GEN_CONFIG, dma6, unused) \448| IO_STATE (R_GEN_CONFIG, dma7, unused) \449| IO_STATE (R_GEN_CONFIG, dma8, usb) \450| IO_STATE (R_GEN_CONFIG, dma9, usb),$r0451452453#if defined(CONFIG_ETRAX_DEF_R_PORT_G0_DIR_OUT)454or.d IO_STATE (R_GEN_CONFIG, g0dir, out),$r0455#endif456457#if defined(CONFIG_ETRAX_DEF_R_PORT_G8_15_DIR_OUT)458or.d IO_STATE (R_GEN_CONFIG, g8_15dir, out),$r0459#endif460#if defined(CONFIG_ETRAX_DEF_R_PORT_G16_23_DIR_OUT)461or.d IO_STATE (R_GEN_CONFIG, g16_23dir, out),$r0462#endif463464#if defined(CONFIG_ETRAX_DEF_R_PORT_G24_DIR_OUT)465or.d IO_STATE (R_GEN_CONFIG, g24dir, out),$r0466#endif467468move.d $r0,[genconfig_shadow] ; init a shadow register of R_GEN_CONFIG469470#ifndef CONFIG_SVINTO_SIM471move.d $r0,[R_GEN_CONFIG]472473#if 0474moveq 4,$r0475move.b $r0,[R_DMA_CH6_CMD] ; reset (ser0 dma out)476move.b $r0,[R_DMA_CH7_CMD] ; reset (ser0 dma in)4771: move.b [R_DMA_CH6_CMD],$r0 ; wait for reset cycle to finish478and.b 7,$r0479cmp.b 4,$r0480beq 1b481nop4821: move.b [R_DMA_CH7_CMD],$r0 ; wait for reset cycle to finish483and.b 7,$r0484cmp.b 4,$r0485beq 1b486nop487#endif488489moveq IO_STATE (R_DMA_CH8_CMD, cmd, reset),$r0490move.b $r0,[R_DMA_CH8_CMD] ; reset (ser1 dma out)491move.b $r0,[R_DMA_CH9_CMD] ; reset (ser1 dma in)4921: move.b [R_DMA_CH8_CMD],$r0 ; wait for reset cycle to finish493andq IO_MASK (R_DMA_CH8_CMD, cmd),$r0494cmpq IO_STATE (R_DMA_CH8_CMD, cmd, reset),$r0495beq 1b496nop4971: move.b [R_DMA_CH9_CMD],$r0 ; wait for reset cycle to finish498andq IO_MASK (R_DMA_CH9_CMD, cmd),$r0499cmpq IO_STATE (R_DMA_CH9_CMD, cmd, reset),$r0500beq 1b501nop502503;; setup port PA and PB default initial directions and data504;; including their shadow registers505506move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR,$r0507#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PA7)508or.b IO_STATE (R_PORT_PA_DIR, dir7, output),$r0509#endif510move.b $r0,[port_pa_dir_shadow]511move.b $r0,[R_PORT_PA_DIR]512move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA,$r0513#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PA7)514#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH)515and.b ~(1 << 7),$r0516#else517or.b (1 << 7),$r0518#endif519#endif520move.b $r0,[port_pa_data_shadow]521move.b $r0,[R_PORT_PA_DATA]522523move.b CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG,$r0524move.b $r0,[port_pb_config_shadow]525move.b $r0,[R_PORT_PB_CONFIG]526move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR,$r0527#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PB5)528or.b IO_STATE (R_PORT_PB_DIR, dir5, output),$r0529#endif530move.b $r0,[port_pb_dir_shadow]531move.b $r0,[R_PORT_PB_DIR]532move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA,$r0533#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PB5)534#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH)535and.b ~(1 << 5),$r0536#else537or.b (1 << 5),$r0538#endif539#endif540move.b $r0,[port_pb_data_shadow]541move.b $r0,[R_PORT_PB_DATA]542543moveq 0, $r0544move.d $r0,[port_pb_i2c_shadow]545move.d $r0, [R_PORT_PB_I2C]546547moveq 0,$r0548#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_G10)549#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH)550and.d ~(1 << 10),$r0551#else552or.d (1 << 10),$r0553#endif554#endif555#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_G11)556#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH)557and.d ~(1 << 11),$r0558#else559or.d (1 << 11),$r0560#endif561#endif562move.d $r0,[port_g_data_shadow]563move.d $r0,[R_PORT_G_DATA]564565;; setup the serial port 0 at 115200 baud for debug purposes566567moveq IO_STATE (R_SERIAL0_XOFF, tx_stop, enable) \568| IO_STATE (R_SERIAL0_XOFF, auto_xoff, disable) \569| IO_FIELD (R_SERIAL0_XOFF, xoff_char, 0),$r0570move.d $r0,[R_SERIAL0_XOFF]571572; 115.2kbaud for both transmit and receive573move.b IO_STATE (R_SERIAL0_BAUD, tr_baud, c115k2Hz) \574| IO_STATE (R_SERIAL0_BAUD, rec_baud, c115k2Hz),$r0575move.b $r0,[R_SERIAL0_BAUD]576577; Set up and enable the serial0 receiver.578move.b IO_STATE (R_SERIAL0_REC_CTRL, dma_err, stop) \579| IO_STATE (R_SERIAL0_REC_CTRL, rec_enable, enable) \580| IO_STATE (R_SERIAL0_REC_CTRL, rts_, active) \581| IO_STATE (R_SERIAL0_REC_CTRL, sampling, middle) \582| IO_STATE (R_SERIAL0_REC_CTRL, rec_stick_par, normal) \583| IO_STATE (R_SERIAL0_REC_CTRL, rec_par, even) \584| IO_STATE (R_SERIAL0_REC_CTRL, rec_par_en, disable) \585| IO_STATE (R_SERIAL0_REC_CTRL, rec_bitnr, rec_8bit),$r0586move.b $r0,[R_SERIAL0_REC_CTRL]587588; Set up and enable the serial0 transmitter.589move.b IO_FIELD (R_SERIAL0_TR_CTRL, txd, 0) \590| IO_STATE (R_SERIAL0_TR_CTRL, tr_enable, enable) \591| IO_STATE (R_SERIAL0_TR_CTRL, auto_cts, disabled) \592| IO_STATE (R_SERIAL0_TR_CTRL, stop_bits, one_bit) \593| IO_STATE (R_SERIAL0_TR_CTRL, tr_stick_par, normal) \594| IO_STATE (R_SERIAL0_TR_CTRL, tr_par, even) \595| IO_STATE (R_SERIAL0_TR_CTRL, tr_par_en, disable) \596| IO_STATE (R_SERIAL0_TR_CTRL, tr_bitnr, tr_8bit),$r0597move.b $r0,[R_SERIAL0_TR_CTRL]598599;; setup the serial port 1 at 115200 baud for debug purposes600601moveq IO_STATE (R_SERIAL1_XOFF, tx_stop, enable) \602| IO_STATE (R_SERIAL1_XOFF, auto_xoff, disable) \603| IO_FIELD (R_SERIAL1_XOFF, xoff_char, 0),$r0604move.d $r0,[R_SERIAL1_XOFF]605606; 115.2kbaud for both transmit and receive607move.b IO_STATE (R_SERIAL1_BAUD, tr_baud, c115k2Hz) \608| IO_STATE (R_SERIAL1_BAUD, rec_baud, c115k2Hz),$r0609move.b $r0,[R_SERIAL1_BAUD]610611; Set up and enable the serial1 receiver.612move.b IO_STATE (R_SERIAL1_REC_CTRL, dma_err, stop) \613| IO_STATE (R_SERIAL1_REC_CTRL, rec_enable, enable) \614| IO_STATE (R_SERIAL1_REC_CTRL, rts_, active) \615| IO_STATE (R_SERIAL1_REC_CTRL, sampling, middle) \616| IO_STATE (R_SERIAL1_REC_CTRL, rec_stick_par, normal) \617| IO_STATE (R_SERIAL1_REC_CTRL, rec_par, even) \618| IO_STATE (R_SERIAL1_REC_CTRL, rec_par_en, disable) \619| IO_STATE (R_SERIAL1_REC_CTRL, rec_bitnr, rec_8bit),$r0620move.b $r0,[R_SERIAL1_REC_CTRL]621622; Set up and enable the serial1 transmitter.623move.b IO_FIELD (R_SERIAL1_TR_CTRL, txd, 0) \624| IO_STATE (R_SERIAL1_TR_CTRL, tr_enable, enable) \625| IO_STATE (R_SERIAL1_TR_CTRL, auto_cts, disabled) \626| IO_STATE (R_SERIAL1_TR_CTRL, stop_bits, one_bit) \627| IO_STATE (R_SERIAL1_TR_CTRL, tr_stick_par, normal) \628| IO_STATE (R_SERIAL1_TR_CTRL, tr_par, even) \629| IO_STATE (R_SERIAL1_TR_CTRL, tr_par_en, disable) \630| IO_STATE (R_SERIAL1_TR_CTRL, tr_bitnr, tr_8bit),$r0631move.b $r0,[R_SERIAL1_TR_CTRL]632633#ifdef CONFIG_ETRAX_SERIAL_PORT2634;; setup the serial port 2 at 115200 baud for debug purposes635636moveq IO_STATE (R_SERIAL2_XOFF, tx_stop, enable) \637| IO_STATE (R_SERIAL2_XOFF, auto_xoff, disable) \638| IO_FIELD (R_SERIAL2_XOFF, xoff_char, 0),$r0639move.d $r0,[R_SERIAL2_XOFF]640641; 115.2kbaud for both transmit and receive642move.b IO_STATE (R_SERIAL2_BAUD, tr_baud, c115k2Hz) \643| IO_STATE (R_SERIAL2_BAUD, rec_baud, c115k2Hz),$r0644move.b $r0,[R_SERIAL2_BAUD]645646; Set up and enable the serial2 receiver.647move.b IO_STATE (R_SERIAL2_REC_CTRL, dma_err, stop) \648| IO_STATE (R_SERIAL2_REC_CTRL, rec_enable, enable) \649| IO_STATE (R_SERIAL2_REC_CTRL, rts_, active) \650| IO_STATE (R_SERIAL2_REC_CTRL, sampling, middle) \651| IO_STATE (R_SERIAL2_REC_CTRL, rec_stick_par, normal) \652| IO_STATE (R_SERIAL2_REC_CTRL, rec_par, even) \653| IO_STATE (R_SERIAL2_REC_CTRL, rec_par_en, disable) \654| IO_STATE (R_SERIAL2_REC_CTRL, rec_bitnr, rec_8bit),$r0655move.b $r0,[R_SERIAL2_REC_CTRL]656657; Set up and enable the serial2 transmitter.658move.b IO_FIELD (R_SERIAL2_TR_CTRL, txd, 0) \659| IO_STATE (R_SERIAL2_TR_CTRL, tr_enable, enable) \660| IO_STATE (R_SERIAL2_TR_CTRL, auto_cts, disabled) \661| IO_STATE (R_SERIAL2_TR_CTRL, stop_bits, one_bit) \662| IO_STATE (R_SERIAL2_TR_CTRL, tr_stick_par, normal) \663| IO_STATE (R_SERIAL2_TR_CTRL, tr_par, even) \664| IO_STATE (R_SERIAL2_TR_CTRL, tr_par_en, disable) \665| IO_STATE (R_SERIAL2_TR_CTRL, tr_bitnr, tr_8bit),$r0666move.b $r0,[R_SERIAL2_TR_CTRL]667#endif668669#ifdef CONFIG_ETRAX_SERIAL_PORT3670;; setup the serial port 3 at 115200 baud for debug purposes671672moveq IO_STATE (R_SERIAL3_XOFF, tx_stop, enable) \673| IO_STATE (R_SERIAL3_XOFF, auto_xoff, disable) \674| IO_FIELD (R_SERIAL3_XOFF, xoff_char, 0),$r0675move.d $r0,[R_SERIAL3_XOFF]676677; 115.2kbaud for both transmit and receive678move.b IO_STATE (R_SERIAL3_BAUD, tr_baud, c115k2Hz) \679| IO_STATE (R_SERIAL3_BAUD, rec_baud, c115k2Hz),$r0680move.b $r0,[R_SERIAL3_BAUD]681682; Set up and enable the serial3 receiver.683move.b IO_STATE (R_SERIAL3_REC_CTRL, dma_err, stop) \684| IO_STATE (R_SERIAL3_REC_CTRL, rec_enable, enable) \685| IO_STATE (R_SERIAL3_REC_CTRL, rts_, active) \686| IO_STATE (R_SERIAL3_REC_CTRL, sampling, middle) \687| IO_STATE (R_SERIAL3_REC_CTRL, rec_stick_par, normal) \688| IO_STATE (R_SERIAL3_REC_CTRL, rec_par, even) \689| IO_STATE (R_SERIAL3_REC_CTRL, rec_par_en, disable) \690| IO_STATE (R_SERIAL3_REC_CTRL, rec_bitnr, rec_8bit),$r0691move.b $r0,[R_SERIAL3_REC_CTRL]692693; Set up and enable the serial3 transmitter.694move.b IO_FIELD (R_SERIAL3_TR_CTRL, txd, 0) \695| IO_STATE (R_SERIAL3_TR_CTRL, tr_enable, enable) \696| IO_STATE (R_SERIAL3_TR_CTRL, auto_cts, disabled) \697| IO_STATE (R_SERIAL3_TR_CTRL, stop_bits, one_bit) \698| IO_STATE (R_SERIAL3_TR_CTRL, tr_stick_par, normal) \699| IO_STATE (R_SERIAL3_TR_CTRL, tr_par, even) \700| IO_STATE (R_SERIAL3_TR_CTRL, tr_par_en, disable) \701| IO_STATE (R_SERIAL3_TR_CTRL, tr_bitnr, tr_8bit),$r0702move.b $r0,[R_SERIAL3_TR_CTRL]703#endif704705#endif /* CONFIG_SVINTO_SIM */706707jump start_kernel ; jump into the C-function start_kernel in init/main.c708709.data710etrax_irv:711.dword 0712romfs_start:713.dword 0714romfs_length:715.dword 0716romfs_in_flash:717.dword 0718719;; put some special pages at the beginning of the kernel aligned720;; to page boundaries - the kernel cannot start until after this721722#ifdef CONFIG_CRIS_LOW_MAP723swapper_pg_dir = 0x60002000724#else725swapper_pg_dir = 0xc0002000726#endif727728.section ".init.data", "aw"729#include "../lib/hw_settings.S"730731732