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 | |
Patrick Georgi | 6b688f5 | 2021-02-12 13:49:11 +0100 | [diff] [blame^] | 3 | #include <commonlib/bsd/helpers.h> |
Yen Lin | 727ba2d | 2015-06-17 17:06:23 -0700 | [diff] [blame] | 4 | #include <console/console.h> |
| 5 | #include <soc/sdram_configs.h> |
| 6 | |
| 7 | static struct sdram_params sdram_configs[] = { |
| 8 | #include "bct/sdram-samsung-3GB-204.inc" /* ram_code = 0000 */ |
| 9 | #include "bct/sdram-unused.inc" /* ram_code = 0001 */ |
| 10 | #include "bct/sdram-unused.inc" /* ram_code = 0010 */ |
| 11 | #include "bct/sdram-unused.inc" /* ram_code = 0011 */ |
| 12 | }; |
| 13 | |
| 14 | const struct sdram_params *get_sdram_config() |
| 15 | { |
| 16 | uint32_t ramcode = sdram_get_ram_code(); |
| 17 | /* |
| 18 | * If we need to apply some special hacks to RAMCODE mapping (ex, by |
| 19 | * board_id), do that now. |
| 20 | */ |
| 21 | |
| 22 | printk(BIOS_SPEW, "%s: RAMCODE=%d\n", __func__, ramcode); |
Patrick Georgi | 6b688f5 | 2021-02-12 13:49:11 +0100 | [diff] [blame^] | 23 | if (ramcode >= ARRAY_SIZE(sdram_configs) || |
Yen Lin | 727ba2d | 2015-06-17 17:06:23 -0700 | [diff] [blame] | 24 | sdram_configs[ramcode].MemoryType == NvBootMemoryType_Unused) { |
| 25 | die("Invalid RAMCODE."); |
| 26 | } |
| 27 | |
| 28 | return &sdram_configs[ramcode]; |
| 29 | } |