blob: 59dce8f8de91dc4dc4f6409d2edd7828e7f90247 [file] [log] [blame]
Tom Warren41b68382011-01-27 10:58:05 +00001/*
2 * (C) Copyright 2010,2011
3 * NVIDIA Corporation <www.nvidia.com>
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
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.
12 *
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.
17 *
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,
21 * MA 02111-1307 USA
22 */
23
24#include <common.h>
25#include <asm/io.h>
Simon Glass5f3a8992011-11-05 03:56:49 +000026#include "ap20.h"
Tom Warren41b68382011-01-27 10:58:05 +000027#include <asm/arch/sys_proto.h>
28#include <asm/arch/tegra2.h>
29#include <asm/arch/pmc.h>
30
31DECLARE_GLOBAL_DATA_PTR;
32
33/*
34 * Boot ROM initializes the odmdata in APBDEV_PMC_SCRATCH20_0,
35 * so we are using this value to identify memory size.
36 */
37
38unsigned int query_sdram_size(void)
39{
40 struct pmc_ctlr *const pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
41 u32 reg;
42
43 reg = readl(&pmc->pmc_scratch20);
Marek Vasut8148e112011-10-24 23:41:39 +000044 debug("pmc->pmc_scratch20 (ODMData) = 0x%08x\n", reg);
Tom Warren41b68382011-01-27 10:58:05 +000045
46 /* bits 31:28 in OdmData are used for RAM size */
47 switch ((reg) >> 28) {
48 case 1:
49 return 0x10000000; /* 256 MB */
50 case 2:
51 return 0x20000000; /* 512 MB */
52 case 3:
53 default:
54 return 0x40000000; /* 1GB */
55 }
56}
57
Tom Warren41b68382011-01-27 10:58:05 +000058int dram_init(void)
59{
Tom Warren41b68382011-01-27 10:58:05 +000060 /* We do not initialise DRAM here. We just query the size */
Simon Glassf6fcbbd2011-11-05 03:56:57 +000061 gd->ram_size = query_sdram_size();
Tom Warren41b68382011-01-27 10:58:05 +000062 return 0;
63}
64
65#ifdef CONFIG_DISPLAY_BOARDINFO
66int checkboard(void)
67{
68 printf("Board: %s\n", sysinfo.board_string);
69 return 0;
70}
71#endif /* CONFIG_DISPLAY_BOARDINFO */
Simon Glass5f3a8992011-11-05 03:56:49 +000072
73#ifdef CONFIG_ARCH_CPU_INIT
74/*
75 * Note this function is executed by the ARM7TDMI AVP. It does not return
76 * in this case. It is also called once the A9 starts up, but does nothing in
77 * that case.
78 */
79int arch_cpu_init(void)
80{
81 /* Fire up the Cortex A9 */
82 tegra2_start();
83 return 0;
84}
85#endif