aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/google/asurada/sdram_configs.c
diff options
context:
space:
mode:
authorHuayang Duan <huayang.duan@mediatek.com>2020-06-22 19:36:14 +0800
committerPatrick Georgi <pgeorgi@google.com>2020-08-26 07:35:59 +0000
commita0ef67879802f47c4e6e979fa0dd5a872960efc0 (patch)
treef5831fc0c6e3e2f43f18cfdc26e64e862d8a7db1 /src/mainboard/google/asurada/sdram_configs.c
parent3c16fe4fade9f1c695a52e756fa638cb8cd0e9f6 (diff)
mb/google/asurada: Load dram params from sdram config
Signed-off-by: Huayang Duan <huayang.duan@mediatek.com> Change-Id: I2cc38115c27cbbe157fc850bbd88b10ae8001f52 Reviewed-on: https://review.coreboot.org/c/coreboot/+/44567 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'src/mainboard/google/asurada/sdram_configs.c')
-rw-r--r--src/mainboard/google/asurada/sdram_configs.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mainboard/google/asurada/sdram_configs.c b/src/mainboard/google/asurada/sdram_configs.c
new file mode 100644
index 0000000000..9efcb32dae
--- /dev/null
+++ b/src/mainboard/google/asurada/sdram_configs.c
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <boardid.h>
+#include <cbfs.h>
+#include <console/console.h>
+#include <soc/dramc_param.h>
+
+static const char *const sdram_configs[] = {
+ [0] = "sdram-lpddr4x-MT29VZZZBD9DQKPR-046-6GB",
+ [1] = "sdram-lpddr4x-MT29VZZZAD8GQFSL-046-4GB",
+};
+
+static struct sdram_info params;
+
+const struct sdram_info *get_sdram_config(void)
+{
+ uint32_t ramcode = ram_code();
+
+ if (ramcode >= ARRAY_SIZE(sdram_configs) ||
+ cbfs_boot_load_file(sdram_configs[ramcode], &params, sizeof(params),
+ CBFS_TYPE_STRUCT) != sizeof(params))
+ die("Cannot load SDRAM parameter file for RAM code: %#x", ramcode);
+
+ return &params;
+}