mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: mathieu.anquetin@groupe-cahors.com,
	Sascha Hauer <s.hauer@pengutronix.de>,
	BAREBOX <barebox@lists.infradead.org>
Cc: Fabian Pflug <f.pflug@pengutronix.de>,
	Jonas Rebmann <jre@pengutronix.de>
Subject: Re: [PATCH] ddr: imx9: fix DRAM PLL bypass
Date: Thu, 31 Jul 2025 11:02:34 +0200	[thread overview]
Message-ID: <1edd18f3-5670-4ff2-becc-adbf7b911d8e@pengutronix.de> (raw)
In-Reply-To: <20250718-fix_imx9_ddr_init-v1-1-b52def9e7ee5@groupe-cahors.com>

Hi Mathieu,

Thanks for your patch

On 7/18/25 20:12, Mathieu Anquetin via B4 Relay wrote:
> From: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com>
> 
> On i.MX9, clock selection for DDR PHY is done by setting/clearing bit 0
> of GPR_SHARED2 register.
> 
> This is done using the generic function ccm_shared_gpr_set() which takes
> two arguments, the GPR number and the value to set. However, this
> function did not use the GPR number to calculate the offset of the
> GPR_SHAREDn register to set in the CCM.
> 
> Therefore, it was not possible to enable/disable DRAM PLL bypass
> correctly and this led to hangs when training the DDR PHY with some
> frequencies (like 625MT/s).
> 
> Fixes: e6234f907416 ("ddr: Initial i.MX9 support")
> Signed-off-by: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Sascha is on vacation this month, but I assume he can pick this for the
next release.

Cheers,
Ahmad

> ---
> Some DRAM timing configurations require to change the input clock signal
> and to bypass the DRAM PLL. This is done by setting bit 0 of the
> GPR_SHARED2 register of the CLock Controller Module. However, the
> register offset to set was not calculated correctly, leading to hangs
> during PHY training when PLL bypass was required.
> 
> In particular, this was the case for the configuration setting the FSP
> to 625MT/s.
> ---
>  drivers/ddr/imx/imx9_ddr_init.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ddr/imx/imx9_ddr_init.c b/drivers/ddr/imx/imx9_ddr_init.c
> index cdee18e4ad0e4cee1b13bd2aab4b53ffcb537e49..086827d9b34c49a76426289b707aad6fa474d065 100644
> --- a/drivers/ddr/imx/imx9_ddr_init.c
> +++ b/drivers/ddr/imx/imx9_ddr_init.c
> @@ -352,6 +352,8 @@ static void save_trained_mr12_14(struct dram_cfg_param *cfg, u32 cfg_num, u32 mr
>  
>  #define MHZ(x)        ((x) * 1000000UL)
>  
> +#define SHARED_GPR(n) (0x4800 + ((n) * 0x20))
> +
>  #define SHARED_GPR_DRAM_CLK 2
>  #define SHARED_GPR_DRAM_CLK_SEL_PLL 0
>  #define SHARED_GPR_DRAM_CLK_SEL_CCM BIT(0)
> @@ -376,7 +378,7 @@ static int dram_pll_init(u32 freq)
>  
>  static void ccm_shared_gpr_set(u32 gpr, u32 val)
>  {
> -	writel(val, IOMEM(MX9_CCM_BASE_ADDR + 0x4800));
> +	writel(val, IOMEM(MX9_CCM_BASE_ADDR + SHARED_GPR(gpr)));
>  }
>  
>  #define DRAM_ALT_CLK_ROOT	76
> 
> ---
> base-commit: f49c873d7ec78a2df7bd3c7a86f5372fb1666517
> change-id: 20250718-fix_imx9_ddr_init-6ccf9db195be
> 
> Best regards,

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




  parent reply	other threads:[~2025-07-31  9:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-18 18:12 Mathieu Anquetin via B4 Relay
2025-07-31  8:40 ` ANQUETIN Mathieu
2025-07-31  9:02 ` Ahmad Fatoum [this message]
2025-08-05  9:14 ` Sascha Hauer

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=1edd18f3-5670-4ff2-becc-adbf7b911d8e@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=f.pflug@pengutronix.de \
    --cc=jre@pengutronix.de \
    --cc=mathieu.anquetin@groupe-cahors.com \
    --cc=s.hauer@pengutronix.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