11 #include <soc/dramc_param.h>
13 #include <soc/mmu_operations.h>
18 #define CALIBRATION_REGION "RW_MRC_CACHE"
19 #define CALIBRATION_REGION_SIZE 0x2000
40 "[MEM] complex R/W mem test failed: %d\n",
result);
56 switch (ddr_geometry) {
58 s =
"2CH_2RK_4GB_2_2";
61 s =
"2CH_2RK_6GB_3_3";
64 s =
"2CH_2RK_8GB_4_4";
67 s =
"2CH_2RK_8GB_4_4_BYTE";
70 s =
"2CH_1RK_4GB_4_0";
73 s =
"2CH_2RK_6GB_2_4";
108 for (
unsigned int i = 0; i <
RANK_MAX; ++i)
137 if (!
CONFIG(USE_CBMEM_DRAM_INFO)) {
139 "DRAM-K: CBMEM DRAM info is unsupported (USE_CBMEM_DRAM_INFO)\n");
143 size =
sizeof(*mc) +
sizeof(
struct mem_chip_channel) *
CHANNEL_MAX;
176 "DRAM-K: Full calibration executed without saving parameters. "
177 "Please ensure the blob is built properly.\n");
190 "DRAM-K: Incompatible config for calibration data from flash "
191 "(expected: %#x, saved: %#x)\n",
198 if (
CONFIG(MEDIATEK_BLOB_FAST_INIT)) {
231 memset(dparam, 0,
sizeof(*dparam));
238 if (
CONFIG(MEDIATEK_DRAM_DVFS))
243 printk(
BIOS_INFO,
"DRAM-K: ddr_type: %s, config_dvfs: %d, ddr_geometry: %s\n",
252 const ssize_t mrc_cache_size =
sizeof(*dparam);
260 dparam, mrc_cache_size);
261 if (data_size == mrc_cache_size) {
268 "in %ld msecs, error: %d\n",
272 memset(dparam, 0xa5, mrc_cache_size);
275 dparam, mrc_cache_size);
283 data_size, mrc_cache_size);
297 dparam, mrc_cache_size);
299 printk(
BIOS_ERR,
"DRAM-K: Full calibration failed in %ld msecs\n",
void * memset(void *dstpp, int c, size_t len)
#define assert(statement)
const struct sdram_info * get_sdram_config(void)
enum cb_err cbfs_prog_stage_load(struct prog *prog)
void * cbmem_add(u32 id, u64 size)
#define CBMEM_ID_MEM_CHIP_INFO
int initialize_dramc_param(void *blob)
int complex_mem_test(u8 *start, unsigned int len)
#define printk(level,...)
void do_putchar(unsigned char byte)
void init_dram_by_params(struct dramc_param *dparam)
@ DDR_TYPE_2CH_2RK_8GB_4_4
@ DDR_TYPE_2CH_2RK_8GB_4_4_BYTE
@ DDR_TYPE_2CH_2RK_4GB_2_2
@ DDR_TYPE_2CH_2RK_6GB_3_3
@ DDR_TYPE_2CH_1RK_4GB_4_0
@ DDR_TYPE_2CH_2RK_6GB_2_4
@ DRAMC_FLAG_HAS_SAVED_DATA
static void stopwatch_init(struct stopwatch *sw)
static long stopwatch_duration_msecs(struct stopwatch *sw)
#define BIOS_INFO
BIOS_INFO - Expected events.
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
static struct dramc_param dramc_parameter
ssize_t mrc_cache_load_current(int type, uint32_t version, void *buffer, size_t buffer_size)
mrc_cache_load_current
int mrc_cache_stash_data(int type, uint32_t version, const void *data, size_t size)
Returns < 0 on error, 0 on success.
@ DRAMC_PARAM_HEADER_VERSION
#define DQ_DATA_WIDTH_LP4
static void * prog_entry(const struct prog *prog)
#define PROG_INIT(type_, name_)
static void prog_set_entry(struct prog *prog, void *e, void *arg)
void prog_run(struct prog *prog)
struct ddr_mrr_info mrr_info
u64 mr8_density[RANK_MAX]
struct ddr_base_info ddr_info
struct dramc_param_header header
struct dramc_data dramc_datas
void(* do_putc)(unsigned char c)
struct mem_chip_info::mem_chip_channel channel[0]
#define s(param, src_bits, pmcreg, dst_bits)