blob: 291bc33fe9d127660131f76df2562bd2ddd70b1b [file] [log] [blame]
David Hendricks113ef812015-05-13 13:58:24 -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.
David Hendricks113ef812015-05-13 13:58:24 -070014 */
David Hendricks113ef812015-05-13 13:58:24 -070015#include <boardid.h>
16#include <console/console.h>
17#include <gpio.h>
18#include <soc/sdram.h>
David Hendricks113ef812015-05-13 13:58:24 -070019#include <types.h>
20
21static struct rk3288_sdram_params sdram_configs[] = {
22#include "sdram_inf/sdram-lpddr3-samsung-2GB.inc" /* ram_code = 0000 */
23#include "sdram_inf/sdram-lpddr3-hynix-2GB.inc" /* ram_code = 0001 */
ZhengShunQian8859afd2016-10-28 15:58:51 +080024#include "sdram_inf/sdram-lpddr3-samsung-4GB-04EB.inc" /* ram_code = 0010 */
Lang Zhangaaf28412016-01-06 16:47:04 +080025#include "sdram_inf/sdram-lpddr3-hynix-2GB-2ranks.inc" /* ram_code = 0011 */
David Hendricks113ef812015-05-13 13:58:24 -070026#include "sdram_inf/sdram-ddr3-samsung-2GB.inc" /* ram_code = 0100 */
27#include "sdram_inf/sdram-ddr3-hynix-2GB.inc" /* ram_code = 0101 */
28#include "sdram_inf/sdram-ddr3-samsung-2GB.inc" /* ram_code = 0110 */
29#include "sdram_inf/sdram-lpddr3-elpida-2GB.inc" /* ram_code = 0111 */
30#include "sdram_inf/sdram-lpddr3-samsung-4GB.inc" /* ram_code = 1000 */
31#include "sdram_inf/sdram-lpddr3-hynix-4GB.inc" /* ram_code = 1001 */
jinkun.hongcbd7de72015-08-20 14:06:31 +080032#include "sdram_inf/sdram-ddr3-nanya-2GB.inc" /* ram_code = 1010 */
David Hendricks113ef812015-05-13 13:58:24 -070033#include "sdram_inf/sdram-lpddr3-elpida-4GB.inc" /* ram_code = 1011 */
ZhengShunQian8859afd2016-10-28 15:58:51 +080034#include "sdram_inf/sdram-lpddr3-samsung-2GB-24EB.inc" /* ram_code = 1100 */
David Hendricks113ef812015-05-13 13:58:24 -070035#include "sdram_inf/sdram-ddr3-hynix-2GB.inc" /* ram_code = 1101 */
36#include "sdram_inf/sdram-ddr3-samsung-4GB.inc" /* ram_code = 1110 */
37#include "sdram_inf/sdram-ddr3-hynix-4GB.inc" /* ram_code = 1111 */
Shunqian Zhengc1749712017-02-23 09:34:40 +080038#include "sdram_inf/sdram-ddr3-samsung-2GB.inc" /* ram_code = 000Z */
David Hendricks6d5b2f72016-11-17 14:19:51 -080039#include "sdram_inf/sdram-lpddr3-micron-2GB-D2.inc" /* ram_code = 001Z */
40#include "sdram_inf/sdram-lpddr3-hynix-2GB-BK.inc" /* ram_code = 00Z0 */
Loop_Wu3910c4e2019-01-09 11:16:59 +080041#include "sdram_inf/sdram-lpddr3-hynix-2GB-BK.inc" /* ram_code = 00Z1 */
David Hendricks6d5b2f72016-11-17 14:19:51 -080042#include "sdram_inf/sdram-unused.inc" /* ram_code = 00ZZ */
43#include "sdram_inf/sdram-unused.inc" /* ram_code = 010Z */
44#include "sdram_inf/sdram-unused.inc" /* ram_code = 011Z */
45#include "sdram_inf/sdram-unused.inc" /* ram_code = 01Z0 */
David Hendricks113ef812015-05-13 13:58:24 -070046};
47
David Hendricks6d5b2f72016-11-17 14:19:51 -080048_Static_assert(ARRAY_SIZE(sdram_configs) == 24, "Must have 24 sdram_configs!");
49
David Hendricks113ef812015-05-13 13:58:24 -070050const struct rk3288_sdram_params *get_sdram_config()
51{
52 u32 ramcode = ram_code();
53
54 if (ramcode >= ARRAY_SIZE(sdram_configs)
55 || sdram_configs[ramcode].dramtype == UNUSED)
56 die("Invalid RAMCODE.");
57 return &sdram_configs[ramcode];
58}