Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 1 | /* |
| 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 Glass | 5f3a899 | 2011-11-05 03:56:49 +0000 | [diff] [blame] | 26 | #include "ap20.h" |
Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 27 | #include <asm/arch/sys_proto.h> |
| 28 | #include <asm/arch/tegra2.h> |
| 29 | #include <asm/arch/pmc.h> |
| 30 | |
| 31 | DECLARE_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 | |
| 38 | unsigned 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 Vasut | 8148e11 | 2011-10-24 23:41:39 +0000 | [diff] [blame] | 44 | debug("pmc->pmc_scratch20 (ODMData) = 0x%08x\n", reg); |
Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 45 | |
| 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 Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 58 | int dram_init(void) |
| 59 | { |
Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 60 | /* We do not initialise DRAM here. We just query the size */ |
Simon Glass | f6fcbbd | 2011-11-05 03:56:57 +0000 | [diff] [blame^] | 61 | gd->ram_size = query_sdram_size(); |
Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | #ifdef CONFIG_DISPLAY_BOARDINFO |
| 66 | int checkboard(void) |
| 67 | { |
| 68 | printf("Board: %s\n", sysinfo.board_string); |
| 69 | return 0; |
| 70 | } |
| 71 | #endif /* CONFIG_DISPLAY_BOARDINFO */ |
Simon Glass | 5f3a899 | 2011-11-05 03:56:49 +0000 | [diff] [blame] | 72 | |
| 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 | */ |
| 79 | int arch_cpu_init(void) |
| 80 | { |
| 81 | /* Fire up the Cortex A9 */ |
| 82 | tegra2_start(); |
| 83 | return 0; |
| 84 | } |
| 85 | #endif |