summaryrefslogtreecommitdiffstats
path: root/src/soc/mediatek/mt8183/include/soc/dramc_param.h
diff options
context:
space:
mode:
authorYu-Ping Wu <yupingso@chromium.org>2019-10-03 18:04:07 +0800
committerPatrick Georgi <pgeorgi@google.com>2019-10-09 22:21:10 +0000
commit732e215dd82f606402c27a409c209f87687512fc (patch)
treef1899eb373019e6da3b877d8fe4313c9f8654f34 /src/soc/mediatek/mt8183/include/soc/dramc_param.h
parent093d8ea323c56350f343e48f83bc6d5d9970d8ab (diff)
downloadcoreboot-732e215dd82f606402c27a409c209f87687512fc.tar.gz
coreboot-732e215dd82f606402c27a409c209f87687512fc.tar.bz2
coreboot-732e215dd82f606402c27a409c209f87687512fc.zip
soc/mediatek/mt8183: Add the shared 'dramc_param' module
The dramc_param module simplifies the communication between coreboot and MTK DRAM full calibration blob, and is shared by both implementations to ensure the same format of parameters. BUG=b:139099592 BRANCH=none TEST=emerge-kukui coreboot Change-Id: I4cfd634da1855a76706aab0b050197251e2ed4dd Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/35775 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'src/soc/mediatek/mt8183/include/soc/dramc_param.h')
-rw-r--r--src/soc/mediatek/mt8183/include/soc/dramc_param.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/soc/mediatek/mt8183/include/soc/dramc_param.h b/src/soc/mediatek/mt8183/include/soc/dramc_param.h
new file mode 100644
index 000000000000..c2df459c6f42
--- /dev/null
+++ b/src/soc/mediatek/mt8183/include/soc/dramc_param.h
@@ -0,0 +1,78 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2019 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef SOC_MEDIATEK_MT8183_DRAMC_PARAM_H
+#define SOC_MEDIATEK_MT8183_DRAMC_PARAM_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include "emi.h"
+
+enum {
+ DRAMC_PARAM_HEADER_MAGIC = 0x44524d4b,
+ DRAMC_PARAM_HEADER_VERSION = 1,
+};
+
+enum DRAMC_PARAM_STATUS_CODES {
+ DRAMC_SUCCESS = 0,
+ DRAMC_ERR_INVALID_MAGIC,
+ DRAMC_ERR_INVALID_VERSION,
+ DRAMC_ERR_INVALID_SIZE,
+ DRAMC_ERR_INVALID_CHECKSUM,
+ DRAMC_ERR_INVALID_FLAGS,
+ DRAMC_ERR_RECALIBRATE,
+ DRAMC_ERR_INIT_DRAM,
+ DRAMC_ERR_COMPLEX_RW_MEM_TEST,
+ DRAMC_ERR_1ST_COMPLEX_RW_MEM_TEST,
+ DRAMC_ERR_2ND_COMPLEX_RW_MEM_TEST,
+};
+
+/* Bit flags */
+enum DRAMC_PARAM_CONFIG {
+ DRAMC_CONFIG_EMCP = 0x0001,
+};
+
+enum DRAMC_PARAM_FLAGS {
+ DRAMC_FLAG_HAS_SAVED_DATA = 0x0001,
+};
+
+struct dramc_param_header {
+ u32 status; /* DRAMC_PARAM_STATUS_CODES */
+ u32 magic;
+ u32 version;
+ u32 size; /* size of whole dramc_param */
+ u16 config; /* DRAMC_PARAM_CONFIG */
+ u16 flags; /* DRAMC_PARAM_FLAGS */
+ u32 checksum;
+};
+
+struct dramc_param {
+ struct dramc_param_header header;
+ struct sdram_params freq_params[DRAM_DFS_SHUFFLE_MAX];
+};
+
+struct dramc_param_ops {
+ struct dramc_param *param;
+ bool (*read_from_flash)(struct dramc_param *dparam);
+ bool (*write_to_flash)(const struct dramc_param *dparam);
+};
+
+struct dramc_param *get_dramc_param_from_blob(void *blob);
+int validate_dramc_param(const void *blob);
+int is_valid_dramc_param(const void *blob);
+int initialize_dramc_param(void *blob, u16 config);
+
+#endif /* SOC_MEDIATEK_MT8183_DRAMC_PARAM_H */