Lines Matching refs:ddrss

60 #define ddrss_ctl_writel(off, val) ddrss_writel(ddrss->ddrss_ctl_cfg, off, val)
61 #define ddrss_ctl_readl(off) ddrss_readl(ddrss->ddrss_ctl_cfg, off)
63 static inline u32 am654_ddrss_get_type(struct am654_ddrss_desc *ddrss) in am654_ddrss_get_type() argument
77 static int am654_ddrss_dram_wait_for_init_complt(struct am654_ddrss_desc *ddrss) in am654_ddrss_dram_wait_for_init_complt() argument
81 val = am654_ddrss_get_type(ddrss); in am654_ddrss_dram_wait_for_init_complt()
97 ddrss->ddrss_ctl_cfg + DDRSS_DDRCTL_STAT, LDELAY)) in am654_ddrss_dram_wait_for_init_complt()
107 static void am654_ddrss_ctrl_configuration(struct am654_ddrss_desc *ddrss) in am654_ddrss_ctrl_configuration() argument
109 struct ddrss_ddrctl_timing_params *tmg = &ddrss->params.ctl_timing; in am654_ddrss_ctrl_configuration()
110 struct ddrss_ddrctl_reg_params *reg = &ddrss->params.ctl_reg; in am654_ddrss_ctrl_configuration()
111 struct ddrss_ddrctl_ecc_params *ecc = &ddrss->params.ctl_ecc; in am654_ddrss_ctrl_configuration()
112 struct ddrss_ddrctl_crc_params *crc = &ddrss->params.ctl_crc; in am654_ddrss_ctrl_configuration()
113 struct ddrss_ddrctl_map_params *map = &ddrss->params.ctl_map; in am654_ddrss_ctrl_configuration()
182 ddrss_writel(ddrss->ddrss_phy_cfg, off, val); \
188 u32 val = ddrss_readl(ddrss->ddrss_phy_cfg, off); \
197 static void am654_ddrss_phy_configuration(struct am654_ddrss_desc *ddrss) in am654_ddrss_phy_configuration() argument
199 struct ddrss_ddrphy_ioctl_params *ioctl = &ddrss->params.phy_ioctl; in am654_ddrss_phy_configuration()
200 struct ddrss_ddrphy_timing_params *tmg = &ddrss->params.phy_timing; in am654_ddrss_phy_configuration()
201 struct ddrss_ddrphy_ctrl_params *ctrl = &ddrss->params.phy_ctrl; in am654_ddrss_phy_configuration()
202 struct ddrss_ddrphy_cfg_params *cfg = &ddrss->params.phy_cfg; in am654_ddrss_phy_configuration()
203 struct ddrss_ddrphy_zq_params *zq = &ddrss->params.phy_zq; in am654_ddrss_phy_configuration()
291 static int __phy_builtin_init_routine(struct am654_ddrss_desc *ddrss, in __phy_builtin_init_routine() argument
302 ddrss->ddrss_phy_cfg + DDRSS_DDRPHY_PGSR0, LDELAY)) in __phy_builtin_init_routine()
315 int write_leveling(struct am654_ddrss_desc *ddrss) in write_leveling() argument
321 ret = __phy_builtin_init_routine(ddrss, PIR_WL_MASK, PGSR0_WLDONE_MASK, in write_leveling()
336 int read_dqs_training(struct am654_ddrss_desc *ddrss) in read_dqs_training() argument
342 ret = __phy_builtin_init_routine(ddrss, PIR_QSGATE_MASK, in read_dqs_training()
357 int rest_training(struct am654_ddrss_desc *ddrss) in rest_training() argument
366 ret = __phy_builtin_init_routine(ddrss, PIR_WLADJ_MASK, in rest_training()
379 ret = __phy_builtin_init_routine(ddrss, PIR_RDDSKW_MASK, in rest_training()
390 ret = __phy_builtin_init_routine(ddrss, PIR_WRDSKW_MASK, in rest_training()
401 ret = __phy_builtin_init_routine(ddrss, PIR_RDEYE_MASK, in rest_training()
414 ret = __phy_builtin_init_routine(ddrss, PIR_WREYE_MASK, in rest_training()
427 ret = __phy_builtin_init_routine(ddrss, PIR_VREF_MASK, PGSR0_VDONE_MASK, in rest_training()
528 static int am654_ddrss_init(struct am654_ddrss_desc *ddrss) in am654_ddrss_init() argument
532 debug("%s(ddrss=%p)\n", __func__, ddrss); in am654_ddrss_init()
534 ddrss_writel(ddrss->ddrss_ss_cfg, DDRSS_V2H_CTL_REG, 0x000073FF); in am654_ddrss_init()
536 am654_ddrss_ctrl_configuration(ddrss); in am654_ddrss_init()
539 clrbits_le32(ddrss->ddrss_ss_cfg + DDRSS_SS_CTL_REG, in am654_ddrss_init()
542 am654_ddrss_phy_configuration(ddrss); in am654_ddrss_init()
544 ret = __phy_builtin_init_routine(ddrss, PIR_PHY_INIT, 0x1, 0); in am654_ddrss_init()
546 dev_err(ddrss->dev, "PHY initialization failed %d\n", ret); in am654_ddrss_init()
550 ret = __phy_builtin_init_routine(ddrss, PIR_DRAM_INIT, in am654_ddrss_init()
553 dev_err(ddrss->dev, "DRAM initialization failed %d\n", ret); in am654_ddrss_init()
557 ret = am654_ddrss_dram_wait_for_init_complt(ddrss); in am654_ddrss_init()
564 ret = write_leveling(ddrss); in am654_ddrss_init()
568 ret = read_dqs_training(ddrss); in am654_ddrss_init()
572 ret = rest_training(ddrss); in am654_ddrss_init()
595 static int am654_ddrss_power_on(struct am654_ddrss_desc *ddrss) in am654_ddrss_power_on() argument
599 debug("%s(ddrss=%p)\n", __func__, ddrss); in am654_ddrss_power_on()
601 ret = clk_enable(&ddrss->ddrss_clk); in am654_ddrss_power_on()
603 dev_err(ddrss->dev, "clk_enable() failed: %d\n", ret); in am654_ddrss_power_on()
607 ret = power_domain_on(&ddrss->ddrcfg_pwrdmn); in am654_ddrss_power_on()
609 dev_err(ddrss->dev, "power_domain_on() failed: %d\n", ret); in am654_ddrss_power_on()
613 ret = power_domain_on(&ddrss->ddrdata_pwrdmn); in am654_ddrss_power_on()
615 dev_err(ddrss->dev, "power_domain_on() failed: %d\n", ret); in am654_ddrss_power_on()
621 device_get_supply_regulator(ddrss->dev, "vtt-supply", in am654_ddrss_power_on()
622 &ddrss->vtt_supply); in am654_ddrss_power_on()
623 ret = regulator_set_value(ddrss->vtt_supply, 3300000); in am654_ddrss_power_on()
640 struct am654_ddrss_desc *ddrss = dev_get_priv(dev); in am654_ddrss_ofdata_to_priv() local
646 ret = clk_get_by_index(dev, 0, &ddrss->ddrss_clk); in am654_ddrss_ofdata_to_priv()
652 ret = power_domain_get_by_index(dev, &ddrss->ddrcfg_pwrdmn, 0); in am654_ddrss_ofdata_to_priv()
658 ret = power_domain_get_by_index(dev, &ddrss->ddrdata_pwrdmn, 1); in am654_ddrss_ofdata_to_priv()
669 ddrss->ddrss_ss_cfg = (void *)reg; in am654_ddrss_ofdata_to_priv()
676 ddrss->ddrss_ctl_cfg = (void *)reg; in am654_ddrss_ofdata_to_priv()
683 ddrss->ddrss_phy_cfg = (void *)reg; in am654_ddrss_ofdata_to_priv()
686 (u32 *)&ddrss->params.ctl_reg, in am654_ddrss_ofdata_to_priv()
687 sizeof(ddrss->params.ctl_reg) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
694 (u32 *)&ddrss->params.ctl_crc, in am654_ddrss_ofdata_to_priv()
695 sizeof(ddrss->params.ctl_crc) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
702 (u32 *)&ddrss->params.ctl_ecc, in am654_ddrss_ofdata_to_priv()
703 sizeof(ddrss->params.ctl_ecc) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
710 (u32 *)&ddrss->params.ctl_map, in am654_ddrss_ofdata_to_priv()
711 sizeof(ddrss->params.ctl_map) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
718 (u32 *)&ddrss->params.ctl_pwr, in am654_ddrss_ofdata_to_priv()
719 sizeof(ddrss->params.ctl_pwr) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
726 (u32 *)&ddrss->params.ctl_timing, in am654_ddrss_ofdata_to_priv()
727 sizeof(ddrss->params.ctl_timing) / in am654_ddrss_ofdata_to_priv()
735 (u32 *)&ddrss->params.phy_cfg, in am654_ddrss_ofdata_to_priv()
736 sizeof(ddrss->params.phy_cfg) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
743 (u32 *)&ddrss->params.phy_ctrl, in am654_ddrss_ofdata_to_priv()
744 sizeof(ddrss->params.phy_ctrl) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
751 (u32 *)&ddrss->params.phy_ioctl, in am654_ddrss_ofdata_to_priv()
752 sizeof(ddrss->params.phy_ioctl) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
759 (u32 *)&ddrss->params.phy_timing, in am654_ddrss_ofdata_to_priv()
760 sizeof(ddrss->params.phy_timing) / in am654_ddrss_ofdata_to_priv()
767 ret = dev_read_u32_array(dev, "ti,phy-zq", (u32 *)&ddrss->params.phy_zq, in am654_ddrss_ofdata_to_priv()
768 sizeof(ddrss->params.phy_zq) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
785 struct am654_ddrss_desc *ddrss = dev_get_priv(dev); in am654_ddrss_probe() local
794 ddrss->dev = dev; in am654_ddrss_probe()
795 ret = am654_ddrss_power_on(ddrss); in am654_ddrss_probe()
799 ret = am654_ddrss_init(ddrss); in am654_ddrss_probe()