2 * DDR SDRAM initialization - alter with care
3 * This file is intended to be included from other assembler files
5 * Note: This file may not modify r8 or r9 because they are used to
6 * carry information from the decompresser to the kernel
8 * Copyright (C) 2005-2007 Axis Communications AB
10 * Authors: Mikael Starvik <starvik@axis.com>
13 /* Just to be certain the config file is included, we include it here
14 * explicitely instead of depending on it being included in the file that
18 #include <hwregs/asm/reg_map_asm.h>
19 #include <hwregs/asm/ddr2_defs_asm.h>
21 ;; WARNING! The registers r8 and r9 are used as parameters carrying
22 ;; information from the decompressor (if the kernel was compressed).
23 ;; They should not be used in the code below.
25 ;; Refer to ddr2 MDS for initialization sequence
28 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_phy_cfg), $r0
29 move.d REG_STATE(ddr2, rw_phy_cfg, en, yes), $r1
32 ; Reset phy and start calibration
33 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_phy_ctrl), $r0
34 move.d REG_STATE(ddr2, rw_phy_ctrl, rst, yes) | \
35 REG_STATE(ddr2, rw_phy_ctrl, cal_rst, yes), $r1
37 move.d REG_STATE(ddr2, rw_phy_ctrl, cal_start, yes), $r1
46 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_ctrl), $r0
47 move.d sdram_commands_start, $r2
55 cmp.d sdram_commands_end, $r2
60 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_timing), $r0
61 move.d CONFIG_ETRAX_DDR2_TIMING, $r1
65 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_latency), $r0
70 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_cfg), $r0
71 move.d CONFIG_ETRAX_DDR2_CONFIG, $r1
74 ba after_sdram_commands
78 .byte regk_ddr2_deselect
81 .word regk_ddr2_pre_all
87 .word regk_ddr2_dll_en
89 .word regk_ddr2_dll_rst
91 .word regk_ddr2_pre_all
97 .word CONFIG_ETRAX_DDR2_MRS & 0xffff
99 .word regk_ddr2_ocd_default | regk_ddr2_dll_en
101 .word regk_ddr2_ocd_exit | regk_ddr2_dll_en | (CONFIG_ETRAX_DDR2_MRS >> 16)
104 after_sdram_commands: