From: Jernej Skrabec <jernej.skrabec@gmail.com>
To: jagan@amarulasolutions.com, andre.przywara@arm.com
Cc: trini@konsulko.com, macromorgan@hotmail.com, uwu@icenowy.me,
u-boot@lists.denx.de, linux-sunxi@lists.linux.dev,
Jernej Skrabec <jernej.skrabec@gmail.com>
Subject: [PATCH 1/5] sunxi: h616: Panic if DRAM size is not detected
Date: Fri, 11 Apr 2025 18:14:35 +0200 [thread overview]
Message-ID: <20250411161439.4743-2-jernej.skrabec@gmail.com> (raw)
In-Reply-To: <20250411161439.4743-1-jernej.skrabec@gmail.com>
If colum or row size is not detected, panic instead of continuing. It
won't work anyway and it's better to inform user directly what's wrong
instead of failing later down the road for random reason.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
arch/arm/mach-sunxi/dram_sun50i_h616.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-sunxi/dram_sun50i_h616.c b/arch/arm/mach-sunxi/dram_sun50i_h616.c
index cd9d321a0185..d1768a7e7d3a 100644
--- a/arch/arm/mach-sunxi/dram_sun50i_h616.c
+++ b/arch/arm/mach-sunxi/dram_sun50i_h616.c
@@ -1396,7 +1396,7 @@ static bool mctl_check_pattern(ulong offset)
static void mctl_auto_detect_dram_size(const struct dram_para *para,
struct dram_config *config)
{
- unsigned int shift, cols, rows;
+ unsigned int shift, cols, rows, found;
u32 buffer[16];
/* max. config for columns, but not rows */
@@ -1416,10 +1416,15 @@ static void mctl_auto_detect_dram_size(const struct dram_para *para,
shift = config->bus_full_width + 1;
/* detect column address bits */
+ found = 0;
for (cols = 8; cols < 11; cols++) {
- if (mctl_check_pattern(1ULL << (cols + shift)))
+ if (mctl_check_pattern(1ULL << (cols + shift))) {
+ found = 1;
break;
+ }
}
+ if (!found)
+ panic("DRAM init failed: Can't detect number of columns!");
debug("detected %u columns\n", cols);
/* restore data */
@@ -1437,10 +1442,15 @@ static void mctl_auto_detect_dram_size(const struct dram_para *para,
/* detect row address bits */
shift = config->bus_full_width + 4 + config->cols;
+ found = 0;
for (rows = 13; rows < 17; rows++) {
- if (mctl_check_pattern(1ULL << (rows + shift)))
+ if (mctl_check_pattern(1ULL << (rows + shift))) {
+ found = 1;
break;
+ }
}
+ if (!found)
+ panic("DRAM init failed: Can't detect number of rows!");
debug("detected %u rows\n", rows);
/* restore data again */
--
2.49.0
next prev parent reply other threads:[~2025-04-11 16:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 16:14 [PATCH 0/5] sunxi: h6/h616: consolidate DRAM code Jernej Skrabec
2025-04-11 16:14 ` Jernej Skrabec [this message]
2025-04-11 16:14 ` [PATCH 2/5] sunxi: H6: Remove useless DRAM timings parameter Jernej Skrabec
2025-04-15 23:05 ` Andre Przywara
2025-04-11 16:14 ` [PATCH 3/5] sunxi: H6: DRAM: Constify function parameters Jernej Skrabec
2025-04-15 23:06 ` Andre Przywara
2025-04-11 16:14 ` [PATCH 4/5] sunxi: h6: dram: split dram_para struct Jernej Skrabec
2025-04-28 13:40 ` Andre Przywara
2025-04-11 16:14 ` [PATCH 5/5] sunxi: h6/h616: Reuse common DRAM infrastructure Jernej Skrabec
2025-04-15 23:40 ` Andre Przywara
2025-04-16 16:30 ` Jernej Škrabec
2025-04-17 0:18 ` Andre Przywara
2025-04-26 18:43 ` Jernej Škrabec
2025-04-28 14:01 ` Andre Przywara
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=20250411161439.4743-2-jernej.skrabec@gmail.com \
--to=jernej.skrabec@gmail.com \
--cc=andre.przywara@arm.com \
--cc=jagan@amarulasolutions.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=macromorgan@hotmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=uwu@icenowy.me \
/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