1 /* SPDX-License-Identifier: GPL-2.0 */
3 * DDR SDRAM initialization - alter with care
4 * This file is intended to be included from other assembler files
6 * Note: This file may not modify r8 or r9 because they are used to
7 * carry information from the decompressor to the kernel
9 * Copyright (C) 2005-2007 Axis Communications AB
11 * Authors: Mikael Starvik <starvik@axis.com>
14 /* Just to be certain the config file is included, we include it here
15 * explicitly instead of depending on it being included in the file that
19 #include <hwregs/asm/reg_map_asm.h>
20 #include <hwregs/asm/ddr2_defs_asm.h>
22 ;; WARNING! The registers r8 and r9 are used as parameters carrying
23 ;; information from the decompressor (if the kernel was compressed).
24 ;; They should not be used in the code below.
26 ;; Refer to ddr2 MDS for initialization sequence
34 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_phy_cfg), $r0
35 move.d REG_STATE(ddr2, rw_phy_cfg, en, yes), $r1
43 ; Reset phy and start calibration
44 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_phy_ctrl), $r0
45 move.d REG_STATE(ddr2, rw_phy_ctrl, rst, yes) | \
46 REG_STATE(ddr2, rw_phy_ctrl, cal_rst, yes), $r1
48 move.d REG_STATE(ddr2, rw_phy_ctrl, cal_start, yes), $r1
57 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_ctrl), $r0
58 move.d sdram_commands_start, $r2
70 cmp.d sdram_commands_end, $r2
75 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_timing), $r0
76 move.d CONFIG_ETRAX_DDR2_TIMING, $r1
80 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_latency), $r0
81 move.d CONFIG_ETRAX_DDR2_LATENCY, $r1
85 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_cfg), $r0
86 move.d CONFIG_ETRAX_DDR2_CONFIG, $r1
89 ba after_sdram_commands
93 .byte regk_ddr2_deselect
96 .word regk_ddr2_pre_all
102 .word regk_ddr2_dll_en
104 .word regk_ddr2_dll_rst
106 .word regk_ddr2_pre_all
112 .word CONFIG_ETRAX_DDR2_MRS & 0xffff
114 .word regk_ddr2_ocd_default | regk_ddr2_dll_en
116 .word regk_ddr2_ocd_exit | regk_ddr2_dll_en | (CONFIG_ETRAX_DDR2_MRS >> 16)
119 after_sdram_commands: