All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ddr: imx: keep ddrmix_initialized out of .bss
@ 2026-10-29 16:05 Dario Binacchi
  2026-10-29 16:17 ` Frieder Schrempf
  2026-10-29 16:47 ` Emanuele Ghidoli
  0 siblings, 2 replies; 3+ messages in thread
From: Dario Binacchi @ 2026-10-29 16:05 UTC (permalink / raw)
  To: u-boot
  Cc: michael, linux-amarula, Dario Binacchi, Fabio Estevam,
	Frieder Schrempf, NXP i.MX U-Boot Team, Stefano Babic, Tom Rini,
	u-boot

ddr_init() is called from board_init_f(), before .bss is cleared, so
ddrmix_initialized may already be non-zero on the first call. The DDRMIX
cold reset is then run on a DDRMIX that has never been initialized and
the SPL hangs (with DEBUG enabled in ddr_init.c):

  DDRINFO: start DRAM init
  DDRINFO: cold reset the DDRMIX

Move ddrmix_initialized to .data, so that it is zero on the first call.

Fixes: ae03528affd3 ("ddr: imx: Recreate the power-on state before repeating ddr_init()")
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

---

 drivers/ddr/imx/imx8m/ddr_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ddr/imx/imx8m/ddr_init.c b/drivers/ddr/imx/imx8m/ddr_init.c
index b2873ab439d7..154e9d887465 100644
--- a/drivers/ddr/imx/imx8m/ddr_init.c
+++ b/drivers/ddr/imx/imx8m/ddr_init.c
@@ -48,7 +48,7 @@
 #define CCGR_DDRMIX			CCGR_DDR1
 #endif
 
-static bool ddrmix_initialized;
+static bool ddrmix_initialized __section(".data");
 
 static unsigned int g_cdd_rr_max[4];
 static unsigned int g_cdd_rw_max[4];
---
base-commit: 03e45557e1f38a39a0c80fe30483130ff376cf92
branch: imx8m-ddrmix-initialized-data

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ddr: imx: keep ddrmix_initialized out of .bss
  2026-10-29 16:05 [PATCH] ddr: imx: keep ddrmix_initialized out of .bss Dario Binacchi
@ 2026-10-29 16:17 ` Frieder Schrempf
  2026-10-29 16:47 ` Emanuele Ghidoli
  1 sibling, 0 replies; 3+ messages in thread
From: Frieder Schrempf @ 2026-10-29 16:17 UTC (permalink / raw)
  To: Dario Binacchi, u-boot
  Cc: michael, linux-amarula, Fabio Estevam, NXP i.MX U-Boot Team,
	Stefano Babic, Tom Rini, u-boot

Hi Dario,

On 29.10.26 17:05, Dario Binacchi wrote:
> ddr_init() is called from board_init_f(), before .bss is cleared, so
> ddrmix_initialized may already be non-zero on the first call. The DDRMIX
> cold reset is then run on a DDRMIX that has never been initialized and
> the SPL hangs (with DEBUG enabled in ddr_init.c):
> 
>   DDRINFO: start DRAM init
>   DDRINFO: cold reset the DDRMIX
> 
> Move ddrmix_initialized to .data, so that it is zero on the first call.
> 
> Fixes: ae03528affd3 ("ddr: imx: Recreate the power-on state before repeating ddr_init()")
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

This issue didn't show up in my tests on i.MX8MM and i.MX8MP, but it
looks correct to me.

Thanks for fixing this!

Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>

Best regards
Frieder

> 
> ---
> 
>  drivers/ddr/imx/imx8m/ddr_init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ddr/imx/imx8m/ddr_init.c b/drivers/ddr/imx/imx8m/ddr_init.c
> index b2873ab439d7..154e9d887465 100644
> --- a/drivers/ddr/imx/imx8m/ddr_init.c
> +++ b/drivers/ddr/imx/imx8m/ddr_init.c
> @@ -48,7 +48,7 @@
>  #define CCGR_DDRMIX			CCGR_DDR1
>  #endif
>  
> -static bool ddrmix_initialized;
> +static bool ddrmix_initialized __section(".data");
>  
>  static unsigned int g_cdd_rr_max[4];
>  static unsigned int g_cdd_rw_max[4];
> ---
> base-commit: 03e45557e1f38a39a0c80fe30483130ff376cf92
> branch: imx8m-ddrmix-initialized-data
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ddr: imx: keep ddrmix_initialized out of .bss
  2026-10-29 16:05 [PATCH] ddr: imx: keep ddrmix_initialized out of .bss Dario Binacchi
  2026-10-29 16:17 ` Frieder Schrempf
@ 2026-10-29 16:47 ` Emanuele Ghidoli
  1 sibling, 0 replies; 3+ messages in thread
From: Emanuele Ghidoli @ 2026-10-29 16:47 UTC (permalink / raw)
  To: Dario Binacchi, u-boot
  Cc: michael, linux-amarula, Fabio Estevam, Frieder Schrempf,
	NXP i.MX U-Boot Team, Stefano Babic, Tom Rini, u-boot



On 10/29/26 17:05, Dario Binacchi wrote:
> ddr_init() is called from board_init_f(), before .bss is cleared, so
> ddrmix_initialized may already be non-zero on the first call. The DDRMIX
> cold reset is then run on a DDRMIX that has never been initialized and
> the SPL hangs (with DEBUG enabled in ddr_init.c):
> 
>   DDRINFO: start DRAM init
>   DDRINFO: cold reset the DDRMIX
> 
> Move ddrmix_initialized to .data, so that it is zero on the first call.
> 
> Fixes: ae03528affd3 ("ddr: imx: Recreate the power-on state before repeating ddr_init()")
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> 

[...]

3 out of 6 Verdin iMX8M Plus and the SMARC iMX8M Plus SoMs in our CI farm were
hanging in SPL, this patch fixes it.

Thanks!

Emanuele

Reviewed-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Tested-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-29 16:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29 16:05 [PATCH] ddr: imx: keep ddrmix_initialized out of .bss Dario Binacchi
2026-10-29 16:17 ` Frieder Schrempf
2026-10-29 16:47 ` Emanuele Ghidoli

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.