blob: 66e839ed707d5704014425634b6123c2852da73a [file] [log] [blame]
Katie Roberts-Hoffmanb262c722014-10-23 19:14:30 -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.
Katie Roberts-Hoffmanb262c722014-10-23 19:14:30 -070014 */
15#include <arch/io.h>
David Hendricks539e8562014-11-06 16:51:02 -080016#include <boardid.h>
Katie Roberts-Hoffmanb262c722014-10-23 19:14:30 -070017#include <console/console.h>
18#include <gpio.h>
19#include <soc/sdram.h>
20#include <string.h>
21#include <types.h>
22
23static struct rk3288_sdram_params sdram_configs[] = {
24#include "sdram_inf/sdram-lpddr3-samsung-2GB.inc" /* ram_code = 0000 */
Julius Wernerc447f432015-02-18 18:00:07 -080025#include "sdram_inf/sdram-lpddr3-hynix-2GB.inc" /* ram_code = 0001 */
Katie Roberts-Hoffmanb262c722014-10-23 19:14:30 -070026#include "sdram_inf/sdram-unused.inc" /* ram_code = 0010 */
27#include "sdram_inf/sdram-unused.inc" /* ram_code = 0011 */
28#include "sdram_inf/sdram-ddr3-samsung-2GB.inc" /* ram_code = 0100 */
huang lind94ee942014-12-18 12:32:56 +080029#include "sdram_inf/sdram-ddr3-hynix-2GB.inc" /* ram_code = 0101 */
Paul Mac9286ed2015-01-19 11:47:34 +080030#include "sdram_inf/sdram-ddr3-samsung-2GB.inc" /* ram_code = 0110 */
jinkun.hong5e94e4f2015-03-19 14:51:56 +080031#include "sdram_inf/sdram-lpddr3-elpida-2GB.inc" /* ram_code = 0111 */
Julius Wernerc447f432015-02-18 18:00:07 -080032#include "sdram_inf/sdram-lpddr3-samsung-4GB.inc" /* ram_code = 1000 */
33#include "sdram_inf/sdram-lpddr3-hynix-4GB.inc" /* ram_code = 1001 */
jinkun.hongcbd7de72015-08-20 14:06:31 +080034#include "sdram_inf/sdram-ddr3-nanya-2GB.inc" /* ram_code = 1010 */
jinkun.hong5e94e4f2015-03-19 14:51:56 +080035#include "sdram_inf/sdram-lpddr3-elpida-4GB.inc" /* ram_code = 1011 */
Katie Roberts-Hoffmanb262c722014-10-23 19:14:30 -070036#include "sdram_inf/sdram-unused.inc" /* ram_code = 1100 */
ZhengShunQian82a7bc42015-03-06 14:45:03 +080037#include "sdram_inf/sdram-ddr3-hynix-2GB.inc" /* ram_code = 1101 */
Julius Wernerc447f432015-02-18 18:00:07 -080038#include "sdram_inf/sdram-ddr3-samsung-4GB.inc" /* ram_code = 1110 */
39#include "sdram_inf/sdram-ddr3-hynix-4GB.inc" /* ram_code = 1111 */
Katie Roberts-Hoffmanb262c722014-10-23 19:14:30 -070040};
41
Katie Roberts-Hoffmanb262c722014-10-23 19:14:30 -070042const struct rk3288_sdram_params *get_sdram_config()
43{
David Hendricks539e8562014-11-06 16:51:02 -080044 u32 ramcode = ram_code();
Katie Roberts-Hoffmanb262c722014-10-23 19:14:30 -070045
46 if (ramcode >= ARRAY_SIZE(sdram_configs)
47 || sdram_configs[ramcode].dramtype == UNUSED)
48 die("Invalid RAMCODE.");
49 return &sdram_configs[ramcode];
50}