Re: [U-Boot] [PATCH 3/3] mx6: ddr: add routine to return DDR calibration data

2016-10-30 Thread Marek Vasut
On 10/30/2016 08:14 PM, Eric Nelson wrote:
> Hi Marek,

Hi!

> On 10/30/2016 10:30 AM, Marek Vasut wrote:
>> On 10/30/2016 06:19 PM, Eric Nelson wrote:
>>> 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.
>>>
>>> Signed-off-by: Eric Nelson 
>>
>> Do you plan to use it or will this be mostly dead code ?
>>
> 
> I plan to use it.
> 
> I'm cleaning things up before (re)sending a patch adding the
> virtual "mx6memcal" board and wanted to push the supporting
> changes in a separate set.

Oh cool, all right.

> I have one more independent patch (4/3?) to send before
> the new board.
> 


-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] mx6: ddr: add routine to return DDR calibration data

2016-10-30 Thread Eric Nelson
Hi Marek,

On 10/30/2016 10:30 AM, Marek Vasut wrote:
> On 10/30/2016 06:19 PM, Eric Nelson wrote:
>> 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.
>>
>> Signed-off-by: Eric Nelson 
> 
> Do you plan to use it or will this be mostly dead code ?
> 

I plan to use it.

I'm cleaning things up before (re)sending a patch adding the
virtual "mx6memcal" board and wanted to push the supporting
changes in a separate set.

I have one more independent patch (4/3?) to send before
the new board.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] mx6: ddr: add routine to return DDR calibration data

2016-10-30 Thread Marek Vasut
On 10/30/2016 06:19 PM, Eric Nelson wrote:
> 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.
> 
> Signed-off-by: Eric Nelson 

Do you plan to use it or will this be mostly dead code ?

> ---
>  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(>mpwldectrl0);
> + calib->p0_mpwldectrl1 = readl(>mpwldectrl1);
> + calib->p0_mpdgctrl0 = readl(>mpdgctrl0);
> + calib->p0_mpdgctrl1 = readl(>mpdgctrl1);
> + calib->p0_mprddlctl = readl(>mprddlctl);
> + calib->p0_mpwrdlctl = readl(>mpwrdlctl);
> +
> + if (sysinfo->dsize == 2) {
> + calib->p1_mpwldectrl0 = readl(>mpwldectrl0);
> + calib->p1_mpwldectrl1 = readl(>mpwldectrl1);
> + calib->p1_mpdgctrl0 = readl(>mpdgctrl0);
> + calib->p1_mpdgctrl1 = readl(>mpdgctrl1);
> + calib->p1_mprddlctl = readl(>mprddlctl);
> + calib->p1_mpwrdlctl = readl(>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 */
> 


-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/3] mx6: ddr: add routine to return DDR calibration data

2016-10-30 Thread Eric Nelson
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.

Signed-off-by: Eric Nelson 
---
 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(>mpwldectrl0);
+   calib->p0_mpwldectrl1 = readl(>mpwldectrl1);
+   calib->p0_mpdgctrl0 = readl(>mpdgctrl0);
+   calib->p0_mpdgctrl1 = readl(>mpdgctrl1);
+   calib->p0_mprddlctl = readl(>mprddlctl);
+   calib->p0_mpwrdlctl = readl(>mpwrdlctl);
+
+   if (sysinfo->dsize == 2) {
+   calib->p1_mpwldectrl0 = readl(>mpwldectrl0);
+   calib->p1_mpwldectrl1 = readl(>mpwldectrl1);
+   calib->p1_mpdgctrl0 = readl(>mpdgctrl0);
+   calib->p1_mpdgctrl1 = readl(>mpdgctrl1);
+   calib->p1_mprddlctl = readl(>mprddlctl);
+   calib->p1_mpwrdlctl = readl(>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

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot