Esempio n. 1
0
static void do_ext_phy_settings_dra7(u32 base, const struct emif_regs *regs)
{
	struct emif_reg_struct *emif = (struct emif_reg_struct *)base;
	u32 *emif_ext_phy_ctrl_base = 0;
	u32 emif_nr;
	const u32 *ext_phy_ctrl_const_regs;
	u32 i, hw_leveling, size;

	emif_nr = (base == EMIF1_BASE) ? 1 : 2;

	hw_leveling = regs->emif_rd_wr_lvl_rmp_ctl >> EMIF_REG_RDWRLVL_EN_SHIFT;

	emif_ext_phy_ctrl_base = (u32 *)&(emif->emif_ddr_ext_phy_ctrl_1);

	emif_get_ext_phy_ctrl_const_regs(emif_nr,
					 &ext_phy_ctrl_const_regs, &size);

	writel(ext_phy_ctrl_const_regs[0], &emif_ext_phy_ctrl_base[0]);
	writel(ext_phy_ctrl_const_regs[0], &emif_ext_phy_ctrl_base[1]);

	if (!hw_leveling) {
		/*
		 * Copy the predefined PHY register values
		 * in case of sw leveling
		 */
		for (i = 1; i < 25; i++) {
			writel(ext_phy_ctrl_const_regs[i],
			       &emif_ext_phy_ctrl_base[i * 2]);
			writel(ext_phy_ctrl_const_regs[i],
			       &emif_ext_phy_ctrl_base[i * 2 + 1]);
		}
	} else {
		/*
		 * Write the init value for HW levling to occur
		 */
		for (i = 21; i < 35; i++) {
			writel(ext_phy_ctrl_const_regs[i],
			       &emif_ext_phy_ctrl_base[i * 2]);
			writel(ext_phy_ctrl_const_regs[i],
			       &emif_ext_phy_ctrl_base[i * 2 + 1]);
		}
	}
}
Esempio n. 2
0
static void do_ext_phy_settings_omap5(u32 base, const struct emif_regs *regs)
{
	u32 *ext_phy_ctrl_base = 0;
	u32 *emif_ext_phy_ctrl_base = 0;
	u32 emif_nr;
	const u32 *ext_phy_ctrl_const_regs;
	u32 i = 0;
	u32 size;

	emif_nr = (base == EMIF1_BASE) ? 1 : 2;

	struct emif_reg_struct *emif = (struct emif_reg_struct *)base;

	ext_phy_ctrl_base = (u32 *) &(regs->emif_ddr_ext_phy_ctrl_1);
	emif_ext_phy_ctrl_base = (u32 *) &(emif->emif_ddr_ext_phy_ctrl_1);

	/* Configure external phy control timing registers */
	for (i = 0; i < EMIF_EXT_PHY_CTRL_TIMING_REG; i++) {
		writel(*ext_phy_ctrl_base, emif_ext_phy_ctrl_base++);
		/* Update shadow registers */
		writel(*ext_phy_ctrl_base++, emif_ext_phy_ctrl_base++);
	}

	/*
	 * external phy 6-24 registers do not change with
	 * ddr frequency
	 */
	emif_get_ext_phy_ctrl_const_regs(emif_nr,
					 &ext_phy_ctrl_const_regs, &size);

	for (i = 0; i < size; i++) {
		writel(ext_phy_ctrl_const_regs[i],
		       emif_ext_phy_ctrl_base++);
		/* Update shadow registers */
		writel(ext_phy_ctrl_const_regs[i],
		       emif_ext_phy_ctrl_base++);
	}
}
Esempio n. 3
0
static void do_ext_phy_settings_dra7(u32 base, const struct emif_regs *regs)
{
	struct emif_reg_struct *emif = (struct emif_reg_struct *)base;
	u32 *emif_ext_phy_ctrl_base = 0;
	u32 emif_nr;
	const u32 *ext_phy_ctrl_const_regs;
	u32 i, hw_leveling, size, phy;

	emif_nr = (base == EMIF1_BASE) ? 1 : 2;

	hw_leveling = regs->emif_rd_wr_lvl_rmp_ctl >> EMIF_REG_RDWRLVL_EN_SHIFT;
	phy = regs->emif_ddr_phy_ctlr_1_init;

	emif_ext_phy_ctrl_base = (u32 *)&(emif->emif_ddr_ext_phy_ctrl_1);

	emif_get_ext_phy_ctrl_const_regs(emif_nr,
					 &ext_phy_ctrl_const_regs, &size);

	writel(ext_phy_ctrl_const_regs[0], &emif_ext_phy_ctrl_base[0]);
	writel(ext_phy_ctrl_const_regs[0], &emif_ext_phy_ctrl_base[1]);

	/*
	 * Copy the predefined PHY register values
	 * if leveling is disabled.
	 */
	if (phy & EMIF_DDR_PHY_CTRL_1_RDLVLGATE_MASK_MASK)
		for (i = 1; i < 6; i++) {
			writel(ext_phy_ctrl_const_regs[i],
			       &emif_ext_phy_ctrl_base[i * 2]);
			writel(ext_phy_ctrl_const_regs[i],
			       &emif_ext_phy_ctrl_base[i * 2 + 1]);
		}

	if (phy & EMIF_DDR_PHY_CTRL_1_RDLVL_MASK_MASK)
		for (i = 6; i < 11; i++) {
			writel(ext_phy_ctrl_const_regs[i],
			       &emif_ext_phy_ctrl_base[i * 2]);
			writel(ext_phy_ctrl_const_regs[i],
			       &emif_ext_phy_ctrl_base[i * 2 + 1]);
		}

	if (phy & EMIF_DDR_PHY_CTRL_1_WRLVL_MASK_MASK)
		for (i = 11; i < 25; i++) {
			writel(ext_phy_ctrl_const_regs[i],
			       &emif_ext_phy_ctrl_base[i * 2]);
			writel(ext_phy_ctrl_const_regs[i],
			       &emif_ext_phy_ctrl_base[i * 2 + 1]);
		}

	if (hw_leveling) {
		/*
		 * Write the init value for HW levling to occur
		 */
		for (i = 21; i < 35; i++) {
			writel(ext_phy_ctrl_const_regs[i],
			       &emif_ext_phy_ctrl_base[i * 2]);
			writel(ext_phy_ctrl_const_regs[i],
			       &emif_ext_phy_ctrl_base[i * 2 + 1]);
		}
	}
}