blob: e1eb5277206c300440318f3adc433f0921a95f0a [file] [log] [blame]
Huayang Duana0ef6782020-06-22 19:36:14 +08001/* 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
8static const char *const sdram_configs[] = {
9 [0] = "sdram-lpddr4x-MT29VZZZBD9DQKPR-046-6GB",
10 [1] = "sdram-lpddr4x-MT29VZZZAD8GQFSL-046-4GB",
11};
12
13static struct sdram_info params;
14
15const struct sdram_info *get_sdram_config(void)
16{
17 uint32_t ramcode = ram_code();
18
19 if (ramcode >= ARRAY_SIZE(sdram_configs) ||
Julius Werner834b3ec2020-03-04 16:52:08 -080020 cbfs_load(sdram_configs[ramcode], &params, sizeof(params)) != sizeof(params))
Huayang Duana0ef6782020-06-22 19:36:14 +080021 die("Cannot load SDRAM parameter file for RAM code: %#x", ramcode);
22
23 return &params;
24}