2 * (C) Copyright 2010,2011
3 * NVIDIA Corporation <www.nvidia.com>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <asm/arch/sys_proto.h>
27 #include <asm/arch/tegra2.h>
28 #include <asm/arch/pmc.h>
30 DECLARE_GLOBAL_DATA_PTR;
33 * Boot ROM initializes the odmdata in APBDEV_PMC_SCRATCH20_0,
34 * so we are using this value to identify memory size.
37 unsigned int query_sdram_size(void)
39 struct pmc_ctlr *const pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
42 reg = readl(&pmc->pmc_scratch20);
43 debug("pmc->pmc_scratch20 (ODMData) = 0x%08lX\n", reg);
45 /* bits 31:28 in OdmData are used for RAM size */
46 switch ((reg) >> 28) {
48 return 0x10000000; /* 256 MB */
50 return 0x20000000; /* 512 MB */
53 return 0x40000000; /* 1GB */
59 #ifndef CONFIG_ICACHE_OFF
69 /* We do not initialise DRAM here. We just query the size */
70 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
71 gd->bd->bi_dram[0].size = gd->ram_size = query_sdram_size();
73 /* Now check it dynamically */
74 rs = get_ram_size(CONFIG_SYS_SDRAM_BASE, gd->ram_size);
76 printf("dynamic ram_size = %lu\n", rs);
77 gd->bd->bi_dram[0].size = gd->ram_size = rs;
82 #ifdef CONFIG_DISPLAY_BOARDINFO
85 printf("Board: %s\n", sysinfo.board_string);
88 #endif /* CONFIG_DISPLAY_BOARDINFO */