blob: 748b6dc3ba1cad751339b07146f6538c3da045f1 [file] [log] [blame]
Tom Warren64982c502014-01-23 13:37:50 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2014 Google Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include <console/console.h>
21#include <soc/nvidia/tegra124/sdram.h>
22#include "sdram_configs.h"
23
Tom Warren64982c502014-01-23 13:37:50 -070024static struct sdram_params sdram_configs[] = {
Tom Warren96ef1882014-06-10 13:46:48 -070025#include "bct/sdram-unused.inc" /* ram_code = 0000 */
26#include "bct/sdram-hynix-2GB-792.inc" /* ram_code = 0001 */
27#include "bct/sdram-unused.inc" /* ram_code = 0010 */
28#include "bct/sdram-unused.inc" /* ram_code = 0011 */
29#include "bct/sdram-hynix-4GB-792.inc" /* ram_code = 0100 */
30#include "bct/sdram-unused.inc" /* ram_code = 0101 */
31#include "bct/sdram-kingston-2GB-792.inc" /* ram_code = 0110 */
32#include "bct/sdram-unused.inc" /* ram_code = 0111 */
33#include "bct/sdram-unused.inc" /* ram_code = 1000 */
34#include "bct/sdram-unused.inc" /* ram_code = 1001 */
35#include "bct/sdram-unused.inc" /* ram_code = 1010 */
36#include "bct/sdram-unused.inc" /* ram_code = 1011 */
37#include "bct/sdram-unused.inc" /* ram_code = 1100 */
38#include "bct/sdram-unused.inc" /* ram_code = 1101 */
39#include "bct/sdram-unused.inc" /* ram_code = 1110 */
40#include "bct/sdram-unused.inc" /* ram_code = 1111 */
Tom Warren64982c502014-01-23 13:37:50 -070041};
42
43const struct sdram_params *get_sdram_config()
44{
45 uint32_t ramcode = sdram_get_ram_code();
46 /*
47 * If we need to apply some special hacks to RAMCODE mapping (ex, by
48 * board_id), do that now.
49 */
50
51 printk(BIOS_SPEW, "%s: RAMCODE=%d\n", __func__, ramcode);
52 if (ramcode >= sizeof(sdram_configs) / sizeof(sdram_configs[0]) ||
53 sdram_configs[ramcode].MemoryType == NvBootMemoryType_Unused) {
54 die("Invalid RAMCODE.");
55 }
56
57 return &sdram_configs[ramcode];
58}