15f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson/* 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Head of the kernel - alter with care 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 4e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson * Copyright (C) 2000, 2001, 2010 Axis Communications AB 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 7e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ASSEMBLER_MACROS_ONLY 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* The IO_* macros use the ## token concatenation operator, so 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds -traditional must not be used when assembling this file. */ 11556dcee7b829e5c350c3ffdbdb87a8b15aa3c5d3Jesper Nilsson#include <arch/sv_addr_ag.h> 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CRAMFS_MAGIC 0x28cd3d45 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RAM_INIT_MAGIC 0x56902387 1563245d2cde2be64f172388c2c50862f233c05700Mikael Starvik#define COMMAND_LINE_MAGIC 0x87109563 161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define START_ETHERNET_CLOCK IO_STATE(R_NETWORK_GEN_CONFIG, enable, on) |\ 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds IO_STATE(R_NETWORK_GEN_CONFIG, phy, mii_clk) 19e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; exported symbols 21e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .globl etrax_irv 231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .globl romfs_start 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .globl romfs_length 251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .globl romfs_in_flash 261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .globl swapper_pg_dir 27e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .text 291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; This is the entry point of the kernel. We are in supervisor mode. 311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; 0x00000000 if Flash, 0x40004000 if DRAM 321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; since etrax actually starts at address 2 when booting from flash, we 331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; put a nop (2 bytes) here first so we dont accidentally skip the di 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; NOTICE! The registers r8 and r9 are used as parameters carrying 36e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson ;; information from the decompressor (if the kernel was compressed). 371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; They should not be used in the code below until read. 38e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 39e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson nop 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds di 411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; First setup the kseg_c mapping from where the kernel is linked 431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; to 0x40000000 (where the actual DRAM resides) otherwise 441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; we cannot do very much! See arch/cris/README.mm 451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; 461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Notice that since we're potentially running at 0x00 or 0x40 right now, 471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; we will get a fault as soon as we enable the MMU if we dont 481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; temporarily map those segments linearily. 491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; 501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Due to a bug in Etrax-100 LX version 1 we need to map the memory 511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; slightly different. The bug is that you can't remap bit 31 of 521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; an address. Though we can check the version register for 531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; whether the bug is present, some constants would then have to 541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; be variables, so we don't. The drawback is that you can "only" map 551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; 1G per process with CONFIG_CRIS_LOW_MAP. 561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_CRIS_LOW_MAP 581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; kseg mappings, temporary map of 0xc0->0x40 59e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson move.d IO_FIELD (R_MMU_KBASE_HI, base_c, 4) \ 601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_FIELD (R_MMU_KBASE_HI, base_b, 0xb) \ 611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_FIELD (R_MMU_KBASE_HI, base_9, 9) \ 621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_FIELD (R_MMU_KBASE_HI, base_8, 8), $r0 631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [R_MMU_KBASE_HI] 641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 65e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson ; temporary map of 0x40->0x40 and 0x60->0x40 66e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson move.d IO_FIELD (R_MMU_KBASE_LO, base_6, 4) \ 671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_FIELD (R_MMU_KBASE_LO, base_4, 4), $r0 681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [R_MMU_KBASE_LO] 691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; mmu enable, segs e,c,b,a,6,5,4,0 segment mapped 71e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson move.d IO_STATE (R_MMU_CONFIG, mmu_enable, enable) \ 721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, inv_excp, enable) \ 731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, acc_excp, enable) \ 741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, we_excp, enable) \ 751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_f, page) \ 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_e, seg) \ 771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_d, page) \ 781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_c, seg) \ 791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_b, seg) \ 801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_a, seg) \ 811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_9, page) \ 821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_8, page) \ 831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_7, page) \ 841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_6, seg) \ 851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_5, seg) \ 861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_4, seg) \ 871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_3, page) \ 881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_2, page) \ 891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_1, page) \ 901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_0, seg), $r0 911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [R_MMU_CONFIG] 921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#else 931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; kseg mappings 94e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson move.d IO_FIELD (R_MMU_KBASE_HI, base_e, 8) \ 951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_FIELD (R_MMU_KBASE_HI, base_c, 4) \ 961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_FIELD (R_MMU_KBASE_HI, base_b, 0xb), $r0 971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [R_MMU_KBASE_HI] 981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 99e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson ; temporary map of 0x40->0x40 and 0x00->0x00 1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d IO_FIELD (R_MMU_KBASE_LO, base_4, 4), $r0 1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [R_MMU_KBASE_LO] 1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; mmu enable, segs f,e,c,b,4,0 segment mapped 104e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson move.d IO_STATE (R_MMU_CONFIG, mmu_enable, enable) \ 1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, inv_excp, enable) \ 1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, acc_excp, enable) \ 1071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, we_excp, enable) \ 1081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_f, seg) \ 1091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_e, seg) \ 1101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_d, page) \ 1111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_c, seg) \ 1121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_b, seg) \ 1131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_a, page) \ 1141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_9, page) \ 1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_8, page) \ 1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_7, page) \ 1171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_6, page) \ 1181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_5, page) \ 1191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_4, seg) \ 1201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_3, page) \ 1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_2, page) \ 1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_1, page) \ 1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_MMU_CONFIG, seg_0, seg), $r0 1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [R_MMU_CONFIG] 1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Now we need to sort out the segments and their locations in RAM or 1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Flash. The image in the Flash (or in DRAM) consists of 3 pieces: 1291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; 1) kernel text, 2) kernel data, 3) ROM filesystem image 1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; But the linker has linked the kernel to expect this layout in 1311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; DRAM memory: 1321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; 1) kernel text, 2) kernel data, 3) kernel BSS 1331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; (the location of the ROM filesystem is determined by the krom driver) 1341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; If we boot this from Flash, we want to keep the ROM filesystem in 1351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; the flash, we want to copy the text and need to copy the data to DRAM. 1361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; But if we boot from DRAM, we need to move the ROMFS image 1371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; from its position after kernel data, to after kernel BSS, BEFORE the 1381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; kernel starts using the BSS area (since its "overlayed" with the ROMFS) 1391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; 1401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; In both cases, we start in un-cached mode, and need to jump into a 1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; cached PC after we're done fiddling around with the segments. 142e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson ;; 1431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; arch/etrax100/etrax100.ld sets some symbols that define the start 1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; and end of each segment. 1451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Check if we start from DRAM or FLASH by testing PC 147e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 1481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $pc,$r0 1491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds and.d 0x7fffffff,$r0 ; get rid of the non-cache bit 1501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmp.d 0x10000,$r0 ; arbitrary... just something above this code 1511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds blo _inflash0 1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 1531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds jump _inram ; enter cached ram 1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Jumpgate for branches. 1571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds_inflash0: 1581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds jump _inflash 1591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Put this in a suitable section where we can reclaim storage 1611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; after init. 1621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .section ".init.text", "ax" 1631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds_inflash: 164e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson#ifdef CONFIG_ETRAX_ETHERNET 1651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Start MII clock to make sure it is running when tranceiver is reset 1661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d START_ETHERNET_CLOCK, $r0 1671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [R_NETWORK_GEN_CONFIG] 1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 1691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Set up waitstates etc according to kernel configuration. 1711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d CONFIG_ETRAX_DEF_R_WAITSTATES, $r0 1721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [R_WAITSTATES] 1731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d CONFIG_ETRAX_DEF_R_BUS_CONFIG, $r0 1751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [R_BUS_CONFIG] 1761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; We need to initialze DRAM registers before we start using the DRAM 1781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized? 1801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds beq _dram_init_finished 1811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 182e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 1831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include "../lib/dram_init.S" 1841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 185e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson_dram_init_finished: 1861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Copy text+data to DRAM 1871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; This is fragile - the calculation of r4 as the image size depends 1881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; on that the labels below actually are the first and last positions 1891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; in the linker-script. 1901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; 1911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Then the locating of the cramfs image depends on the aforementioned 1921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; image being located in the flash at 0. This is most often not true, 1931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; thus the following does not work (normally there is a rescue-block 1941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; between the physical start of the flash and the flash-image start, 1951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; and when run with compression, the kernel is actually unpacked to 1961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; DRAM and we never get here in the first place :)) 197e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 1981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq 0, $r0 ; source 1991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d text_start, $r1 ; destination 2001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d __vmlinux_end, $r2 ; end destination 2011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r2, $r4 2021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds sub.d $r1, $r4 ; r4=__vmlinux_end in flash, used below 2031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds1: move.w [$r0+], $r3 2041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.w $r3, [$r1+] 2051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmp.d $r2, $r1 2061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds blo 1b 2071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 2081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; We keep the cramfs in the flash. 2101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; There might be none, but that does not matter because 2111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; we don't do anything than read some bytes here. 2121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq 0, $r0 2141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [romfs_length] ; default if there is no cramfs 2151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d [$r4], $r0 ; cramfs_super.magic 2171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmp.d CRAMFS_MAGIC, $r0 2181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds bne 1f 2191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 2201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d [$r4 + 4], $r0 ; cramfs_super.size 2211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [romfs_length] 2221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_CRIS_LOW_MAP 2231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds add.d 0x50000000, $r4 ; add flash start in virtual memory (cached) 2241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#else 2251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds add.d 0xf0000000, $r4 ; add flash start in virtual memory (cached) 2261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 2271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r4, [romfs_start] 228e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson1: 2291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq 1, $r0 2301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [romfs_in_flash] 231e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 2321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds jump _start_it ; enter code, cached this time 2331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds_inram: 2351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Move the ROM fs to after BSS end. This assumes that the cramfs 2361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; second longword contains the length of the cramfs 2371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq 0, $r0 2391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [romfs_length] ; default if there is no cramfs 240e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 2411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; The kernel could have been unpacked to DRAM by the loader, but 2421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; the cramfs image could still be in the Flash directly after the 2431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; compressed kernel image. The loader passes the address of the 2441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; byte succeeding the last compressed byte in the flash in the 2451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; register r9 when starting the kernel. Check if r9 points to a 2461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; decent cramfs image! 2471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; (Notice that if this is not booted from the loader, r9 will be 2481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; garbage but we do sanity checks on it, the chance that it points 2491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; to a cramfs magic is small.. ) 250e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 2511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmp.d 0x0ffffff8, $r9 2521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds bhs _no_romfs_in_flash ; r9 points outside the flash area 2531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 2541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d [$r9], $r0 ; cramfs_super.magic 2551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmp.d CRAMFS_MAGIC, $r0 2561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds bne _no_romfs_in_flash 2571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 2581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d [$r9+4], $r0 ; cramfs_super.length 2591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [romfs_length] 2601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_CRIS_LOW_MAP 2611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds add.d 0x50000000, $r9 ; add flash start in virtual memory (cached) 2621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#else 2631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds add.d 0xf0000000, $r9 ; add flash start in virtual memory (cached) 2641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 2651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r9, [romfs_start] 2661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq 1, $r0 2681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [romfs_in_flash] 2691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds jump _start_it ; enter code, cached this time 2711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds_no_romfs_in_flash: 273e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 2741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Check if there is a cramfs (magic value). 2751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Notice that we check for cramfs magic value - which is 2761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; the "rom fs" we'll possibly use in 2.4 if not JFFS (which does 2771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; not need this mechanism anyway) 2781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 279b4973ae9dac3397499f5576c591d5c5bf51c68c6Jesper Nilsson move.d __init_end, $r0; the image will be after the end of init 2801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d [$r0], $r1 ; cramfs assumes same endian on host/target 2811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmp.d CRAMFS_MAGIC, $r1; magic value in cramfs superblock 2821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds bne 2f 2831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 2841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 285e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson ;; Ok. What is its size ? 286e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 2871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d [$r0 + 4], $r2 ; cramfs_super.size (again, no need to swapwb) 2881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; We want to copy it to the end of the BSS 2901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d _end, $r1 2921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Remember values so cramfs and setup can find this info 2941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r1, [romfs_start] ; new romfs location 2961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r2, [romfs_length] 2971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; We need to copy it backwards, since they can be overlapping 2991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds add.d $r2, $r0 3011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds add.d $r2, $r1 302e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 3031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Go ahead. Make my loop. 3041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds lsrq 1, $r2 ; size is in bytes, we copy words 3061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds1: move.w [$r0=$r0-2],$r3 3081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.w $r3,[$r1=$r1-2] 3091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds subq 1, $r2 3101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds bne 1b 3111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 3121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 313e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson2: 3141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Dont worry that the BSS is tainted. It will be cleared later. 3151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq 0, $r0 3171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [romfs_in_flash] 3181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds jump _start_it ; better skip the additional cramfs check below 320e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 3211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds_start_it: 3221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 32363245d2cde2be64f172388c2c50862f233c05700Mikael Starvik ;; Check if kernel command line is supplied 32463245d2cde2be64f172388c2c50862f233c05700Mikael Starvik cmp.d COMMAND_LINE_MAGIC, $r10 32563245d2cde2be64f172388c2c50862f233c05700Mikael Starvik bne no_command_line 32663245d2cde2be64f172388c2c50862f233c05700Mikael Starvik nop 32763245d2cde2be64f172388c2c50862f233c05700Mikael Starvik 32863245d2cde2be64f172388c2c50862f233c05700Mikael Starvik move.d 256, $r13 32963245d2cde2be64f172388c2c50862f233c05700Mikael Starvik move.d cris_command_line, $r10 33063245d2cde2be64f172388c2c50862f233c05700Mikael Starvik or.d 0x80000000, $r11 ; Make it virtual 33163245d2cde2be64f172388c2c50862f233c05700Mikael Starvik1: 33263245d2cde2be64f172388c2c50862f233c05700Mikael Starvik move.b [$r11+], $r12 33363245d2cde2be64f172388c2c50862f233c05700Mikael Starvik move.b $r12, [$r10+] 33463245d2cde2be64f172388c2c50862f233c05700Mikael Starvik subq 1, $r13 33563245d2cde2be64f172388c2c50862f233c05700Mikael Starvik bne 1b 33663245d2cde2be64f172388c2c50862f233c05700Mikael Starvik nop 33763245d2cde2be64f172388c2c50862f233c05700Mikael Starvik 33863245d2cde2be64f172388c2c50862f233c05700Mikael Starvikno_command_line: 33963245d2cde2be64f172388c2c50862f233c05700Mikael Starvik 3401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; the kernel stack is overlayed with the task structure for each 3411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; task. thus the initial kernel stack is in the same page as the 3421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; init_task (but starts in the top of the page, size 8192) 3431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d init_thread_union + 8192, $sp 3441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d ibr_start,$r0 ; this symbol is set by the linker script 3451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move $r0,$ibr 3461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0,[etrax_irv] ; set the interrupt base register and pointer 347e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 3481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Clear BSS region, from _bss_start to _end 3491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d __bss_start, $r0 3511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d _end, $r1 3521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds1: clear.d [$r0+] 3531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmp.d $r1, $r0 3541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds blo 1b 3551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 356e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 3571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_BLK_DEV_ETRAXIDE 3581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; disable ATA before enabling it in genconfig below 3591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq 0,$r0 3601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0,[R_ATA_CTRL_DATA] 3611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0,[R_ATA_TRANSFER_CNT] 3621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0,[R_ATA_CONFIG] 3631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if 0 3641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d R_PORT_G_DATA, $r1 3651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [$r1]; assert ATA bus-reset 3661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 3671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 3681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 3691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 3701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 3711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 3721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d 0x08000000,$r0 3731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0,[$r1] 3741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 3751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 3761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_JULIETTE 3781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; configure external DMA channel 0 before enabling it in genconfig 379e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 3801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq 0,$r0 3811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0,[R_EXT_DMA_0_ADDR] 3821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; cnt enable, word size, output, stop, size 0 3831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d IO_STATE (R_EXT_DMA_0_CMD, cnt, enable) \ 3841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_EXT_DMA_0_CMD, rqpol, ahigh) \ 3851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_EXT_DMA_0_CMD, apol, ahigh) \ 3861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_EXT_DMA_0_CMD, rq_ack, burst) \ 3871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_EXT_DMA_0_CMD, wid, word) \ 3881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_EXT_DMA_0_CMD, dir, output) \ 3891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_EXT_DMA_0_CMD, run, stop) \ 3901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_FIELD (R_EXT_DMA_0_CMD, trf_count, 0),$r0 3911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0,[R_EXT_DMA_0_CMD] 3921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; reset dma4 and wait for completion 394e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 3951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq IO_STATE (R_DMA_CH4_CMD, cmd, reset),$r0 3961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_DMA_CH4_CMD] 3971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds1: move.b [R_DMA_CH4_CMD],$r0 3981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds and.b IO_MASK (R_DMA_CH4_CMD, cmd),$r0 3991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmp.b IO_STATE (R_DMA_CH4_CMD, cmd, reset),$r0 4001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds beq 1b 4011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 4021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; reset dma5 and wait for completion 404e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 4051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq IO_STATE (R_DMA_CH5_CMD, cmd, reset),$r0 4061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_DMA_CH5_CMD] 4071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds1: move.b [R_DMA_CH5_CMD],$r0 4081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds and.b IO_MASK (R_DMA_CH5_CMD, cmd),$r0 4091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmp.b IO_STATE (R_DMA_CH5_CMD, cmd, reset),$r0 4101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds beq 1b 4111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 412e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson#endif 413e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 4141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; Etrax product HW genconfig setup 4151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq 0,$r0 41763245d2cde2be64f172388c2c50862f233c05700Mikael Starvik 4185f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson ;; Select or disable serial port 2 4195f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson#ifdef CONFIG_ETRAX_SERIAL_PORT2 4205f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson or.d IO_STATE (R_GEN_CONFIG, ser2, select),$r0 4215f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson#else 4225f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson or.d IO_STATE (R_GEN_CONFIG, ser2, disable),$r0 4235f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson#endif 4245f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson 42563245d2cde2be64f172388c2c50862f233c05700Mikael Starvik ;; Init interfaces (disable them). 42663245d2cde2be64f172388c2c50862f233c05700Mikael Starvik or.d IO_STATE (R_GEN_CONFIG, scsi0, disable) \ 42763245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, ata, disable) \ 42863245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, par0, disable) \ 42963245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, mio, disable) \ 43063245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, scsi1, disable) \ 43163245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, scsi0w, disable) \ 43263245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, par1, disable) \ 43363245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, ser3, disable) \ 43463245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, mio_w, disable) \ 43563245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, usb1, disable) \ 43663245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, usb2, disable) \ 43763245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, par_w, disable),$r0 43863245d2cde2be64f172388c2c50862f233c05700Mikael Starvik 43963245d2cde2be64f172388c2c50862f233c05700Mikael Starvik ;; Init DMA channel muxing (set to unused clients). 44063245d2cde2be64f172388c2c50862f233c05700Mikael Starvik or.d IO_STATE (R_GEN_CONFIG, dma2, ata) \ 44163245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, dma3, ata) \ 44263245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, dma4, scsi1) \ 44363245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, dma5, scsi1) \ 44463245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, dma6, unused) \ 44563245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, dma7, unused) \ 44663245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, dma8, usb) \ 44763245d2cde2be64f172388c2c50862f233c05700Mikael Starvik | IO_STATE (R_GEN_CONFIG, dma9, usb),$r0 44863245d2cde2be64f172388c2c50862f233c05700Mikael Starvik 4491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_ETRAX_DEF_R_PORT_G0_DIR_OUT) 4511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds or.d IO_STATE (R_GEN_CONFIG, g0dir, out),$r0 4521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 4531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_ETRAX_DEF_R_PORT_G8_15_DIR_OUT) 4551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds or.d IO_STATE (R_GEN_CONFIG, g8_15dir, out),$r0 4561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 4571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_ETRAX_DEF_R_PORT_G16_23_DIR_OUT) 4581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds or.d IO_STATE (R_GEN_CONFIG, g16_23dir, out),$r0 4591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 4601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_ETRAX_DEF_R_PORT_G24_DIR_OUT) 4621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds or.d IO_STATE (R_GEN_CONFIG, g24dir, out),$r0 4631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 4641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0,[genconfig_shadow] ; init a shadow register of R_GEN_CONFIG 4661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0,[R_GEN_CONFIG] 4681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if 0 4701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq 4,$r0 4711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_DMA_CH6_CMD] ; reset (ser0 dma out) 4721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_DMA_CH7_CMD] ; reset (ser0 dma in) 4731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds1: move.b [R_DMA_CH6_CMD],$r0 ; wait for reset cycle to finish 4741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds and.b 7,$r0 4751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmp.b 4,$r0 4761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds beq 1b 4771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 4781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds1: move.b [R_DMA_CH7_CMD],$r0 ; wait for reset cycle to finish 4791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds and.b 7,$r0 4801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmp.b 4,$r0 4811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds beq 1b 4821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 4831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 484e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 4851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq IO_STATE (R_DMA_CH8_CMD, cmd, reset),$r0 4861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_DMA_CH8_CMD] ; reset (ser1 dma out) 4871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_DMA_CH9_CMD] ; reset (ser1 dma in) 4881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds1: move.b [R_DMA_CH8_CMD],$r0 ; wait for reset cycle to finish 4891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds andq IO_MASK (R_DMA_CH8_CMD, cmd),$r0 4901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmpq IO_STATE (R_DMA_CH8_CMD, cmd, reset),$r0 4911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds beq 1b 4921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 4931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds1: move.b [R_DMA_CH9_CMD],$r0 ; wait for reset cycle to finish 4941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds andq IO_MASK (R_DMA_CH9_CMD, cmd),$r0 4951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cmpq IO_STATE (R_DMA_CH9_CMD, cmd, reset),$r0 4961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds beq 1b 4971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds nop 4981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; setup port PA and PB default initial directions and data 5001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; including their shadow registers 501e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 5021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR,$r0 5031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PA7) 5041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds or.b IO_STATE (R_PORT_PA_DIR, dir7, output),$r0 5051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 5061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[port_pa_dir_shadow] 5071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_PORT_PA_DIR] 5081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA,$r0 5091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PA7) 5101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) 5111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds and.b ~(1 << 7),$r0 5121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#else 5131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds or.b (1 << 7),$r0 5141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 5151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 5161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[port_pa_data_shadow] 5171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_PORT_PA_DATA] 518e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 5191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG,$r0 5201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[port_pb_config_shadow] 5211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_PORT_PB_CONFIG] 5221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR,$r0 5231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PB5) 5241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds or.b IO_STATE (R_PORT_PB_DIR, dir5, output),$r0 5251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 5261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[port_pb_dir_shadow] 5271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_PORT_PB_DIR] 5281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA,$r0 5291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PB5) 5301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) 5311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds and.b ~(1 << 5),$r0 5321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#else 5331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds or.b (1 << 5),$r0 5341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 5351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 5361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[port_pb_data_shadow] 5371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_PORT_PB_DATA] 5381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq 0, $r0 5401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0,[port_pb_i2c_shadow] 5411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0, [R_PORT_PB_I2C] 5421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq 0,$r0 5441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_G10) 5451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) 5461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds and.d ~(1 << 10),$r0 5471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#else 5481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds or.d (1 << 10),$r0 5491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 5501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 5511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_G11) 5521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) 5531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds and.d ~(1 << 11),$r0 5541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#else 5551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds or.d (1 << 11),$r0 5561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 5571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 5581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0,[port_g_data_shadow] 5591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.d $r0,[R_PORT_G_DATA] 560e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 5611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; setup the serial port 0 at 115200 baud for debug purposes 562e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 5631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq IO_STATE (R_SERIAL0_XOFF, tx_stop, enable) \ 5641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_XOFF, auto_xoff, disable) \ 5651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_FIELD (R_SERIAL0_XOFF, xoff_char, 0),$r0 566e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson move.d $r0,[R_SERIAL0_XOFF] 5671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; 115.2kbaud for both transmit and receive 5691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b IO_STATE (R_SERIAL0_BAUD, tr_baud, c115k2Hz) \ 5701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_BAUD, rec_baud, c115k2Hz),$r0 5711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_SERIAL0_BAUD] 5721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; Set up and enable the serial0 receiver. 5741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b IO_STATE (R_SERIAL0_REC_CTRL, dma_err, stop) \ 5751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_REC_CTRL, rec_enable, enable) \ 5761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_REC_CTRL, rts_, active) \ 5771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_REC_CTRL, sampling, middle) \ 5781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_REC_CTRL, rec_stick_par, normal) \ 5791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_REC_CTRL, rec_par, even) \ 5801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_REC_CTRL, rec_par_en, disable) \ 5811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_REC_CTRL, rec_bitnr, rec_8bit),$r0 582e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson move.b $r0,[R_SERIAL0_REC_CTRL] 583e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 5841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; Set up and enable the serial0 transmitter. 5851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b IO_FIELD (R_SERIAL0_TR_CTRL, txd, 0) \ 5861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_TR_CTRL, tr_enable, enable) \ 5871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_TR_CTRL, auto_cts, disabled) \ 5881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_TR_CTRL, stop_bits, one_bit) \ 5891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_TR_CTRL, tr_stick_par, normal) \ 5901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_TR_CTRL, tr_par, even) \ 5911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_TR_CTRL, tr_par_en, disable) \ 5921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL0_TR_CTRL, tr_bitnr, tr_8bit),$r0 5931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_SERIAL0_TR_CTRL] 5941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; setup the serial port 1 at 115200 baud for debug purposes 596e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 5971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq IO_STATE (R_SERIAL1_XOFF, tx_stop, enable) \ 5981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_XOFF, auto_xoff, disable) \ 5991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_FIELD (R_SERIAL1_XOFF, xoff_char, 0),$r0 600e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson move.d $r0,[R_SERIAL1_XOFF] 6011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 6021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; 115.2kbaud for both transmit and receive 6031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b IO_STATE (R_SERIAL1_BAUD, tr_baud, c115k2Hz) \ 6041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_BAUD, rec_baud, c115k2Hz),$r0 6051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_SERIAL1_BAUD] 6061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 6071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; Set up and enable the serial1 receiver. 6081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b IO_STATE (R_SERIAL1_REC_CTRL, dma_err, stop) \ 6091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_REC_CTRL, rec_enable, enable) \ 6101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_REC_CTRL, rts_, active) \ 6111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_REC_CTRL, sampling, middle) \ 6121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_REC_CTRL, rec_stick_par, normal) \ 6131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_REC_CTRL, rec_par, even) \ 6141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_REC_CTRL, rec_par_en, disable) \ 6151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_REC_CTRL, rec_bitnr, rec_8bit),$r0 616e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson move.b $r0,[R_SERIAL1_REC_CTRL] 617e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 6181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; Set up and enable the serial1 transmitter. 6191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b IO_FIELD (R_SERIAL1_TR_CTRL, txd, 0) \ 6201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_TR_CTRL, tr_enable, enable) \ 6211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_TR_CTRL, auto_cts, disabled) \ 6221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_TR_CTRL, stop_bits, one_bit) \ 6231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_TR_CTRL, tr_stick_par, normal) \ 6241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_TR_CTRL, tr_par, even) \ 6251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_TR_CTRL, tr_par_en, disable) \ 6261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL1_TR_CTRL, tr_bitnr, tr_8bit),$r0 6271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_SERIAL1_TR_CTRL] 6281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 6295f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson#ifdef CONFIG_ETRAX_SERIAL_PORT2 6305f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson ;; setup the serial port 2 at 115200 baud for debug purposes 6315f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson 6325f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson moveq IO_STATE (R_SERIAL2_XOFF, tx_stop, enable) \ 6335f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_XOFF, auto_xoff, disable) \ 6345f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_FIELD (R_SERIAL2_XOFF, xoff_char, 0),$r0 6355f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson move.d $r0,[R_SERIAL2_XOFF] 6365f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson 6375f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson ; 115.2kbaud for both transmit and receive 6385f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson move.b IO_STATE (R_SERIAL2_BAUD, tr_baud, c115k2Hz) \ 6395f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_BAUD, rec_baud, c115k2Hz),$r0 6405f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson move.b $r0,[R_SERIAL2_BAUD] 6415f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson 6425f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson ; Set up and enable the serial2 receiver. 6435f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson move.b IO_STATE (R_SERIAL2_REC_CTRL, dma_err, stop) \ 6445f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_REC_CTRL, rec_enable, enable) \ 6455f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_REC_CTRL, rts_, active) \ 6465f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_REC_CTRL, sampling, middle) \ 6475f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_REC_CTRL, rec_stick_par, normal) \ 6485f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_REC_CTRL, rec_par, even) \ 6495f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_REC_CTRL, rec_par_en, disable) \ 6505f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_REC_CTRL, rec_bitnr, rec_8bit),$r0 6515f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson move.b $r0,[R_SERIAL2_REC_CTRL] 6525f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson 6535f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson ; Set up and enable the serial2 transmitter. 6545f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson move.b IO_FIELD (R_SERIAL2_TR_CTRL, txd, 0) \ 6555f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_TR_CTRL, tr_enable, enable) \ 6565f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_TR_CTRL, auto_cts, disabled) \ 6575f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_TR_CTRL, stop_bits, one_bit) \ 6585f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_TR_CTRL, tr_stick_par, normal) \ 6595f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_TR_CTRL, tr_par, even) \ 6605f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_TR_CTRL, tr_par_en, disable) \ 6615f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson | IO_STATE (R_SERIAL2_TR_CTRL, tr_bitnr, tr_8bit),$r0 6625f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson move.b $r0,[R_SERIAL2_TR_CTRL] 6635f526d1467383fbd7d64b4f7de85b2889838e454Jesper Nilsson#endif 664e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 665e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson#ifdef CONFIG_ETRAX_SERIAL_PORT3 6661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; setup the serial port 3 at 115200 baud for debug purposes 667e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 6681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds moveq IO_STATE (R_SERIAL3_XOFF, tx_stop, enable) \ 6691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_XOFF, auto_xoff, disable) \ 6701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_FIELD (R_SERIAL3_XOFF, xoff_char, 0),$r0 671e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson move.d $r0,[R_SERIAL3_XOFF] 6721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 6731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; 115.2kbaud for both transmit and receive 6741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b IO_STATE (R_SERIAL3_BAUD, tr_baud, c115k2Hz) \ 6751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_BAUD, rec_baud, c115k2Hz),$r0 6761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_SERIAL3_BAUD] 6771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 6781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; Set up and enable the serial3 receiver. 6791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b IO_STATE (R_SERIAL3_REC_CTRL, dma_err, stop) \ 6801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_REC_CTRL, rec_enable, enable) \ 6811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_REC_CTRL, rts_, active) \ 6821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_REC_CTRL, sampling, middle) \ 6831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_REC_CTRL, rec_stick_par, normal) \ 6841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_REC_CTRL, rec_par, even) \ 6851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_REC_CTRL, rec_par_en, disable) \ 6861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_REC_CTRL, rec_bitnr, rec_8bit),$r0 687e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson move.b $r0,[R_SERIAL3_REC_CTRL] 688e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 6891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ; Set up and enable the serial3 transmitter. 6901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b IO_FIELD (R_SERIAL3_TR_CTRL, txd, 0) \ 6911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_TR_CTRL, tr_enable, enable) \ 6921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_TR_CTRL, auto_cts, disabled) \ 6931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_TR_CTRL, stop_bits, one_bit) \ 6941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_TR_CTRL, tr_stick_par, normal) \ 6951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_TR_CTRL, tr_par, even) \ 6961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_TR_CTRL, tr_par_en, disable) \ 6971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds | IO_STATE (R_SERIAL3_TR_CTRL, tr_bitnr, tr_8bit),$r0 6981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds move.b $r0,[R_SERIAL3_TR_CTRL] 6991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 700e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 7011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds jump start_kernel ; jump into the C-function start_kernel in init/main.c 702e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 7031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .data 704e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilssonetrax_irv: 7051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .dword 0 7061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsromfs_start: 7071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .dword 0 7081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsromfs_length: 7091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .dword 0 7101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsromfs_in_flash: 7111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .dword 0 712e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson 7131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; put some special pages at the beginning of the kernel aligned 7141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ;; to page boundaries - the kernel cannot start until after this 7151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 7161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_CRIS_LOW_MAP 7171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsswapper_pg_dir = 0x60002000 718e7672be573afa078e8d85d5ad0202b78bd6bd1fdJesper Nilsson#else 7191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsswapper_pg_dir = 0xc0002000 7201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 7211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 7221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .section ".init.data", "aw" 7231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include "../lib/hw_settings.S" 724