From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/6] ARM: boards: kontron-samx6i: simplify memory detection function
Date: Mon, 18 Jan 2021 21:29:18 +0100 [thread overview]
Message-ID: <20210118202922.3581-2-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20210118202922.3581-1-m.felsch@pengutronix.de>
The Dual/Quad modules always have twice the size of the Solo/DualLite
modules. Determine the size once and multiply it if we are running on a
Quad/Dual module. The only special case is the 4GB size where I've
copied the value from the vendor u-boot [1].
[1] https://github.com/kontron/u-boot-smarc-samx7/blob/master/board/kontron/amx6/amx6.c
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
arch/arm/boards/kontron-samx6i/mem.c | 34 ++++++++++++----------------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/arch/arm/boards/kontron-samx6i/mem.c b/arch/arm/boards/kontron-samx6i/mem.c
index 8132624e3b..08dceb55c0 100644
--- a/arch/arm/boards/kontron-samx6i/mem.c
+++ b/arch/arm/boards/kontron-samx6i/mem.c
@@ -49,26 +49,22 @@ resource_size_t samx6i_get_size(void)
id0 = imx6_gpio_val(gpio6, 7);
id1 = imx6_gpio_val(gpio6, 9);
- if (cpu_type == IMX6_CPUTYPE_IMX6D ||
- cpu_type == IMX6_CPUTYPE_IMX6Q) {
- if (id0 && id1)
- size = SZ_2G;
- else if (id0)
- size = SZ_2G;
- else if (id1)
- size = SZ_1G;
- else
- size = SZ_512M;
- } else if (cpu_type == IMX6_CPUTYPE_IMX6S ||
- cpu_type == IMX6_CPUTYPE_IMX6DL) {
- if (id0 && id1)
- size = SZ_2G;
- else if (id0)
- size = SZ_1G;
- else if (id1)
- size = SZ_512M;
+ /* Solo/DualLite module sizes */
+ if (id0 && id1)
+ size = SZ_2G;
+ else if (id0)
+ size = SZ_1G;
+ else if (id1)
+ size = SZ_512M;
+ else
+ size = SZ_256M;
+
+ /* Dual/Quad modules always have twice the size */
+ if (cpu_type == IMX6_CPUTYPE_IMX6D || cpu_type == IMX6_CPUTYPE_IMX6Q) {
+ if (size == SZ_2G)
+ size = 0xf0000000; /* 4G on a 32bit system */
else
- size = SZ_256M;
+ size *= 2;
}
return size;
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-01-18 20:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 20:29 [PATCH 1/6] ARM: boards: kontron-samx6i: fix memory detection helper Marco Felsch
2021-01-18 20:29 ` Marco Felsch [this message]
2021-01-18 20:29 ` [PATCH 3/6] ARM: dts: imx6qdl-smarc-samx6i: remove iomuxc hog Marco Felsch
2021-01-18 20:29 ` [PATCH 4/6] ARM: dts: imx6qdl-samx6i: switch to SPDX license identifier Marco Felsch
2021-01-18 20:29 ` [PATCH 5/6] ARM: dts: imx6qdl-samx6i: use upstream device tree files Marco Felsch
2021-01-18 20:29 ` [PATCH 6/6] ARM: dts: imx6qdl-samx6i: cosmetic partition cleanup Marco Felsch
2021-01-19 10:01 ` [PATCH 1/6] ARM: boards: kontron-samx6i: fix memory detection helper 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=20210118202922.3581-2-m.felsch@pengutronix.de \
--to=m.felsch@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