All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH 01/12] imx: mx6: ddr: return output of calibration routines
Date: Thu, 23 Jun 2016 01:18:48 +0200	[thread overview]
Message-ID: <576B1CD8.2090206@denx.de> (raw)
In-Reply-To: <1466534502-17233-2-git-send-email-eric@nelint.com>

On 06/21/2016 08:41 PM, Eric Nelson wrote:
> Allow the calibration data from mmdc_do_write_level_calibration
> and mmdc_do_dqs_calibration to be returned to the caller for
> display.
> 
> Signed-off-by: Eric Nelson <eric@nelint.com>

Why don't you create a separate function to read those params ?

> ---
>  arch/arm/cpu/armv7/mx6/ddr.c            | 29 +++++++++++++++++++++++------
>  arch/arm/include/asm/arch-mx6/mx6-ddr.h |  4 ++--
>  2 files changed, 25 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/mx6/ddr.c b/arch/arm/cpu/armv7/mx6/ddr.c
> index 1e7ae28..bde6fe3 100644
> --- a/arch/arm/cpu/armv7/mx6/ddr.c
> +++ b/arch/arm/cpu/armv7/mx6/ddr.c
> @@ -86,7 +86,7 @@ static void modify_dg_result(u32 *reg_st0, u32 *reg_st1, u32 *reg_ctrl)
>  	writel(val_ctrl, reg_ctrl);
>  }
>  
> -int mmdc_do_write_level_calibration(void)
> +int mmdc_do_write_level_calibration(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;
> @@ -195,10 +195,17 @@ int mmdc_do_write_level_calibration(void)
>  	      readl(&mmdc1->mpwldectrl1));
>  
>  	/* We must force a readback of these values, to get them to stick */
> -	readl(&mmdc0->mpwldectrl0);
> -	readl(&mmdc0->mpwldectrl1);
> -	readl(&mmdc1->mpwldectrl0);
> -	readl(&mmdc1->mpwldectrl1);
> +	if (calib) {
> +		calib->p0_mpwldectrl0 = readl(&mmdc0->mpwldectrl0);
> +		calib->p0_mpwldectrl1 = readl(&mmdc0->mpwldectrl1);
> +		calib->p1_mpwldectrl0 = readl(&mmdc1->mpwldectrl0);
> +		calib->p1_mpwldectrl1 = readl(&mmdc1->mpwldectrl1);
> +	} else {
> +		readl(&mmdc0->mpwldectrl0);
> +		readl(&mmdc0->mpwldectrl1);
> +		readl(&mmdc1->mpwldectrl0);
> +		readl(&mmdc1->mpwldectrl1);
> +	}
>  
>  	/* enable DDR logic power down timer: */
>  	setbits_le32(&mmdc0->mdpdc, 0x00005500);
> @@ -212,7 +219,7 @@ int mmdc_do_write_level_calibration(void)
>  	return errors;
>  }
>  
> -int mmdc_do_dqs_calibration(void)
> +int mmdc_do_dqs_calibration(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;
> @@ -548,6 +555,16 @@ int mmdc_do_dqs_calibration(void)
>  
>  	debug("Final do_dqs_calibration error mask: 0x%x\n", errors);
>  
> +	if (calib) {
> +		calib->p0_mpdgctrl0 = readl(&mmdc0->mpdgctrl0);
> +		calib->p0_mpdgctrl1 = readl(&mmdc0->mpdgctrl1);
> +		calib->p1_mpdgctrl0 = readl(&mmdc1->mpdgctrl0);
> +		calib->p1_mpdgctrl1 = readl(&mmdc1->mpdgctrl1);
> +		calib->p0_mprddlctl = readl(&mmdc0->mprddlctl);
> +		calib->p1_mprddlctl = readl(&mmdc1->mprddlctl);
> +		calib->p0_mpwrdlctl = readl(&mmdc0->mpwrdlctl);
> +		calib->p1_mpwrdlctl = readl(&mmdc1->mpwrdlctl);
> +	}
>  	return errors;
>  }
>  #endif
> diff --git a/arch/arm/include/asm/arch-mx6/mx6-ddr.h b/arch/arm/include/asm/arch-mx6/mx6-ddr.h
> index 12c30d2..948862c 100644
> --- a/arch/arm/include/asm/arch-mx6/mx6-ddr.h
> +++ b/arch/arm/include/asm/arch-mx6/mx6-ddr.h
> @@ -457,8 +457,8 @@ void mx6sl_dram_iocfg(unsigned width,
>  		      const struct mx6sl_iomux_grp_regs *);
>  
>  #if defined(CONFIG_MX6QDL) || defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
> -int mmdc_do_write_level_calibration(void);
> -int mmdc_do_dqs_calibration(void);
> +int mmdc_do_write_level_calibration(struct mx6_mmdc_calibration *calib);
> +int mmdc_do_dqs_calibration(struct mx6_mmdc_calibration *calib);
>  #endif
>  
>  /* configure mx6 mmdc registers */
> 


