Lines Matching refs:sdram_params
227 struct rk3188_sdram_params *sdram_params, in pctl_cfg() argument
230 copy_to_reg(&pctl->togcnt1u, &sdram_params->pctl_timing.togcnt1u, in pctl_cfg()
231 sizeof(sdram_params->pctl_timing)); in pctl_cfg()
232 switch (sdram_params->base.dramtype) { in pctl_cfg()
234 if (sdram_params->phy_timing.mr[1] & DDR3_DLL_DISABLE) { in pctl_cfg()
235 writel(sdram_params->pctl_timing.tcl - 3, in pctl_cfg()
238 writel(sdram_params->pctl_timing.tcl - 2, in pctl_cfg()
241 writel(sdram_params->pctl_timing.tcwl - 1, in pctl_cfg()
256 struct rk3188_sdram_params *sdram_params) in phy_cfg() argument
260 uint ddr_freq_mhz = sdram_params->base.ddr_freq / 1000000; in phy_cfg()
266 copy_to_reg(&publ->dtpr[0], &sdram_params->phy_timing.dtpr0, in phy_cfg()
267 sizeof(sdram_params->phy_timing)); in phy_cfg()
268 writel(sdram_params->base.noc_timing, &msch->ddrtiming); in phy_cfg()
280 switch (sdram_params->base.dramtype) { in phy_cfg()
287 if (sdram_params->base.odt) { in phy_cfg()
415 struct rk3188_sdram_params *sdram_params) in data_training() argument
428 if (sdram_params->base.dramtype != LPDDR3) in data_training()
430 rank = sdram_params->ch[channel].rank | 1; in data_training()
468 if (sdram_params->base.dramtype != LPDDR3) in data_training()
472 writel(sdram_params->pctl_timing.trefi, &pctl->trefi); in data_training()
519 struct rk3188_sdram_params *sdram_params) in dram_cfg_rbc() argument
523 if (sdram_params->ch[chnum].bk == 3) in dram_cfg_rbc()
529 writel(sdram_params->base.ddrconfig, &chan->msch->ddrconf); in dram_cfg_rbc()
533 struct rk3188_sdram_params *sdram_params) in dram_all_config() argument
538 sys_reg |= sdram_params->base.dramtype << SYS_REG_DDRTYPE_SHIFT; in dram_all_config()
539 sys_reg |= (sdram_params->num_channels - 1) << SYS_REG_NUM_CH_SHIFT; in dram_all_config()
540 for (chan = 0; chan < sdram_params->num_channels; chan++) { in dram_all_config()
542 &sdram_params->ch[chan]; in dram_all_config()
554 dram_cfg_rbc(&dram->chan[chan], chan, sdram_params); in dram_all_config()
556 if (sdram_params->ch[0].rank == 2) in dram_all_config()
565 struct rk3188_sdram_params *sdram_params) in sdram_rank_bw_detect() argument
574 if (data_training(chan, channel, sdram_params) < 0) { in sdram_rank_bw_detect()
585 sdram_params->ch[channel].rank = 1; in sdram_rank_bw_detect()
587 sdram_params->ch[channel].rank << 18); in sdram_rank_bw_detect()
592 sdram_params->ch[channel].bw = 1; in sdram_rank_bw_detect()
594 sdram_params->ch[channel].bw, in sdram_rank_bw_detect()
600 sdram_params->ch[channel].dbw = sdram_params->ch[channel].bw; in sdram_rank_bw_detect()
603 (data_training(chan, channel, sdram_params) < 0)) { in sdram_rank_bw_detect()
604 if (sdram_params->base.dramtype == LPDDR3) { in sdram_rank_bw_detect()
626 struct rk3188_sdram_params *sdram_params) in sdram_col_row_detect() argument
639 (1 << (col + sdram_params->ch[channel].bw - 1)); in sdram_col_row_detect()
650 sdram_params->ch[channel].col = col; in sdram_col_row_detect()
670 sdram_params->ch[channel].cs1_row = row; in sdram_col_row_detect()
671 sdram_params->ch[channel].row_3_4 = 0; in sdram_col_row_detect()
673 sdram_params->ch[channel].cs0_row = row; in sdram_col_row_detect()
680 static int sdram_get_niu_config(struct rk3188_sdram_params *sdram_params) in sdram_get_niu_config() argument
684 row = sdram_params->ch[0].cs0_row; in sdram_get_niu_config()
691 tmp = sdram_params->ch[0].col - 9; in sdram_get_niu_config()
692 tmp -= (sdram_params->ch[0].bw == 2) ? 0 : 1; in sdram_get_niu_config()
703 sdram_params->base.ddrconfig = i; in sdram_get_niu_config()
710 struct rk3188_sdram_params *sdram_params) in sdram_init() argument
716 if ((sdram_params->base.dramtype == DDR3 && in sdram_init()
717 sdram_params->base.ddr_freq > 800000000)) { in sdram_init()
722 ret = clk_set_rate(&dram->ddr_clk, sdram_params->base.ddr_freq); in sdram_init()
734 phy_dll_bypass_set(publ, sdram_params->base.ddr_freq); in sdram_init()
736 dfi_cfg(pctl, sdram_params->base.dramtype); in sdram_init()
738 pctl_cfg(channel, pctl, sdram_params, dram->grf); in sdram_init()
740 phy_cfg(chan, channel, sdram_params); in sdram_init()
748 memory_init(publ, sdram_params->base.dramtype); in sdram_init()
752 sdram_params->ch[channel].bw = 2; in sdram_init()
754 sdram_params->ch[channel].bw, dram->grf); in sdram_init()
761 sdram_params->ch[channel].rank = 2, in sdram_init()
763 (sdram_params->ch[channel].rank | 1) << 18); in sdram_init()
774 sdram_rank_bw_detect(dram, channel, sdram_params); in sdram_init()
776 if (sdram_params->base.dramtype == LPDDR3) { in sdram_init()
785 sdram_params->ch[channel].bk = 3; in sdram_init()
787 ret = sdram_col_row_detect(dram, channel, sdram_params); in sdram_init()
792 ret = sdram_get_niu_config(sdram_params); in sdram_init()
796 dram_all_config(dram, sdram_params); in sdram_init()