mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] ddr: imx8m: add comment and print out prior to first DDRC read
Date: Thu,  6 Jul 2023 18:16:40 +0200	[thread overview]
Message-ID: <20230706161640.843682-1-a.fatoum@pengutronix.de> (raw)

If board code low level entry forgets to call imx8m*_early_clock_init
before DRAM setup, write access to DRAM controller will seem to work,
but the first read access will hang the system.

Make debugging this board bring up mistake easier by adding a debug
print along with a comment.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/ddr/imx8m/ddr_init.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/ddr/imx8m/ddr_init.c b/drivers/ddr/imx8m/ddr_init.c
index 944cc3873e0c..9a86280d9c73 100644
--- a/drivers/ddr/imx8m/ddr_init.c
+++ b/drivers/ddr/imx8m/ddr_init.c
@@ -106,7 +106,11 @@ int imx8m_ddr_init(struct dram_timing_info *dram_timing,
 	reg32_write(DDRC_RFSHCTL3(0), 0x0000001);
 	reg32_write(DDRC_PWRCTL(0), 0xa0);
 
-	/* if ddr type is LPDDR4, do it */
+	pr_debug("checking ddr type\n");
+	/*
+	 * below is first read, so if boot hangs here, imx8m*_early_clock_init()
+	 * might not have been called
+	 */
 	tmp = reg32_read(DDRC_MSTR(0));
 	if (tmp & (0x1 << 5) && ddrc_type != DDRC_TYPE_MN)
 		reg32_write(DDRC_DDR_SS_GPR0, 0x01); /* LPDDR4 mode */
-- 
2.39.2




             reply	other threads:[~2023-07-06 16:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06 16:16 Ahmad Fatoum [this message]
2023-07-07  6:25 ` Marco Felsch
2023-07-26 13:38 ` 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=20230706161640.843682-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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