-- 
Best regards,
Marek Vasut

  reply	other threads:[~2016-06-22 23:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-21 18:41 [U-Boot] [RFC PATCH 00/12] imx: mx6: add virtual mx6memcal board Eric Nelson
2016-06-21 18:41 ` [U-Boot] [RFC PATCH 01/12] imx: mx6: ddr: return output of calibration routines Eric Nelson
2016-06-22 23:18   ` Marek Vasut [this message]
2016-06-22 23:52     ` Eric Nelson
2016-06-22 23:57       ` Marek Vasut
2016-06-23  0:18         ` Eric Nelson
2016-06-21 18:41 ` [U-Boot] [RFC PATCH 02/12] novena: supply calibration parameter to DDR " Eric Nelson
2016-06-21 18:41 ` [U-Boot] [RFC PATCH 03/12] imx: mx6: ddr: make calibration optional in config routines Eric Nelson
2016-06-21 18:41 ` [U-Boot] [RFC PATCH 04/12] imx: mx6: ddr: pass sysinfo to calibration routines Eric Nelson
2016-06-21 18:41 ` [U-Boot] [RFC PATCH 05/12] novena: pass mx6_ddr_sysinfo " Eric Nelson
2016-06-21 18:41 ` [U-Boot] [RFC PATCH 06/12] imx: mx6: ddr: use Kconfig for inclusion of DDR calibration Eric Nelson
2016-06-21 18:41 ` [U-Boot] [RFC PATCH 07/12] novena_defconfig: select MX6_DDRCAL Eric Nelson
2016-06-21 18:41 ` [U-Boot] [RFC PATCH 08/12] mx6: Add board mx6memcal for use in validating DDR Eric Nelson
2016-06-21 18:41 ` [U-Boot] [RFC PATCH 09/12] mx6memcal: add configuration mx6memcal_mx6slevk_defconfig Eric Nelson
2016-06-21 18:41 ` [U-Boot] [RFC PATCH 10/12] mx6memcal: add configuration mx6memcal_nitrogen6_max_defconfig Eric Nelson
2016-06-21 18:41 ` [U-Boot] [RFC PATCH 11/12] mx6memcal: add configuration mx6memcal_sabrelite_defconfig Eric Nelson
2016-06-21 18:41 ` [U-Boot] [RFC PATCH 12/12] mx6memcal: add configuration mx6memcal_warpboard_defconfig Eric Nelson
2016-06-21 19:48 ` [U-Boot] i.MX SPL tools (was Re: [RFC PATCH 00/12] imx: mx6: add virtual mx6memcal board) Eric Nelson
2016-06-24 23:26   ` Tom Rini
2016-08-26 15:00 ` [U-Boot] [RFC PATCH 00/12] imx: mx6: add virtual mx6memcal board Tim Harvey
2016-08-26 15:33   ` Eric Nelson
2016-08-26 16:46     ` Fabio Estevam
2016-08-26 20:34     ` Tim Harvey

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=576B1CD8.2090206@denx.de \
    --to=marex@denx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.