public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Eric Nelson <eric@nelint.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 3/4] mx6: ddr: add routine to return DDR calibration data
Date: Sun, 30 Oct 2016 16:33:49 -0700	[thread overview]
Message-ID: <1477870430-18756-4-git-send-email-eric@nelint.com> (raw)
In-Reply-To: <1477870430-18756-1-git-send-email-eric@nelint.com>

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>
---
Commit message expanded in V2

 arch/arm/cpu/armv7/mx6/ddr.c            | 23 +++++++++++++++++++++++
 arch/arm/include/asm/arch-mx6/mx6-ddr.h |  2 ++
 2 files changed, 25 insertions(+)

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)
diff --git a/arch/arm/include/asm/arch-mx6/mx6-ddr.h b/arch/arm/include/asm/arch-mx6/mx6-ddr.h
index cd5bc97..12454fa 100644
--- a/arch/arm/include/asm/arch-mx6/mx6-ddr.h
+++ b/arch/arm/include/asm/arch-mx6/mx6-ddr.h
@@ -461,6 +461,8 @@ void mx6sl_dram_iocfg(unsigned width,
 #if defined(CONFIG_MX6QDL) || defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
 int mmdc_do_write_level_calibration(struct mx6_ddr_sysinfo const *sysinfo);
 int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo);
+void mmdc_read_calibration(struct mx6_ddr_sysinfo const *sysinfo,
+                           struct mx6_mmdc_calibration *calib);
 #endif
 
 /* configure mx6 mmdc registers */
-- 
2.7.4

  parent reply	other threads:[~2016-10-30 23:33 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-30 17:18 [U-Boot] [PATCH 0/3] mx6: ddr: updates for dynamic DDR calibration Eric Nelson
2016-10-30 17:19 ` [U-Boot] [PATCH 1/3] mx6: ddr: allow 32 cycles for DQS gating calibration Eric Nelson
2016-10-30 17:27   ` Marek Vasut
2016-10-30 17:19 ` [U-Boot] [PATCH 2/3] mx6: ddr: pass mx6_ddr_sysinfo to calibration routines Eric Nelson
2016-10-30 17:29   ` Marek Vasut
2016-10-30 17:19 ` [U-Boot] [PATCH 3/3] mx6: ddr: add routine to return DDR calibration data Eric Nelson
2016-10-30 17:30   ` Marek Vasut
2016-10-30 19:14     ` Eric Nelson
2016-10-30 20:02       ` Marek Vasut
2016-10-30 19:20   ` [U-Boot] [PATCH] ARM: mx6: ddr: use Kconfig for inclusion of DDR calibration routines Eric Nelson
2016-10-30 20:03     ` Marek Vasut
2016-10-30 23:10       ` Eric Nelson
2016-10-30 23:33         ` [U-Boot] [PATCH V2 0/4] mx6: ddr: updates for dynamic DDR calibration Eric Nelson
2016-10-30 23:33           ` [U-Boot] [PATCH V2 1/4] mx6: ddr: allow 32 cycles for DQS gating calibration Eric Nelson
2016-10-30 23:33           ` [U-Boot] [PATCH V2 2/4] mx6: ddr: pass mx6_ddr_sysinfo to calibration routines Eric Nelson
2016-10-30 23:33           ` Eric Nelson [this message]
2016-10-30 23:33           ` [U-Boot] [PATCH V2 4/4] ARM: mx6: ddr: use Kconfig for inclusion of DDR " Eric Nelson
2016-11-22 10:59           ` [U-Boot] [PATCH V2 0/4] mx6: ddr: updates for dynamic DDR calibration Christoph Fritz
2016-11-29 16:28           ` Stefano Babic
2016-11-01 20:13         ` [U-Boot] [RFC PATCH 0/9] ARM: imx: mx6: Add virtual mx6memcal board Eric Nelson
2016-11-01 20:13           ` [U-Boot] [RFC PATCH 1/9] mx6: Add board mx6memcal for use in validating DDR Eric Nelson
2017-07-14 14:18             ` Fabio Estevam
2017-07-14 17:58               ` Eric Nelson
2017-07-14 19:01                 ` Fabio Estevam
2017-07-28  2:50                   ` Eric Nelson
2016-11-01 20:13           ` [U-Boot] [RFC PATCH 2/9] mx6memcal: zero values for MPWRDLCTL cause read DQS calibration errors Eric Nelson
2016-11-01 20:13           ` [U-Boot] [RFC PATCH 3/9] mx6memcal: add configuration for SABRE Lite Eric Nelson
2016-11-01 20:13           ` [U-Boot] [RFC PATCH 4/9] mx6memcal: add configuration for Nitrogen6_max board Eric Nelson
2016-11-01 20:13           ` [U-Boot] [RFC PATCH 5/9] mx6memcal: add configuration for tr1x board (i.MX6SL with DDR3) Eric Nelson
2016-11-01 20:13           ` [U-Boot] [RFC PATCH 6/9] mx6memcal: add configuration for Wandboard Solo (512MiB of x32 DDR3) Eric Nelson
2016-11-01 20:13           ` [U-Boot] [RFC PATCH 7/9] mx6memcal: add configuration for Wandboard Quad Eric Nelson
2016-11-01 20:13           ` [U-Boot] [RFC PATCH 8/9] mx6memcal: add configuration for mx6slevk Eric Nelson
2016-11-01 20:13           ` [U-Boot] [RFC PATCH 9/9] mx6memcal: add configuration for warp board (i.MX6SL) Eric Nelson
2016-11-02  2:06           ` [U-Boot] [RFC PATCH 0/3] ARM: imx: mx6: Add plugin support for SPL Eric Nelson
2016-11-02  2:06             ` [U-Boot] [RFC PATCH 1/3] ARM: mx6: preserve Boot ROM stack in SPL Eric Nelson
2016-11-02  2:06             ` [U-Boot] [RFC PATCH 2/3] ARM: mx6: ddr: add plugin-utils placeholder Eric Nelson
2016-11-02  2:06             ` [U-Boot] [RFC PATCH 3/3] ARM: imx: mx6memcal: allow build of combined SPL+U-Boot Eric Nelson
2017-01-18  1:27             ` [U-Boot] [RFC PATCH 0/3] ARM: imx: mx6: Add plugin support for SPL Tim Harvey
2017-01-18 17:05               ` Eric Nelson
2017-01-18 18:49                 ` Tim Harvey
2017-01-18 19:01                   ` Fabio Estevam
2017-01-20 17:40                     ` Tim Harvey
2017-01-27 14:56                       ` Fabio Estevam
2017-01-27 15:25                         ` Otavio Salvador

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477870430-18756-4-git-send-email-eric@nelint.com \
    --to=eric@nelint.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox