Huayang Duan | a0ef678 | 2020-06-22 19:36:14 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <boardid.h> |
| 4 | #include <cbfs.h> |
| 5 | #include <console/console.h> |
| 6 | #include <soc/dramc_param.h> |
| 7 | |
| 8 | static const char *const sdram_configs[] = { |
| 9 | [0] = "sdram-lpddr4x-MT29VZZZBD9DQKPR-046-6GB", |
| 10 | [1] = "sdram-lpddr4x-MT29VZZZAD8GQFSL-046-4GB", |
| 11 | }; |
| 12 | |
| 13 | static struct sdram_info params; |
| 14 | |
| 15 | const struct sdram_info *get_sdram_config(void) |
| 16 | { |
| 17 | uint32_t ramcode = ram_code(); |
| 18 | |
| 19 | if (ramcode >= ARRAY_SIZE(sdram_configs) || |
Julius Werner | 834b3ec | 2020-03-04 16:52:08 -0800 | [diff] [blame^] | 20 | cbfs_load(sdram_configs[ramcode], ¶ms, sizeof(params)) != sizeof(params)) |
Huayang Duan | a0ef678 | 2020-06-22 19:36:14 +0800 | [diff] [blame] | 21 | die("Cannot load SDRAM parameter file for RAM code: %#x", ramcode); |
| 22 | |
| 23 | return ¶ms; |
| 24 | } |