9 #include <soc/dramc_param.h>
10 #include <soc/dramc_pi_api.h>
28 if (rank_size[r] == 0)
34 (i == 0) ?
"pass" :
"fail", i);
58 header->size,
sizeof(*dparam));
75 "Invalid DRAM calibration data from flash\n");
82 "Incompatible config for calibration data from flash "
83 "(expected: %#x, saved: %#x)\n",
91 "Invalid DRAM calibration checksum from flash "
92 "(expected: %#x, saved: %#x)\n",
125 "Full calibration executed without saving parameters. "
126 "Please ensure the blob is built properly.\n");
145 memcpy(&dst[shuffle], src,
sizeof(*dst));
153 if (
CONFIG(MT8183_DRAM_EMCP))
159 if (
CONFIG(MT8183_DRAM_DVFS) && !recovery_mode)
168 memset(dparam, 0xff,
sizeof(*dparam));
175 "Calibration params loaded from flash\n");
180 "Failed to apply cached calibration data\n");
184 "Failed to read calibration data from flash\n");
194 "ran DRAM calibration\n");
200 if (!recovery_mode) {
205 "version=%#x, size=%#x\n",
212 "falling back to load default sdram param\n", err);
218 die(
"Set emi failed with params from sdram config\n");
220 die(
"Memory test failed with params from sdram config\n");
struct arm64_kernel_header header
void * memcpy(void *dest, const void *src, size_t n)
void * memset(void *dstpp, int c, size_t len)
const struct sdram_info * get_sdram_config(void)
enum cb_err cbfs_prog_stage_load(struct prog *prog)
int initialize_dramc_param(void *blob)
void mt_set_emi(struct dramc_param *dparam)
int complex_mem_test(u8 *start, unsigned int len)
#define printk(level,...)
void __noreturn die(const char *fmt,...)
void do_putchar(unsigned char byte)
@ DRAMC_FLAG_HAS_SAVED_DATA
unsigned long compute_ip_checksum(const void *addr, unsigned long length)
static uint8_t checksum(uint8_t *data, int offset)
#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_ops dparam_ops
void pmic_set_vcore_vol(unsigned int vcore_uv)
int is_valid_dramc_param(const void *blob)
void dramc_get_rank_size(u64 *dram_rank_size)
@ DRAMC_PARAM_HEADER_VERSION
@ DRAMC_PARAM_HEADER_MAGIC
@ DRAMC_PARAM_SOURCE_FLASH
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)
int vboot_recovery_mode_enabled(void)
bool(* read_from_flash)(struct dramc_param *dparam)
bool(* write_to_flash)(const struct dramc_param *dparam)
struct dramc_param * param
struct dramc_param_header header
struct sdram_params freq_params[DRAM_DFS_SHUFFLE_MAX]
void(* do_putc)(unsigned char c)
Defines the SDRAM parameter structure.
int get_recovery_mode_retrain_switch(void)