2 * vme8349.c -- esd VME8349 board support
4 * Copyright (c) 2008-2009 esd gmbh.
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 * Reinhard Arlt <reinhard.arlt@esd-electronics.com>
10 * Based on board/mpc8349emds/mpc8349emds.c (and previous 834x releases.)
12 * See file CREDITS for list of people who contributed to this
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
35 #include <asm/mpc8349_pci.h>
36 #if defined(CONFIG_OF_LIBFDT)
42 void ddr_enable_ecc(unsigned int dram_size);
46 volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
51 msize = CONFIG_SYS_DDR_SIZE;
52 for (ddr_size = msize << 20, ddr_size_log2 = 0;
54 ddr_size = ddr_size>>1, ddr_size_log2++) {
59 im->sysconf.ddrlaw[0].bar = CONFIG_SYS_DDR_SDRAM_BASE & 0xfffff000;
60 im->sysconf.ddrlaw[0].ar = LAWAR_EN | ((ddr_size_log2 - 1) &
63 #if (CONFIG_SYS_DDR_SIZE == 512)
64 im->ddr.csbnds[0].csbnds = 0x0000001f;
66 #warning Currently any DDR size other than 512MiB is not supported
68 im->ddr.cs_config[0] = CONFIG_SYS_DDR_CONFIG | 0x00330000;
70 /* currently we use only one CS, so disable the other banks */
71 im->ddr.csbnds[1].csbnds = 0x00000000;
72 im->ddr.csbnds[2].csbnds = 0x00000000;
73 im->ddr.csbnds[3].csbnds = 0x00000000;
74 im->ddr.cs_config[1] = 0;
75 im->ddr.cs_config[2] = 0;
76 im->ddr.cs_config[3] = 0;
78 im->ddr.timing_cfg_0 = CONFIG_SYS_DDR_TIMING_0;
79 im->ddr.timing_cfg_1 = CONFIG_SYS_DDR_TIMING_1;
80 im->ddr.timing_cfg_2 = CONFIG_SYS_DDR_TIMING_2;
81 im->ddr.timing_cfg_3 = CONFIG_SYS_DDR_TIMING_3;
83 im->ddr.sdram_cfg = CONFIG_SYS_DDR_SDRAM_CFG;
84 im->ddr.sdram_cfg2 = CONFIG_SYS_DDR_SDRAM_CFG2;
85 im->ddr.sdram_mode = CONFIG_SYS_DDR_MODE;
86 im->ddr.sdram_mode2 = CONFIG_SYS_DDR_MODE2;
88 im->ddr.sdram_interval = CONFIG_SYS_DDR_INTERVAL;
92 /* enable DDR controller */
93 im->ddr.sdram_cfg |= SDRAM_CFG_MEM_EN;
98 phys_size_t initdram(int board_type)
100 volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
103 if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32)im)
106 /* DDR SDRAM - Main SODIMM */
107 im->sysconf.ddrlaw[0].bar = CONFIG_SYS_DDR_BASE & LAWBAR_BAR;
109 msize = fixed_sdram();
111 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
113 * Initialize and enable DDR ECC.
115 ddr_enable_ecc(msize * 1024 * 1024);
118 /* Now check memory size (after ECC is initialized) */
119 msize = get_ram_size(0, msize);
121 /* return total bus SDRAM size(bytes) -- DDR */
122 return msize * 1024 * 1024;
127 puts("Board: esd VME8349\n");
132 #if defined(CONFIG_OF_BOARD_SETUP)
133 void ft_board_setup(void *blob, bd_t *bd)
135 ft_cpu_setup(blob, bd);
137 ft_pci_setup(blob, bd);