Angel Pons | 34b707f | 2020-04-05 13:21:27 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Yen Lin | 727ba2d | 2015-06-17 17:06:23 -0700 | [diff] [blame] | 2 | |
| 3 | #include <console/console.h> |
| 4 | #include <soc/sdram_configs.h> |
| 5 | |
| 6 | static struct sdram_params sdram_configs[] = { |
| 7 | #include "bct/sdram-samsung-3GB-204.inc" /* ram_code = 0000 */ |
| 8 | #include "bct/sdram-unused.inc" /* ram_code = 0001 */ |
| 9 | #include "bct/sdram-unused.inc" /* ram_code = 0010 */ |
| 10 | #include "bct/sdram-unused.inc" /* ram_code = 0011 */ |
| 11 | }; |
| 12 | |
| 13 | const struct sdram_params *get_sdram_config() |
| 14 | { |
| 15 | uint32_t ramcode = sdram_get_ram_code(); |
| 16 | /* |
| 17 | * If we need to apply some special hacks to RAMCODE mapping (ex, by |
| 18 | * board_id), do that now. |
| 19 | */ |
| 20 | |
| 21 | printk(BIOS_SPEW, "%s: RAMCODE=%d\n", __func__, ramcode); |
| 22 | if (ramcode >= sizeof(sdram_configs) / sizeof(sdram_configs[0]) || |
| 23 | sdram_configs[ramcode].MemoryType == NvBootMemoryType_Unused) { |
| 24 | die("Invalid RAMCODE."); |
| 25 | } |
| 26 | |
| 27 | return &sdram_configs[ramcode]; |
| 28 | } |