soc/mediatek/mt8188: Add DRAM full calibration support
- Use common SoC drivers for DRAM calibration support. - Remove emi.h because sdram_size() is already declared in common/include/soc/emi.h. - Add dramc_param.h and dramc_soc.h to prepare for implementation of DRAM full calibration. TEST=build pass BUG=b:233720142 Signed-off-by: Xi Chen <xixi.chen@mediatek.com> Change-Id: I2f88d971fe861cbd09cc86c8a5a1fb531bfe78d7 Reviewed-on: https://review.coreboot.org/c/coreboot/+/66277 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yidi Lin <yidilin@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
parent
a0eb855ef4
commit
22ce1e80af
|
@ -8,6 +8,7 @@ config SOC_MEDIATEK_MT8188
|
||||||
select HAVE_UART_SPECIAL
|
select HAVE_UART_SPECIAL
|
||||||
select SOC_MEDIATEK_COMMON
|
select SOC_MEDIATEK_COMMON
|
||||||
select FLASH_DUAL_IO_READ
|
select FLASH_DUAL_IO_READ
|
||||||
|
select CACHE_MRC_SETTINGS
|
||||||
|
|
||||||
if SOC_MEDIATEK_MT8188
|
if SOC_MEDIATEK_MT8188
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,11 @@ bootblock-y += ../common/wdt.c ../common/wdt_req.c wdt.c
|
||||||
|
|
||||||
romstage-y += ../common/cbmem.c
|
romstage-y += ../common/cbmem.c
|
||||||
romstage-y += ../common/clkbuf.c
|
romstage-y += ../common/clkbuf.c
|
||||||
|
romstage-y += ../common/dram_init.c
|
||||||
|
romstage-y += ../common/dramc_param.c
|
||||||
romstage-y += emi.c
|
romstage-y += emi.c
|
||||||
|
romstage-y += ../common/memory.c
|
||||||
|
romstage-y += ../common/memory_test.c
|
||||||
romstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
|
romstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
|
||||||
romstage-y += ../common/mt6315.c mt6315.c
|
romstage-y += ../common/mt6315.c mt6315.c
|
||||||
romstage-y += ../common/mt6359p.c mt6359p.c
|
romstage-y += ../common/mt6359p.c mt6359p.c
|
||||||
|
@ -54,6 +58,14 @@ $(foreach fw, $(call strip_quotes,$(mcu-firmware-files)), \
|
||||||
$(if $(wildcard $($(fw)-file)), $(eval cbfs-files-y += $(fw)), ) \
|
$(if $(wildcard $($(fw)-file)), $(eval cbfs-files-y += $(fw)), ) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
DRAM_CBFS := $(CONFIG_CBFS_PREFIX)/dram
|
||||||
|
$(DRAM_CBFS)-file := $(MT8188_BLOB_DIR)/dram.elf
|
||||||
|
$(DRAM_CBFS)-type := stage
|
||||||
|
$(DRAM_CBFS)-compression := $(CBFS_PRERAM_COMPRESS_FLAG)
|
||||||
|
ifneq ($(wildcard $($(DRAM_CBFS)-file)),)
|
||||||
|
cbfs-files-y += $(DRAM_CBFS)
|
||||||
|
endif
|
||||||
|
|
||||||
$(objcbfs)/bootblock.bin: $(objcbfs)/bootblock.raw.bin
|
$(objcbfs)/bootblock.bin: $(objcbfs)/bootblock.raw.bin
|
||||||
./util/mtkheader/gen-bl-img.py mt8183 sf $< $@
|
./util/mtkheader/gen-bl-img.py mt8183 sf $< $@
|
||||||
|
|
||||||
|
|
|
@ -11,3 +11,8 @@ size_t sdram_size(void)
|
||||||
{
|
{
|
||||||
return (size_t)4 * GiB;
|
return (size_t)4 * GiB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mt_set_emi(struct dramc_param *dparam)
|
||||||
|
{
|
||||||
|
/* Do nothing */
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is created based on MT8188 Functional Specification
|
||||||
|
* Chapter number: 3.7
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SOC_MEDIATEK_MT8188_DRAMC_PARAM_H__
|
||||||
|
#define __SOC_MEDIATEK_MT8188_DRAMC_PARAM_H__
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOTE: This file is shared between coreboot and dram blob. Any change in this
|
||||||
|
* file should be synced to the other repository.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <soc/dramc_param_common.h>
|
||||||
|
#include <soc/dramc_soc.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#define DRAMC_PARAM_HEADER_VERSION 1
|
||||||
|
|
||||||
|
struct sdram_params {
|
||||||
|
/* Not needed for full calibration */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct dramc_data {
|
||||||
|
struct ddr_base_info ddr_info;
|
||||||
|
struct sdram_params freq_params[DRAM_DFS_SHU_MAX];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct dramc_param {
|
||||||
|
struct dramc_param_header header;
|
||||||
|
void (*do_putc)(unsigned char c);
|
||||||
|
struct dramc_data dramc_datas;
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct sdram_info *get_sdram_config(void);
|
||||||
|
struct dramc_param *get_dramc_param_from_blob(void *blob);
|
||||||
|
void dump_param_header(const void *blob);
|
||||||
|
int validate_dramc_param(const void *blob);
|
||||||
|
int is_valid_dramc_param(const void *blob);
|
||||||
|
int initialize_dramc_param(void *blob);
|
||||||
|
|
||||||
|
#endif /* __SOC_MEDIATEK_MT8188_DRAMC_PARAM_H__ */
|
|
@ -0,0 +1,51 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is created based on MT8188 Functional Specification
|
||||||
|
* Chapter number: 3.7
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SOC_MEDIATEK_MT8188_DRAMC_SOC_H__
|
||||||
|
#define __SOC_MEDIATEK_MT8188_DRAMC_SOC_H__
|
||||||
|
|
||||||
|
#include <soc/dramc_soc_common.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CHANNEL_A = 0,
|
||||||
|
CHANNEL_B,
|
||||||
|
CHANNEL_C,
|
||||||
|
CHANNEL_D,
|
||||||
|
CHANNEL_MAX,
|
||||||
|
} DRAM_CHANNEL_T;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RANK_0 = 0,
|
||||||
|
RANK_1,
|
||||||
|
RANK_MAX,
|
||||||
|
} DRAM_RANK_T;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SRAM_SHU0 = 0,
|
||||||
|
SRAM_SHU1,
|
||||||
|
SRAM_SHU2,
|
||||||
|
SRAM_SHU3,
|
||||||
|
SRAM_SHU4,
|
||||||
|
SRAM_SHU5,
|
||||||
|
SRAM_SHU6,
|
||||||
|
SRAM_SHU7,
|
||||||
|
DRAM_DFS_SRAM_MAX,
|
||||||
|
} DRAM_DFS_SRAM_SHU_T;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DRVP = 0,
|
||||||
|
DRVN,
|
||||||
|
ODTP,
|
||||||
|
ODTN,
|
||||||
|
NTODT,
|
||||||
|
IMP_DRV_MAX,
|
||||||
|
} DRAM_IMP_DRV_T;
|
||||||
|
|
||||||
|
#define DRAM_DFS_SHU_MAX DRAM_DFS_SRAM_MAX
|
||||||
|
|
||||||
|
#endif /* __SOC_MEDIATEK_MT8188_DRAMC_SOC_H__ */
|
|
@ -1,15 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is created based on MT8188 Functional Specification
|
|
||||||
* Chapter number: 3.7
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SOC_MEDIATEK_MT8188_EMI_H
|
|
||||||
#define SOC_MEDIATEK_MT8188_EMI_H
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
size_t sdram_size(void);
|
|
||||||
|
|
||||||
#endif /* SOC_MEDIATEK_MT8188_EMI_H */
|
|
Loading…
Reference in New Issue