static void setup_memory(struct mem_timings *mem, int is_resume) { printk(BIOS_SPEW, "man: 0x%x type: 0x%x, div: 0x%x, mhz: %d\n", mem->mem_manuf, mem->mem_type, mem->mpll_mdiv, mem->frequency_mhz); if (ddr3_mem_ctrl_init(mem, DMC_INTERLEAVE_SIZE, !is_resume)) { die("Failed to initialize memory controller.\n"); } }
void main(void) { struct mem_timings *mem; struct arm_clk_ratios *arm_ratios; int ret; void *entry; clock_set_rate(PERIPH_ID_SPI1, 50000000); /* set spi clock to 50Mhz */ /* Clock must be initialized before console_init, otherwise you may need * to re-initialize serial console drivers again. */ mem = get_mem_timings(); arm_ratios = get_arm_clk_ratios(); system_clock_init(mem, arm_ratios); console_init(); /* * FIXME: Do necessary I2C init so low-level PMIC code doesn't need to. * Also, we should only call power_init() on cold boot. */ power_init(); if (!mem) { printk(BIOS_CRIT, "Unable to auto-detect memory timings\n"); while(1); } printk(BIOS_SPEW, "man: 0x%x type: 0x%x, div: 0x%x, mhz: 0x%x\n", mem->mem_manuf, mem->mem_type, mem->mpll_mdiv, mem->frequency_mhz); ret = ddr3_mem_ctrl_init(mem, DMC_INTERLEAVE_SIZE); if (ret) { printk(BIOS_ERR, "Memory controller init failed, err: %x\n", ret); while(1); } /* Set up MMU and caches */ mmu_setup_by_mva(CONFIG_SYS_SDRAM_BASE, CONFIG_DRAM_SIZE_MB); initialize_s5p_mshc(); graphics(); entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/coreboot_ram"); printk(BIOS_INFO, "entry is 0x%p, leaving romstage.\n", entry); stage_exit(entry); }
static void setup_memory(struct mem_timings *mem, int is_resume) { printk(BIOS_SPEW, "manufacturer: 0x%x type: 0x%x, div: 0x%x, mhz: %d\n", mem->mem_manuf, mem->mem_type, mem->mpll_mdiv, mem->frequency_mhz); /* FIXME Currently memory initialization with mem_reset on normal boot * will cause resume to fail (even if we don't do mem_reset on resume), * and the workaround is to temporarily always enable "is_resume". * This should be removed when the root cause of resume issue is found. */ is_resume = 1; if (ddr3_mem_ctrl_init(mem, DMC_INTERLEAVE_SIZE, !is_resume)) { die("Failed to initialize memory controller.\n"); } }
void mem_ctrl_init(int reset) { struct spl_machine_param *param = spl_get_machine_params(); struct mem_timings *mem; int ret; mem = clock_get_mem_timings(); /* If there are any other memory variant, add their init call below */ if (param->mem_type == DDR_MODE_DDR3) { ret = ddr3_mem_ctrl_init(mem, param->mem_iv_size, reset); if (ret) { /* will hang if failed to init memory control */ while (1) ; } } else { /* will hang if unknow memory type */ while (1) ; } }