Lines Matching refs:dram
365 static void phy_softreset(struct dram_info *dram) in phy_softreset() argument
367 struct rk322x_ddr_phy *ddr_phy = dram->chan[0].phy; in phy_softreset()
368 struct rk322x_grf *grf = dram->grf; in phy_softreset()
380 static void set_bw(struct dram_info *dram, u32 bw) in set_bw() argument
382 struct rk322x_ddr_pctl *pctl = dram->chan[0].pctl; in set_bw()
383 struct rk322x_ddr_phy *ddr_phy = dram->chan[0].phy; in set_bw()
384 struct rk322x_grf *grf = dram->grf; in set_bw()
579 static void dram_all_config(const struct dram_info *dram, in dram_all_config() argument
597 writel(sys_reg, &dram->grf->os_reg[2]); in dram_all_config()
602 static int dram_cap_detect(struct dram_info *dram, in dram_cap_detect() argument
607 struct rk322x_service_sys *axi_bus = dram->chan[0].msch; in dram_cap_detect()
614 move_to_config_state(dram->chan[0].pctl); in dram_cap_detect()
616 set_bw(dram, 2); in dram_cap_detect()
617 if (data_training(&dram->chan[0]) == 0) { in dram_cap_detect()
621 set_bw(dram, 1); in dram_cap_detect()
622 move_to_lowpower_state(dram->chan[0].pctl); in dram_cap_detect()
623 phy_softreset(dram); in dram_cap_detect()
624 move_to_config_state(dram->chan[0].pctl); in dram_cap_detect()
625 if (data_training(&dram->chan[0])) { in dram_cap_detect()
637 move_to_access_state(dram->chan[0].pctl); in dram_cap_detect()
687 static int sdram_init(struct dram_info *dram, in sdram_init() argument
692 ret = clk_set_rate(&dram->ddr_clk, in sdram_init()
699 phy_pctrl_reset(dram->cru, dram->chan[0].phy); in sdram_init()
700 phy_dll_bypass_set(dram->chan[0].phy, sdram_params->base.ddr_freq); in sdram_init()
701 pctl_cfg(dram->chan[0].pctl, sdram_params, dram->grf); in sdram_init()
702 phy_cfg(&dram->chan[0], sdram_params); in sdram_init()
703 writel(POWER_UP_START, &dram->chan[0].pctl->powctl); in sdram_init()
704 while (!(readl(&dram->chan[0].pctl->powstat) & POWER_UP_DONE)) in sdram_init()
706 memory_init(&dram->chan[0], sdram_params); in sdram_init()
707 move_to_access_state(dram->chan[0].pctl); in sdram_init()
708 ret = dram_cap_detect(dram, sdram_params); in sdram_init()
711 dram_cfg_rbc(&dram->chan[0], sdram_params); in sdram_init()
712 dram_all_config(dram, sdram_params); in sdram_init()