tegra132: Add LPDDR3 SDRAM init in coreboot.
Expanded sdram.c to add support for LPDDR3 init. This code can be used with matching BCT .inc files to have LPDDR3 SDRAM initialized by coreboot instead of the T132 BootROM. BUG=chrome-os-partner:29921 BUG=chrome-os-partner:31031 BRANCH=None TEST=Built for rush and rush_ryu. Change-Id: I53801d9399dbf67fd86d0a2521174f0668567620 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 60e130c47c1894925a12f251af5b83a1fa144d57 Original-Change-Id: I6bcffcd22d2e4f8da6d729b6757714657f3f6735 Original-Signed-off-by: Tom Warren <twarren@nvidia.com> Original-Reviewed-on: https://chromium-review.googlesource.com/214753 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/9029 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
719b7880b6
commit
752184fd12
|
@ -475,7 +475,10 @@ static void sdram_set_clock_enable_signal(const struct sdram_params *param,
|
||||||
(param->EmcDevSelect << EMC_NOP_NOP_DEV_SELECTN_SHIFT)),
|
(param->EmcDevSelect << EMC_NOP_NOP_DEV_SELECTN_SHIFT)),
|
||||||
®s->nop,
|
®s->nop,
|
||||||
EMC_NOP_NOP_CMD_MASK | EMC_NOP_NOP_DEV_SELECTN_MASK);
|
EMC_NOP_NOP_CMD_MASK | EMC_NOP_NOP_DEV_SELECTN_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sdram_init_ddr3(const struct sdram_params *param, struct tegra_emc_regs *regs)
|
||||||
|
{
|
||||||
/* Write mode registers */
|
/* Write mode registers */
|
||||||
writel(param->EmcEmrs2, ®s->emrs2);
|
writel(param->EmcEmrs2, ®s->emrs2);
|
||||||
writel(param->EmcEmrs3, ®s->emrs3);
|
writel(param->EmcEmrs3, ®s->emrs3);
|
||||||
|
@ -483,7 +486,44 @@ static void sdram_set_clock_enable_signal(const struct sdram_params *param,
|
||||||
writel(param->EmcMrs, ®s->mrs);
|
writel(param->EmcMrs, ®s->mrs);
|
||||||
|
|
||||||
if (param->EmcExtraModeRegWriteEnable) {
|
if (param->EmcExtraModeRegWriteEnable) {
|
||||||
writel(param->EmcMrwExtra, ®s->mrs);
|
writel(param->EmcMrsExtra, ®s->mrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
writel(param->EmcZcalInitDev0, ®s->zq_cal);
|
||||||
|
udelay(param->EmcZcalInitWait);
|
||||||
|
|
||||||
|
if ((param->EmcDevSelect & 2) == 0) {
|
||||||
|
writel(param->EmcZcalInitDev1, ®s->zq_cal);
|
||||||
|
udelay(param->EmcZcalInitWait);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sdram_init_lpddr3(const struct sdram_params *param, struct tegra_emc_regs *regs)
|
||||||
|
{
|
||||||
|
/* Precharge all banks. DEV_SELECTN = 0 => Select all devices */
|
||||||
|
writel(((param->EmcDevSelect << EMC_REF_DEV_SELECTN_SHIFT) | 1), ®s->pre);
|
||||||
|
|
||||||
|
/* Send Reset MRW command */
|
||||||
|
writel(param->EmcMrwResetCommand, ®s->mrw);
|
||||||
|
udelay(param->EmcMrwResetNInitWait);
|
||||||
|
|
||||||
|
writel(param->EmcZcalInitDev0, ®s->mrw);
|
||||||
|
udelay(param->EmcZcalInitWait);
|
||||||
|
|
||||||
|
if ((param->EmcDevSelect & 2) == 0)
|
||||||
|
{
|
||||||
|
writel(param->EmcZcalInitDev1, ®s->mrw);
|
||||||
|
udelay(param->EmcZcalInitWait);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write mode registers */
|
||||||
|
writel(param->EmcMrw2, ®s->mrw2);
|
||||||
|
writel(param->EmcMrw1, ®s->mrw);
|
||||||
|
writel(param->EmcMrw3, ®s->mrw3);
|
||||||
|
writel(param->EmcMrw4, ®s->mrw4);
|
||||||
|
|
||||||
|
if (param->EmcExtraModeRegWriteEnable) {
|
||||||
|
writel(param->EmcMrwExtra, ®s->mrw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,14 +533,12 @@ static void sdram_init_zq_calibration(const struct sdram_params *param,
|
||||||
if ((param->EmcZcalWarmColdBootEnables &
|
if ((param->EmcZcalWarmColdBootEnables &
|
||||||
EMC_ZCAL_WARM_COLD_BOOT_ENABLES_COLDBOOT_MASK) == 1) {
|
EMC_ZCAL_WARM_COLD_BOOT_ENABLES_COLDBOOT_MASK) == 1) {
|
||||||
/* Need to initialize ZCAL on coldboot. */
|
/* Need to initialize ZCAL on coldboot. */
|
||||||
writel(param->EmcZcalInitDev0, ®s->zq_cal);
|
if (param->MemoryType == NvBootMemoryType_Ddr3)
|
||||||
udelay(param->EmcZcalInitWait);
|
sdram_init_ddr3(param, regs);
|
||||||
|
else if (param->MemoryType == NvBootMemoryType_LpDdr2)
|
||||||
if ((param->EmcDevSelect & 2) == 0) {
|
sdram_init_lpddr3(param, regs);
|
||||||
writel(param->EmcZcalInitDev1, ®s->zq_cal);
|
|
||||||
udelay(param->EmcZcalInitWait);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
/* Wait for DLL stablization time even without ZCAL */
|
||||||
udelay(param->EmcZcalInitWait);
|
udelay(param->EmcZcalInitWait);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -573,7 +611,8 @@ void sdram_init(const struct sdram_params *param)
|
||||||
param->MemoryType, clock_get_pll_input_khz() *
|
param->MemoryType, clock_get_pll_input_khz() *
|
||||||
param->PllMFeedbackDivider / param->PllMInputDivider /
|
param->PllMFeedbackDivider / param->PllMInputDivider /
|
||||||
(1 + param->PllMSelectDiv2));
|
(1 + param->PllMSelectDiv2));
|
||||||
if (param->MemoryType != NvBootMemoryType_Ddr3)
|
if (param->MemoryType != NvBootMemoryType_Ddr3 &&
|
||||||
|
param->MemoryType != NvBootMemoryType_LpDdr2)
|
||||||
die("Unsupported memory type!\n");
|
die("Unsupported memory type!\n");
|
||||||
|
|
||||||
sdram_configure_pmc(param, pmc);
|
sdram_configure_pmc(param, pmc);
|
||||||
|
|
Loading…
Reference in New Issue