Lines Matching refs:ddrss
61 #define ddrss_ctl_writel(off, val) ddrss_writel(ddrss->ddrss_ctl_cfg, off, val)
62 #define ddrss_ctl_readl(off) ddrss_readl(ddrss->ddrss_ctl_cfg, off)
64 static inline u32 am654_ddrss_get_type(struct am654_ddrss_desc *ddrss) in am654_ddrss_get_type() argument
78 static int am654_ddrss_dram_wait_for_init_complt(struct am654_ddrss_desc *ddrss) in am654_ddrss_dram_wait_for_init_complt() argument
82 val = am654_ddrss_get_type(ddrss); in am654_ddrss_dram_wait_for_init_complt()
98 ddrss->ddrss_ctl_cfg + DDRSS_DDRCTL_STAT, LDELAY)) in am654_ddrss_dram_wait_for_init_complt()
108 static void am654_ddrss_ctrl_configuration(struct am654_ddrss_desc *ddrss) in am654_ddrss_ctrl_configuration() argument
110 struct ddrss_ddrctl_timing_params *tmg = &ddrss->params.ctl_timing; in am654_ddrss_ctrl_configuration()
111 struct ddrss_ddrctl_reg_params *reg = &ddrss->params.ctl_reg; in am654_ddrss_ctrl_configuration()
112 struct ddrss_ddrctl_ecc_params *ecc = &ddrss->params.ctl_ecc; in am654_ddrss_ctrl_configuration()
113 struct ddrss_ddrctl_crc_params *crc = &ddrss->params.ctl_crc; in am654_ddrss_ctrl_configuration()
114 struct ddrss_ddrctl_map_params *map = &ddrss->params.ctl_map; in am654_ddrss_ctrl_configuration()
185 ddrss_writel(ddrss->ddrss_phy_cfg, off, val); \
191 u32 val = ddrss_readl(ddrss->ddrss_phy_cfg, off); \
200 static void am654_ddrss_phy_configuration(struct am654_ddrss_desc *ddrss) in am654_ddrss_phy_configuration() argument
202 struct ddrss_ddrphy_ioctl_params *ioctl = &ddrss->params.phy_ioctl; in am654_ddrss_phy_configuration()
203 struct ddrss_ddrphy_timing_params *tmg = &ddrss->params.phy_timing; in am654_ddrss_phy_configuration()
204 struct ddrss_ddrphy_ctrl_params *ctrl = &ddrss->params.phy_ctrl; in am654_ddrss_phy_configuration()
205 struct ddrss_ddrphy_cfg_params *cfg = &ddrss->params.phy_cfg; in am654_ddrss_phy_configuration()
206 struct ddrss_ddrphy_zq_params *zq = &ddrss->params.phy_zq; in am654_ddrss_phy_configuration()
307 static int __phy_builtin_init_routine(struct am654_ddrss_desc *ddrss, in __phy_builtin_init_routine() argument
318 ddrss->ddrss_phy_cfg + DDRSS_DDRPHY_PGSR0, LDELAY)) in __phy_builtin_init_routine()
331 int write_leveling(struct am654_ddrss_desc *ddrss) in write_leveling() argument
337 ret = __phy_builtin_init_routine(ddrss, PIR_WL_MASK, PGSR0_WLDONE_MASK, in write_leveling()
352 int read_dqs_training(struct am654_ddrss_desc *ddrss) in read_dqs_training() argument
358 ret = __phy_builtin_init_routine(ddrss, PIR_QSGATE_MASK, in read_dqs_training()
373 int dqs2dq_training(struct am654_ddrss_desc *ddrss) in dqs2dq_training() argument
379 ret = __phy_builtin_init_routine(ddrss, PIR_DQS2DQ_MASK, in dqs2dq_training()
396 int write_leveling_adjustment(struct am654_ddrss_desc *ddrss) in write_leveling_adjustment() argument
401 ret = __phy_builtin_init_routine(ddrss, PIR_WLADJ_MASK, in write_leveling_adjustment()
415 int rest_training(struct am654_ddrss_desc *ddrss) in rest_training() argument
422 ret = __phy_builtin_init_routine(ddrss, PIR_RDDSKW_MASK, in rest_training()
433 ret = __phy_builtin_init_routine(ddrss, PIR_WRDSKW_MASK, in rest_training()
444 ret = __phy_builtin_init_routine(ddrss, PIR_RDEYE_MASK, in rest_training()
457 ret = __phy_builtin_init_routine(ddrss, PIR_WREYE_MASK, in rest_training()
471 int VREF_training(struct am654_ddrss_desc *ddrss) in VREF_training() argument
475 ret = __phy_builtin_init_routine(ddrss, PIR_VREF_MASK, PGSR0_VDONE_MASK, in VREF_training()
487 int enable_dqs_pd(struct am654_ddrss_desc *ddrss) in enable_dqs_pd() argument
510 int disable_dqs_pd(struct am654_ddrss_desc *ddrss) in disable_dqs_pd() argument
530 int cleanup_training(struct am654_ddrss_desc *ddrss) in cleanup_training() argument
626 static int am654_ddrss_init(struct am654_ddrss_desc *ddrss) in am654_ddrss_init() argument
630 struct ddrss_ss_reg_params *reg = &ddrss->params.ss_reg; in am654_ddrss_init()
634 debug("%s(ddrss=%p)\n", __func__, ddrss); in am654_ddrss_init()
636 ddrss_writel(ddrss->ddrss_ss_cfg, DDRSS_V2H_CTL_REG, in am654_ddrss_init()
639 am654_ddrss_ctrl_configuration(ddrss); in am654_ddrss_init()
642 clrbits_le32(ddrss->ddrss_ss_cfg + DDRSS_SS_CTL_REG, in am654_ddrss_init()
645 am654_ddrss_phy_configuration(ddrss); in am654_ddrss_init()
648 ret = __phy_builtin_init_routine(ddrss, PIR_PHY_INIT, 0x1, 0); in am654_ddrss_init()
650 dev_err(ddrss->dev, "PHY initialization failed %d\n", ret); in am654_ddrss_init()
654 ret = __phy_builtin_init_routine(ddrss, PIR_DRAM_INIT, in am654_ddrss_init()
657 dev_err(ddrss->dev, "DRAM initialization failed %d\n", ret); in am654_ddrss_init()
661 ret = am654_ddrss_dram_wait_for_init_complt(ddrss); in am654_ddrss_init()
668 val = am654_ddrss_get_type(ddrss); in am654_ddrss_init()
673 ret = __phy_builtin_init_routine(ddrss, PIR_DRAM_INIT, in am654_ddrss_init()
676 dev_err(ddrss->dev, "DRAM initialization failed %d\n", in am654_ddrss_init()
682 ret = __phy_builtin_init_routine(ddrss, PIR_DRAM_INIT, in am654_ddrss_init()
685 dev_err(ddrss->dev, "DRAM initialization failed %d\n", in am654_ddrss_init()
690 ret = am654_ddrss_dram_wait_for_init_complt(ddrss); in am654_ddrss_init()
697 ret = write_leveling(ddrss); in am654_ddrss_init()
701 ret = enable_dqs_pd(ddrss); in am654_ddrss_init()
705 ret = read_dqs_training(ddrss); in am654_ddrss_init()
709 ret = disable_dqs_pd(ddrss); in am654_ddrss_init()
713 ret = dqs2dq_training(ddrss); in am654_ddrss_init()
717 ret = write_leveling_adjustment(ddrss); in am654_ddrss_init()
721 ret = rest_training(ddrss); in am654_ddrss_init()
725 ret = VREF_training(ddrss); in am654_ddrss_init()
736 ret = __phy_builtin_init_routine(ddrss, PIR_DRAM_INIT, in am654_ddrss_init()
739 dev_err(ddrss->dev, "DRAM initialization failed %d\n", in am654_ddrss_init()
744 ret = am654_ddrss_dram_wait_for_init_complt(ddrss); in am654_ddrss_init()
751 ret = write_leveling(ddrss); in am654_ddrss_init()
755 ret = read_dqs_training(ddrss); in am654_ddrss_init()
759 ret = write_leveling_adjustment(ddrss); in am654_ddrss_init()
763 ret = rest_training(ddrss); in am654_ddrss_init()
767 ret = VREF_training(ddrss); in am654_ddrss_init()
777 ret = __phy_builtin_init_routine(ddrss, PIR_DRAM_INIT, in am654_ddrss_init()
780 dev_err(ddrss->dev, "DRAM initialization failed %d\n", in am654_ddrss_init()
785 ret = am654_ddrss_dram_wait_for_init_complt(ddrss); in am654_ddrss_init()
792 ret = write_leveling(ddrss); in am654_ddrss_init()
796 ret = enable_dqs_pd(ddrss); in am654_ddrss_init()
800 ret = read_dqs_training(ddrss); in am654_ddrss_init()
804 ret = disable_dqs_pd(ddrss); in am654_ddrss_init()
808 ret = write_leveling_adjustment(ddrss); in am654_ddrss_init()
812 ret = rest_training(ddrss); in am654_ddrss_init()
823 ret = cleanup_training(ddrss); in am654_ddrss_init()
848 static int am654_ddrss_power_on(struct am654_ddrss_desc *ddrss) in am654_ddrss_power_on() argument
852 debug("%s(ddrss=%p)\n", __func__, ddrss); in am654_ddrss_power_on()
854 ret = clk_enable(&ddrss->ddrss_clk); in am654_ddrss_power_on()
856 dev_err(ddrss->dev, "clk_enable() failed: %d\n", ret); in am654_ddrss_power_on()
860 ret = power_domain_on(&ddrss->ddrcfg_pwrdmn); in am654_ddrss_power_on()
862 dev_err(ddrss->dev, "power_domain_on() failed: %d\n", ret); in am654_ddrss_power_on()
866 ret = power_domain_on(&ddrss->ddrdata_pwrdmn); in am654_ddrss_power_on()
868 dev_err(ddrss->dev, "power_domain_on() failed: %d\n", ret); in am654_ddrss_power_on()
874 device_get_supply_regulator(ddrss->dev, "vtt-supply", in am654_ddrss_power_on()
875 &ddrss->vtt_supply); in am654_ddrss_power_on()
876 ret = regulator_set_value(ddrss->vtt_supply, 3300000); in am654_ddrss_power_on()
893 struct am654_ddrss_desc *ddrss = dev_get_priv(dev); in am654_ddrss_ofdata_to_priv() local
899 ret = clk_get_by_index(dev, 0, &ddrss->ddrss_clk); in am654_ddrss_ofdata_to_priv()
905 ret = power_domain_get_by_index(dev, &ddrss->ddrcfg_pwrdmn, 0); in am654_ddrss_ofdata_to_priv()
911 ret = power_domain_get_by_index(dev, &ddrss->ddrdata_pwrdmn, 1); in am654_ddrss_ofdata_to_priv()
922 ddrss->ddrss_ss_cfg = (void *)reg; in am654_ddrss_ofdata_to_priv()
929 ddrss->ddrss_ctl_cfg = (void *)reg; in am654_ddrss_ofdata_to_priv()
936 ddrss->ddrss_phy_cfg = (void *)reg; in am654_ddrss_ofdata_to_priv()
939 (u32 *)&ddrss->params.ss_reg, in am654_ddrss_ofdata_to_priv()
940 sizeof(ddrss->params.ss_reg) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
947 (u32 *)&ddrss->params.ctl_reg, in am654_ddrss_ofdata_to_priv()
948 sizeof(ddrss->params.ctl_reg) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
955 (u32 *)&ddrss->params.ctl_crc, in am654_ddrss_ofdata_to_priv()
956 sizeof(ddrss->params.ctl_crc) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
963 (u32 *)&ddrss->params.ctl_ecc, in am654_ddrss_ofdata_to_priv()
964 sizeof(ddrss->params.ctl_ecc) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
971 (u32 *)&ddrss->params.ctl_map, in am654_ddrss_ofdata_to_priv()
972 sizeof(ddrss->params.ctl_map) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
979 (u32 *)&ddrss->params.ctl_pwr, in am654_ddrss_ofdata_to_priv()
980 sizeof(ddrss->params.ctl_pwr) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
987 (u32 *)&ddrss->params.ctl_timing, in am654_ddrss_ofdata_to_priv()
988 sizeof(ddrss->params.ctl_timing) / in am654_ddrss_ofdata_to_priv()
996 (u32 *)&ddrss->params.phy_cfg, in am654_ddrss_ofdata_to_priv()
997 sizeof(ddrss->params.phy_cfg) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
1004 (u32 *)&ddrss->params.phy_ctrl, in am654_ddrss_ofdata_to_priv()
1005 sizeof(ddrss->params.phy_ctrl) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
1012 (u32 *)&ddrss->params.phy_ioctl, in am654_ddrss_ofdata_to_priv()
1013 sizeof(ddrss->params.phy_ioctl) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
1020 (u32 *)&ddrss->params.phy_timing, in am654_ddrss_ofdata_to_priv()
1021 sizeof(ddrss->params.phy_timing) / in am654_ddrss_ofdata_to_priv()
1028 ret = dev_read_u32_array(dev, "ti,phy-zq", (u32 *)&ddrss->params.phy_zq, in am654_ddrss_ofdata_to_priv()
1029 sizeof(ddrss->params.phy_zq) / sizeof(u32)); in am654_ddrss_ofdata_to_priv()
1046 struct am654_ddrss_desc *ddrss = dev_get_priv(dev); in am654_ddrss_probe() local
1055 ddrss->dev = dev; in am654_ddrss_probe()
1056 ret = am654_ddrss_power_on(ddrss); in am654_ddrss_probe()
1060 ret = am654_ddrss_init(ddrss); in am654_ddrss_probe()