blob: 8d4521168fbb8df06026654dc81df2b522835de6 [file] [log] [blame]
Angel Pons8d0e9292020-04-05 13:22:48 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Patrick Georgi4d6ad832015-06-22 19:43:18 +02002
3#include <console/console.h>
4#include <soc/sdram_configs.h>
5
6static struct sdram_params sdram_configs[] = {
7#include "bct/sdram-unused.inc" /* ram_code = 0000 */
8#include "bct/sdram-unused.inc" /* ram_code = 0001 */
9#include "bct/sdram-samsung-3GB-204.inc" /* ram_code = 0010 */
10#include "bct/sdram-samsung-4GB-204.inc" /* ram_code = 0011 */
11#include "bct/sdram-unused.inc" /* ram_code = 0100 */
12#include "bct/sdram-unused.inc" /* ram_code = 0101 */
13#include "bct/sdram-unused.inc" /* ram_code = 0110 */
14#include "bct/sdram-unused.inc" /* ram_code = 0111 */
15#include "bct/sdram-unused.inc" /* ram_code = 1000 */
16#include "bct/sdram-unused.inc" /* ram_code = 1001 */
17#include "bct/sdram-unused.inc" /* ram_code = 1010 */
18#include "bct/sdram-unused.inc" /* ram_code = 1011 */
19#include "bct/sdram-unused.inc" /* ram_code = 1100 */
20#include "bct/sdram-unused.inc" /* ram_code = 1101 */
21#include "bct/sdram-unused.inc" /* ram_code = 1110 */
22#include "bct/sdram-unused.inc" /* ram_code = 1111 */
23};
24
25const struct sdram_params *get_sdram_config()
26{
27 uint32_t ramcode = sdram_get_ram_code();
28 /*
29 * If we need to apply some special hacks to RAMCODE mapping (ex, by
30 * board_id), do that now.
31 */
32
33 printk(BIOS_SPEW, "%s: RAMCODE=%d\n", __func__, ramcode);
Patrick Georgi6b688f52021-02-12 13:49:11 +010034 if (ramcode >= ARRAY_SIZE(sdram_configs) ||
Patrick Georgi4d6ad832015-06-22 19:43:18 +020035 sdram_configs[ramcode].MemoryType == NvBootMemoryType_Unused) {
36 die("Invalid RAMCODE.");
37 }
38
39 return &sdram_configs[ramcode];
40}