diff options
author | Xi Chen <xixi.chen@mediatek.com> | 2021-02-05 11:45:12 +0800 |
---|---|---|
committer | Hung-Te Lin <hungte@chromium.org> | 2021-03-08 01:49:52 +0000 |
commit | 022b1b992f24890a04851dccc2829284a0431d6a (patch) | |
tree | 1179f795920c5591f13b837a57353e5740bfc91c /src/vendorcode/mediatek/mt8192/include/dramc_common.h | |
parent | 69da75411218c705b6b7375664523be707cb5258 (diff) | |
download | coreboot-022b1b992f24890a04851dccc2829284a0431d6a.tar.gz coreboot-022b1b992f24890a04851dccc2829284a0431d6a.tar.bz2 coreboot-022b1b992f24890a04851dccc2829284a0431d6a.zip |
vendor: mediatek: Add mediatek mt8192 dram initialization code
This is the DRAM initialization code from the reference
implementation released by Mediatek for MT8192.
The DRAM calibration code can be taken as a standalone
library, used by different boot loaders for initializing
DRAM and following a different coding style (coreboot was
using Linux Kernel coding style), so we have to put it
in vendor code folder.
Signed-off-by: Xi Chen <xixi.chen@mediatek.com>
Change-Id: I3853204578069c6abf52689ea6f5d88841414bd4
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50294
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/vendorcode/mediatek/mt8192/include/dramc_common.h')
-rw-r--r-- | src/vendorcode/mediatek/mt8192/include/dramc_common.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/src/vendorcode/mediatek/mt8192/include/dramc_common.h b/src/vendorcode/mediatek/mt8192/include/dramc_common.h new file mode 100644 index 000000000000..04d07a025c53 --- /dev/null +++ b/src/vendorcode/mediatek/mt8192/include/dramc_common.h @@ -0,0 +1,91 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +#ifndef _DRAMC_COMMON_H_ +#define _DRAMC_COMMON_H_ + +#define __ETT__ 0 + +//#include <console/console.h> +#include <delay.h> +#include <device/mmio.h> +#include <stdint.h> +#include <types.h> +#include <reg.h> +#include <string.h> +#include <soc/dramc_common.h> +#include <timer.h> +#include <print.h> + +#include "dramc_register.h" +#include "dramc_pi_api.h" +#include "dramc_int_slt.h" + +#if FOR_DV_SIMULATION_USED == 1 +#include "dramc_dv_init.h" +#endif + +/***********************************************************************/ +/* Public Types */ +/***********************************************************************/ + +/*------------------------------------------------------------*/ +/* macros, defines, typedefs, enums */ +/*------------------------------------------------------------*/ +/************************** Common Macro *********************/ +#define dsb() asm volatile("dsb sy" : : : "memory") + +#define DRV_Reg32(x) read32((const void *)((u64)(x))) +#define DRV_WriteReg32(x, y) write32((void *)((u64)(x)), (y)) + +#define mcDELAY_US(x) udelay(x) +#define mcDELAY_MS(x) udelay(x*1000) +#define mcDELAY_XUS(x) udelay(x) +#define mcDELAY_XNS(x) udelay(1) + +/**********************************************/ +/* Priority of debug log */ +/*--------------------------------------------*/ +/* mcSHOW_DBG_MSG: High */ +/* mcSHOW_DBG_MSG2: Medium High */ +/* mcSHOW_DBG_MSG3: Medium Low */ +/* mcSHOW_DBG_MSG4: Low */ +/**********************************************/ + +#define CALIBRATION_LOG 1 + +#if CALIBRATION_LOG +#define mcSHOW_DBG_MSG(_x_) {print _x_;} +#define mcSHOW_DBG_MSG2(_x_) //{print _x_;} +#define mcSHOW_ERR_MSG(_x_) {print _x_;} +#else +#define mcSHOW_DBG_MSG(_x_) +#define mcSHOW_DBG_MSG2(_x_) +#define mcSHOW_ERR_MSG(_x_) +#endif + +#define mcSHOW_DBG_MSG3(_x_) // {print _x_;} +#define mcSHOW_DBG_MSG4(_x_) +#define mcSHOW_DBG_MSG5(_x_) +#define mcSHOW_JV_LOG_MSG(_x_) +#if EYESCAN_LOG +#define mcSHOW_EYESCAN_MSG(_x_) {print _x_;} +#else +#define mcSHOW_EYESCAN_MSG(_x_) //{print _x_;} +#endif +#define mcSHOW_DBG_MSG5(_x_) +#define mcSHOW_TIME_MSG(_x_) +#define mcDUMP_REG_MSG(_x_) +#define mcFPRINTF(_x_) + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof (x) / sizeof (x[0])) +#endif + +#define enter_function() \ + ({mcSHOW_DBG_MSG(("enter %s\n", __FUNCTION__));}) + +#define exit_function() \ + ({mcSHOW_DBG_MSG(("exit %s\n", __FUNCTION__));}) + +extern int dump_log; +#endif // _DRAMC_COMMON_H_ |