blob: 023eb3772cf22a3db4276b8f1237f2fd4beda2e9 [file] [log] [blame]
ZhengShunQiane4d438e2015-10-22 10:33:13 +08001/*
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.
18 */
19#include <arch/io.h>
20#include <boardid.h>
21#include <console/console.h>
22#include <gpio.h>
23#include <soc/sdram.h>
24#include <string.h>
25#include <types.h>
26
27static struct rk3288_sdram_params sdram_configs[] = {
28#include "sdram_inf/sdram-lpddr3-samsung-2GB.inc" /* ram_code = 0000 */
29#include "sdram_inf/sdram-lpddr3-hynix-2GB.inc" /* ram_code = 0001 */
30#include "sdram_inf/sdram-unused.inc" /* ram_code = 0010 */
31#include "sdram_inf/sdram-unused.inc" /* ram_code = 0011 */
32#include "sdram_inf/sdram-ddr3-samsung-2GB.inc" /* ram_code = 0100 */
33#include "sdram_inf/sdram-ddr3-hynix-2GB.inc" /* ram_code = 0101 */
34#include "sdram_inf/sdram-ddr3-samsung-2GB.inc" /* ram_code = 0110 */
35#include "sdram_inf/sdram-lpddr3-elpida-2GB.inc" /* ram_code = 0111 */
36#include "sdram_inf/sdram-lpddr3-samsung-4GB.inc" /* ram_code = 1000 */
37#include "sdram_inf/sdram-lpddr3-hynix-4GB.inc" /* ram_code = 1001 */
38#include "sdram_inf/sdram-ddr3-nanya-2GB.inc" /* ram_code = 1010 */
39#include "sdram_inf/sdram-lpddr3-elpida-4GB.inc" /* ram_code = 1011 */
40#include "sdram_inf/sdram-unused.inc" /* ram_code = 1100 */
41#include "sdram_inf/sdram-ddr3-hynix-2GB.inc" /* ram_code = 1101 */
42#include "sdram_inf/sdram-ddr3-samsung-4GB.inc" /* ram_code = 1110 */
43#include "sdram_inf/sdram-ddr3-hynix-4GB.inc" /* ram_code = 1111 */
44};
45
46const struct rk3288_sdram_params *get_sdram_config()
47{
48 u32 ramcode = ram_code();
49
50 if (ramcode >= ARRAY_SIZE(sdram_configs)
51 || sdram_configs[ramcode].dramtype == UNUSED)
52 die("Invalid RAMCODE.");
53 return &sdram_configs[ramcode];
54}