soc/mediatek/mt8183: Add ddr geometry to support 6GB, 8GB DDR bootup

Currently the DRAM initialization code can only work on 4GB size and
want to support larger memory sizes in future, so add geometry
information to the DRAM calibration parameters.

BUG=none
BRANCH=kukui
TEST=Boots correctly on Kukui

Change-Id: I1fdf50b75c6a552c0a889f21e1a81ab4b9a305fa
Signed-off-by: Huayang Duan <huayang.duan@mediatek.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41949
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Huayang Duan
2020-05-31 11:49:25 +08:00
committed by Hung-Te Lin
parent 92fb91935b
commit 0e6cb83abb
4 changed files with 14 additions and 5 deletions

View File

@@ -5,6 +5,7 @@
#include <delay.h>
#include <soc/emi.h>
#include <soc/dramc_pi_api.h>
#include <soc/dramc_param.h>
#include <soc/dramc_register.h>
#include <soc/infracfg.h>
#include <string.h>

View File

@@ -6,6 +6,7 @@
#include <device/mmio.h>
#include <soc/emi.h>
#include <soc/dramc_register.h>
#include <soc/dramc_param.h>
#include <soc/dramc_pi_api.h>
#include <timer.h>

View File

@@ -3,14 +3,14 @@
#ifndef SOC_MEDIATEK_MT8183_DRAMC_PARAM_H
#define SOC_MEDIATEK_MT8183_DRAMC_PARAM_H
#include <soc/dramc_common_mt8183.h>
#include <soc/emi.h>
#include <stdint.h>
#include <sys/types.h>
#include "emi.h"
enum {
DRAMC_PARAM_HEADER_MAGIC = 0x44524d4b,
DRAMC_PARAM_HEADER_VERSION = 2,
DRAMC_PARAM_HEADER_VERSION = 3,
};
enum DRAMC_PARAM_STATUS_CODES {
@@ -37,10 +37,16 @@ enum DRAMC_PARAM_FLAGS {
DRAMC_FLAG_HAS_SAVED_DATA = 0x0001,
};
enum DRAMC_PARAM_GEOMETRY_TYPE {
DDR_TYPE_2CH_2RK_4GB_2_2,
DDR_TYPE_2CH_2RK_6GB_3_3,
DDR_TYPE_2CH_2RK_8GB_4_4,
};
struct dramc_param_header {
u32 status; /* DRAMC_PARAM_STATUS_CODES */
u32 magic;
u32 version;
u32 version; /* DRAMC_PARAM_HEADER_VERSION */
u32 size; /* size of whole dramc_param */
u16 config; /* DRAMC_PARAM_CONFIG */
u16 flags; /* DRAMC_PARAM_FLAGS */

View File

@@ -13,8 +13,9 @@ enum DRAMC_PARAM_SOURCE {
};
struct sdram_params {
u16 source; /* DRAMC_PARAM_SOURCE */
u16 source; /* DRAMC_PARAM_SOURCE */
u16 frequency;
u32 ddr_geometry; /* DRAMC_PARAM_GEOMETRY_TYPE */
u8 wr_level[CHANNEL_MAX][RANK_MAX][DQS_NUMBER];
/* DUTY */