Angel Pons | 5756630 | 2020-04-05 13:22:10 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Tom Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 2 | |
| 3 | #include <console/console.h> |
Julius Werner | f0d21ff3 | 2014-10-20 13:24:14 -0700 | [diff] [blame] | 4 | #include <soc/sdram.h> |
| 5 | |
Tom Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 6 | #include "sdram_configs.h" |
| 7 | |
Tom Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 8 | static struct sdram_params sdram_configs[] = { |
Tom Warren | 96ef188 | 2014-06-10 13:46:48 -0700 | [diff] [blame] | 9 | #include "bct/sdram-unused.inc" /* ram_code = 0000 */ |
| 10 | #include "bct/sdram-hynix-2GB-792.inc" /* ram_code = 0001 */ |
| 11 | #include "bct/sdram-unused.inc" /* ram_code = 0010 */ |
| 12 | #include "bct/sdram-unused.inc" /* ram_code = 0011 */ |
| 13 | #include "bct/sdram-hynix-4GB-792.inc" /* ram_code = 0100 */ |
| 14 | #include "bct/sdram-unused.inc" /* ram_code = 0101 */ |
| 15 | #include "bct/sdram-kingston-2GB-792.inc" /* ram_code = 0110 */ |
| 16 | #include "bct/sdram-unused.inc" /* ram_code = 0111 */ |
| 17 | #include "bct/sdram-unused.inc" /* ram_code = 1000 */ |
| 18 | #include "bct/sdram-unused.inc" /* ram_code = 1001 */ |
| 19 | #include "bct/sdram-unused.inc" /* ram_code = 1010 */ |
| 20 | #include "bct/sdram-unused.inc" /* ram_code = 1011 */ |
| 21 | #include "bct/sdram-unused.inc" /* ram_code = 1100 */ |
| 22 | #include "bct/sdram-unused.inc" /* ram_code = 1101 */ |
| 23 | #include "bct/sdram-unused.inc" /* ram_code = 1110 */ |
| 24 | #include "bct/sdram-unused.inc" /* ram_code = 1111 */ |
Tom Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 25 | }; |
| 26 | |
| 27 | const struct sdram_params *get_sdram_config() |
| 28 | { |
| 29 | uint32_t ramcode = sdram_get_ram_code(); |
| 30 | /* |
| 31 | * If we need to apply some special hacks to RAMCODE mapping (ex, by |
| 32 | * board_id), do that now. |
| 33 | */ |
| 34 | |
| 35 | printk(BIOS_SPEW, "%s: RAMCODE=%d\n", __func__, ramcode); |
Patrick Georgi | 6b688f5 | 2021-02-12 13:49:11 +0100 | [diff] [blame^] | 36 | if (ramcode >= ARRAY_SIZE(sdram_configs) || |
Tom Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 37 | sdram_configs[ramcode].MemoryType == NvBootMemoryType_Unused) { |
| 38 | die("Invalid RAMCODE."); |
| 39 | } |
| 40 | |
| 41 | return &sdram_configs[ramcode]; |
| 42 | } |