2 * Memory sub-system initialization code for INCA-IP development board.
4 * Copyright (c) 2003 Wolfgang Denk <wd@denx.de>
6 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/regdef.h>
13 #define EBU_MODUL_BASE 0xB8000200
14 #define EBU_CLC(value) 0x0000(value)
15 #define EBU_CON(value) 0x0010(value)
16 #define EBU_ADDSEL0(value) 0x0020(value)
17 #define EBU_ADDSEL1(value) 0x0024(value)
18 #define EBU_ADDSEL2(value) 0x0028(value)
19 #define EBU_BUSCON0(value) 0x0060(value)
20 #define EBU_BUSCON1(value) 0x0064(value)
21 #define EBU_BUSCON2(value) 0x0068(value)
23 #define MC_MODUL_BASE 0xBF800000
24 #define MC_ERRCAUSE(value) 0x0100(value)
25 #define MC_ERRADDR(value) 0x0108(value)
26 #define MC_IOGP(value) 0x0800(value)
27 #define MC_SELFRFSH(value) 0x0A00(value)
28 #define MC_CTRLENA(value) 0x1000(value)
29 #define MC_MRSCODE(value) 0x1008(value)
30 #define MC_CFGDW(value) 0x1010(value)
31 #define MC_CFGPB0(value) 0x1018(value)
32 #define MC_LATENCY(value) 0x1038(value)
33 #define MC_TREFRESH(value) 0x1040(value)
35 #define CGU_MODUL_BASE 0xBF107000
36 #define CGU_PLL1CR(value) 0x0008(value)
37 #define CGU_DIVCR(value) 0x0010(value)
38 #define CGU_MUXCR(value) 0x0014(value)
39 #define CGU_PLL1SR(value) 0x000C(value)
47 * a0 has the clock value we are going to run at
56 sw t2, EBU_ADDSEL0(t1)
58 sw t2, EBU_ADDSEL2(t1)
60 sw t2, EBU_ADDSEL1(t1)
77 sw t2, EBU_BUSCON0(t1)
78 sw t2, EBU_BUSCON2(t1)
81 sw t2, EBU_BUSCON1(t1) /* delay slot */
86 sw t2, EBU_BUSCON0(t1)
87 sw t2, EBU_BUSCON2(t1)
89 sw t2, EBU_BUSCON1(t1)
100 * a0 has the clock value
107 li t1, CGU_MODUL_BASE
129 sw t2, CGU_PLL1CR(t1) /* delay slot */
139 sw t2, CGU_PLL1CR(t1) /* delay slot */
146 sw t2, CGU_PLL1CR(t1)
149 lw t2, CGU_PLL1SR(t1)
163 * void sdram_init(long)
165 * a0 has the clock value
175 /* Disable memory controller before changing any of its registers */
176 sw zero, MC_CTRLENA(t1)
193 /* Set clock ratio (clkrat=1:1, rddel=3) */
197 /* Set sdram refresh rate (4K/64ms @ 100MHz) */
200 sw t2, MC_TREFRESH(t1)
204 /* Set clock ratio (clkrat=1:1, rddel=3) */
208 /* Set sdram refresh rate (4K/64ms @ 133MHz) */
211 sw t2, MC_TREFRESH(t1)
215 /* Set clock ratio (clkrat=3:2, rddel=4) */
219 /* Set sdram refresh rate (4K/64ms @ 150MHz) */
221 sw t2, MC_TREFRESH(t1)
224 /* Clear Error log registers */
225 sw zero, MC_ERRCAUSE(t1)
226 sw zero, MC_ERRADDR(t1)
228 /* Clear Power-down registers */
229 sw zero, MC_SELFRFSH(t1)
231 /* Set CAS Latency */
232 li t2, 0x00000020 /* CL = 2 */
233 sw t2, MC_MRSCODE(t1)
235 /* Set word width to 16 bit */
239 /* Set CS0 to SDRAM parameters */
243 /* Set SDRAM latency parameters */
244 li t2, 0x00026325 /* BC PC100 */
245 sw t2, MC_LATENCY(t1)
248 /* Finally enable the controller */
250 sw t2, MC_CTRLENA(t1)
264 la t9, disable_incaip_wdt
268 /* EBU, CGU and SDRAM Initialization.
270 li a0, CONFIG_CPU_CLOCK_RATE
273 /* We rely on the fact that neither ebu_init() nor cgu_init() nor sdram_init()