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,
27 #include <asm/arch/sys_proto.h>
28 #include <asm/arch/tegra2.h>
29 #include <asm/arch/pmc.h>
31 DECLARE_GLOBAL_DATA_PTR;
34 * Boot ROM initializes the odmdata in APBDEV_PMC_SCRATCH20_0,
35 * so we are using this value to identify memory size.
38 unsigned int query_sdram_size(void)
40 struct pmc_ctlr *const pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
43 reg = readl(&pmc->pmc_scratch20);
44 debug("pmc->pmc_scratch20 (ODMData) = 0x%08x\n", reg);
46 /* bits 31:28 in OdmData are used for RAM size */
47 switch ((reg) >> 28) {
49 return 0x10000000; /* 256 MB */
51 return 0x20000000; /* 512 MB */
54 return 0x40000000; /* 1GB */
60 #ifndef CONFIG_ICACHE_OFF
70 /* We do not initialise DRAM here. We just query the size */
71 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
72 gd->bd->bi_dram[0].size = gd->ram_size = query_sdram_size();
74 /* Now check it dynamically */
75 rs = get_ram_size(CONFIG_SYS_SDRAM_BASE, gd->ram_size);
77 printf("dynamic ram_size = %lu\n", rs);
78 gd->bd->bi_dram[0].size = gd->ram_size = rs;
83 #ifdef CONFIG_DISPLAY_BOARDINFO
86 printf("Board: %s\n", sysinfo.board_string);
89 #endif /* CONFIG_DISPLAY_BOARDINFO */
91 #ifdef CONFIG_ARCH_CPU_INIT
93 * Note this function is executed by the ARM7TDMI AVP. It does not return
94 * in this case. It is also called once the A9 starts up, but does nothing in
97 int arch_cpu_init(void)
99 /* Fire up the Cortex A9 */