From: Mike Looijmans <mike.looijmans@topic.nl>
To: u-boot@lists.denx.de
Subject: [U-Boot] Dynamically determine RAM size and pass it to kernel
Date: Thu, 17 Nov 2016 13:34:55 +0100 [thread overview]
Message-ID: <45fe9a10-e620-0ae2-0a3f-b8fd182b00a0@topic.nl> (raw)
?We have some Zynq based boards still in the field that have only 512MB RAM
instead of 1GB. The memory chips are compatible and use the same settings
apart from that one extra address bit.
So what works is just configure the DDR controller for 1GB and then check if
writing some data "wraps" back, this is my "spike" code in the RAM init code
for that:
+ u32 *ptr_1 = (u32*)0x10000;
+ u32 *ptr_2 = (u32*)((gd->ram_size >> 1) + 0x10000);
+
+ puts("RAM test");
+ *ptr_1 = 0x12345678;
+ if (*ptr_2 == *ptr_1) {
+ *ptr_1 = 0x87654321;
+ if (*ptr_2 == *ptr_1) {
+ puts(" [HALF]");
+ gd->ram_size >>= 1;
+ }
+ }
This works well, and reliably detects that the board only has half the amount
of RAM, and corrects the ram_size variable.
The problem I'm seeing now is that this new ram_size does not get passed to
the kernel. Apparently in modern versions of u-boot I need to somehow patch
the "live" devicetree blob as well? How does that work?
Kind regards,
Mike Looijmans
System Expert
TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: mike.looijmans at topicproducts.com
Website: www.topicproducts.com
Please consider the environment before printing this e-mail
next reply other threads:[~2016-11-17 12:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-17 12:34 Mike Looijmans [this message]
2016-11-17 14:09 ` [U-Boot] Dynamically determine RAM size and pass it to kernel Mike Looijmans
2016-11-18 12:23 ` Michal Simek
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=45fe9a10-e620-0ae2-0a3f-b8fd182b00a0@topic.nl \
--to=mike.looijmans@topic.nl \
--cc=u-boot@lists.denx.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