From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 2/4] fdtdec: Update fdtdec_setup_mem_size_base_fdt() to call fdtdec_get_mem_size_base()
Date: Wed, 15 Jul 2020 20:23:01 -0700 [thread overview]
Message-ID: <1594869783-20189-2-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1594869783-20189-1-git-send-email-bmeng.cn@gmail.com>
From: Bin Meng <bin.meng@windriver.com>
The only difference betwen fdtdec_setup_mem_size_base_fdt() and
fdtdec_get_mem_size_base() is that the former does the assignment
to gd->ram_size and gd->ram_base.
Simplify the codes to call fdtdec_get_mem_size_base() directly.
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---
lib/fdtdec.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 078ff7a..015df84 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1056,23 +1056,12 @@ int fdtdec_get_mem_size_base(const void *blob,
int fdtdec_setup_mem_size_base_fdt(const void *blob)
{
- int ret, mem;
- struct fdt_resource res;
-
- mem = fdt_path_offset(blob, "/memory");
- if (mem < 0) {
- debug("%s: Missing /memory node\n", __func__);
- return -EINVAL;
- }
+ int ret;
- ret = fdt_get_resource(blob, mem, "reg", 0, &res);
- if (ret != 0) {
- debug("%s: Unable to decode first memory bank\n", __func__);
- return -EINVAL;
- }
+ ret = fdtdec_get_mem_size_base(blob, &gd->ram_size, &gd->ram_base);
+ if (ret)
+ return ret;
- gd->ram_size = (phys_size_t)(res.end - res.start + 1);
- gd->ram_base = (unsigned long)res.start;
debug("%s: Initial DRAM size %llx\n", __func__,
(unsigned long long)gd->ram_size);
--
2.7.4
next prev parent reply other threads:[~2020-07-16 3:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-16 3:23 [PATCH 1/4] fdtdec: Add fdtdec_get_mem_size_base() Bin Meng
2020-07-16 3:23 ` Bin Meng [this message]
2020-07-16 3:23 ` [PATCH 3/4] riscv: dts: hifive-unleashed-a00: Make memory node available to SPL Bin Meng
2020-07-16 3:23 ` [PATCH 4/4] ram: sifive: Avoid using hardcoded ram base and size Bin Meng
2020-07-17 5:58 ` Leo Liang
2020-07-17 6:09 ` Bin Meng
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=1594869783-20189-2-git-send-email-bmeng.cn@gmail.com \
--to=bmeng.cn@gmail.com \
--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