summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv7/mx6/ddr.c
diff options
context:
space:
mode:
authorEric Nelson <eric@nelint.com>2016-10-30 16:33:49 -0700
committerStefano Babic <sbabic@denx.de>2016-11-29 16:40:25 +0100
commit48c7d4379bcf70ce331e441b135cfbf3546dd574 (patch)
tree291d4b4dc6bfd06bf847b2ff6f5e3a202f681bbe /arch/arm/cpu/armv7/mx6/ddr.c
parent7f17fb7400ff091dd48f86977655c6a57d06b17c (diff)
downloadu-boot-imx-48c7d4379bcf70ce331e441b135cfbf3546dd574.zip
u-boot-imx-48c7d4379bcf70ce331e441b135cfbf3546dd574.tar.gz
u-boot-imx-48c7d4379bcf70ce331e441b135cfbf3546dd574.tar.bz2
mx6: ddr: add routine to return DDR calibration data
Add routine mmdc_read_calibration() to return the output of DDR calibration. This can be used for debugging or to aid in construction of static memory configuration. This routine will be used in a subsequent patch set adding a virtual "mx6memcal" board, but could also be useful when gathering statistics during an initial production run. Signed-off-by: Eric Nelson <eric@nelint.com>
Diffstat (limited to 'arch/arm/cpu/armv7/mx6/ddr.c')
-rw-r--r--arch/arm/cpu/armv7/mx6/ddr.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7/mx6/ddr.c b/arch/arm/cpu/armv7/mx6/ddr.c
index 274a0ba..b12fb64 100644
--- a/arch/arm/cpu/armv7/mx6/ddr.c
+++ b/arch/arm/cpu/armv7/mx6/ddr.c
@@ -1501,6 +1501,29 @@ void mx6_ddr3_cfg(const struct mx6_ddr_sysinfo *sysinfo,
mdelay(1);
}
+void mmdc_read_calibration(struct mx6_ddr_sysinfo const *sysinfo,
+ struct mx6_mmdc_calibration *calib)
+{
+ struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR;
+ struct mmdc_p_regs *mmdc1 = (struct mmdc_p_regs *)MMDC_P1_BASE_ADDR;
+
+ calib->p0_mpwldectrl0 = readl(&mmdc0->mpwldectrl0);
+ calib->p0_mpwldectrl1 = readl(&mmdc0->mpwldectrl1);
+ calib->p0_mpdgctrl0 = readl(&mmdc0->mpdgctrl0);
+ calib->p0_mpdgctrl1 = readl(&mmdc0->mpdgctrl1);
+ calib->p0_mprddlctl = readl(&mmdc0->mprddlctl);
+ calib->p0_mpwrdlctl = readl(&mmdc0->mpwrdlctl);
+
+ if (sysinfo->dsize == 2) {
+ calib->p1_mpwldectrl0 = readl(&mmdc1->mpwldectrl0);
+ calib->p1_mpwldectrl1 = readl(&mmdc1->mpwldectrl1);
+ calib->p1_mpdgctrl0 = readl(&mmdc1->mpdgctrl0);
+ calib->p1_mpdgctrl1 = readl(&mmdc1->mpdgctrl1);
+ calib->p1_mprddlctl = readl(&mmdc1->mprddlctl);
+ calib->p1_mpwrdlctl = readl(&mmdc1->mpwrdlctl);
+ }
+}
+
void mx6_dram_cfg(const struct mx6_ddr_sysinfo *sysinfo,
const struct mx6_mmdc_calibration *calib,
const void *ddr_cfg)