public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/7] cmd/bdinfo: extract print_bi_dram
Date: Thu, 28 Jul 2016 03:57:20 +0300	[thread overview]
Message-ID: <1469667444-4686-4-git-send-email-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <1469667444-4686-1-git-send-email-jcmvbkbc@gmail.com>

print_bi_dram outputs start address and size for each DRAM bank.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
Changes v1->v2:
- fix build for architectures w/o CONFIG_NR_DRAM_BANKS and bi_dram in
  bd_t.

 cmd/bdinfo.c | 60 +++++++++++++++++++-----------------------------------------
 1 file changed, 19 insertions(+), 41 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index df68b58..c8a0511 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -92,6 +92,19 @@ static inline void print_bi_mem(const bd_t *bd)
 #endif
 }
 
+static inline void print_bi_dram(const bd_t *bd)
+{
+#ifdef CONFIG_NR_DRAM_BANKS
+	int i;
+
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
+		print_num("DRAM bank",	i);
+		print_num("-> start",	bd->bi_dram[i].start);
+		print_num("-> size",	bd->bi_dram[i].size);
+	}
+#endif
+}
+
 #if defined(CONFIG_PPC)
 void __weak board_detail(void)
 {
@@ -179,15 +192,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	int i;
 	bd_t *bd = gd->bd;
 
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
-		print_num("DRAM bank",	i);
-		print_num("-> start",	bd->bi_dram[i].start);
-		print_num("-> size",	bd->bi_dram[i].size);
-	}
-
+	print_bi_dram(bd);
 	print_num("flash start",	(ulong)bd->bi_flashstart);
 	print_num("flash size",		(ulong)bd->bi_flashsize);
 	print_num("flash offset",	(ulong)bd->bi_flashoffset);
@@ -212,14 +219,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	bd_t *bd = gd->bd;
-	int i;
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
-		print_num("DRAM bank",	i);
-		print_num("-> start",	bd->bi_dram[i].start);
-		print_num("-> size",	bd->bi_dram[i].size);
-	}
 
+	print_bi_dram(bd);
 	print_num("flash start    ",	(ulong)bd->bi_flashstart);
 	print_num("flash size     ",	(ulong)bd->bi_flashsize);
 	print_num("flash offset   ",	(ulong)bd->bi_flashoffset);
@@ -390,17 +391,11 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 			char * const argv[])
 {
-	int i;
 	bd_t *bd = gd->bd;
 
 	print_num("arch_number",	bd->bi_arch_number);
 	print_bi_boot_params(bd);
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
-		print_num("DRAM bank",	i);
-		print_num("-> start",	bd->bi_dram[i].start);
-		print_num("-> size",	bd->bi_dram[i].size);
-	}
+	print_bi_dram(bd);
 
 #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
 	if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) {
@@ -460,7 +455,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	int i;
 	bd_t *bd = gd->bd;
 
 	print_bi_boot_params(bd);
@@ -475,11 +469,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_mhz("cpufreq",		bd->bi_intfreq);
 	print_mhz("busfreq",		bd->bi_busfreq);
 
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
-		print_num("DRAM bank",	i);
-		print_num("-> start",	bd->bi_dram[i].start);
-		print_num("-> size",	bd->bi_dram[i].size);
-	}
+	print_bi_dram(bd);
 
 #if defined(CONFIG_CMD_NET)
 	print_eth(0);
@@ -495,16 +485,10 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	int i;
 	bd_t *bd = gd->bd;
 
 	print_bi_boot_params(bd);
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
-		print_num("DRAM bank", i);
-		print_num("-> start", bd->bi_dram[i].start);
-		print_num("-> size", bd->bi_dram[i].size);
-	}
+	print_bi_dram(bd);
 
 #if defined(CONFIG_CMD_NET)
 	print_eth(0);
@@ -520,17 +504,11 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	int i;
 	bd_t *bd = gd->bd;
 
 	print_num("arch_number",	bd->bi_arch_number);
 	print_bi_boot_params(bd);
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
-		print_num("DRAM bank",	i);
-		print_num("-> start",	bd->bi_dram[i].start);
-		print_num("-> size",	bd->bi_dram[i].size);
-	}
+	print_bi_dram(bd);
 
 #if defined(CONFIG_CMD_NET)
 	print_eth(0);
-- 
2.1.4

  parent reply	other threads:[~2016-07-28  0:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28  0:57 [U-Boot] [PATCH v2 0/7] cmd/bdinfo: extract common parts and reuse them Max Filippov
2016-07-28  0:57 ` [U-Boot] [PATCH v2 1/7] cmd/bdinfo: extract print_bi_boot_params Max Filippov
2016-07-29 13:29   ` Tom Rini
2016-08-01  1:02   ` Simon Glass
2016-08-06  0:59   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-07-28  0:57 ` [U-Boot] [PATCH v2 2/7] cmd/bdinfo: extract print_bi_mem Max Filippov
2016-07-29 13:29   ` Tom Rini
2016-08-01  1:02   ` Simon Glass
2016-08-06  0:59   ` [U-Boot] [U-Boot,v2,2/7] " Tom Rini
2016-07-28  0:57 ` Max Filippov [this message]
2016-07-29 13:29   ` [U-Boot] [PATCH v2 3/7] cmd/bdinfo: extract print_bi_dram Tom Rini
2016-08-01  1:02   ` Simon Glass
2016-08-06  0:59   ` [U-Boot] [U-Boot,v2,3/7] " Tom Rini
2016-07-28  0:57 ` [U-Boot] [PATCH v2 4/7] cmd/bdinfo: extract print_bi_flash Max Filippov
2016-07-29 13:29   ` Tom Rini
2016-08-01  1:03   ` Simon Glass
2016-08-06  0:59   ` [U-Boot] [U-Boot,v2,4/7] " Tom Rini
2016-07-28  0:57 ` [U-Boot] [PATCH v2 5/7] cmd/bdinfo: extract print_eth_ip_addr Max Filippov
2016-07-29 13:29   ` Tom Rini
2016-08-01  1:03   ` Simon Glass
2016-08-04 16:59   ` Joe Hershberger
2016-08-06  0:59   ` [U-Boot] [U-Boot,v2,5/7] " Tom Rini
2016-07-28  0:57 ` [U-Boot] [PATCH v2 6/7] cmd/bdinfo: extract print_baudrate Max Filippov
2016-07-29 13:29   ` Tom Rini
2016-08-01  1:03   ` Simon Glass
2016-08-06  0:59   ` [U-Boot] [U-Boot,v2,6/7] " Tom Rini
2016-07-28  0:57 ` [U-Boot] [PATCH v2 7/7] cmd/bdinfo: extract print_std_bdinfo Max Filippov
2016-07-29 13:29   ` Tom Rini
2016-08-01  1:03   ` Simon Glass
2016-08-01  1:10     ` Max Filippov
2016-08-01 21:11       ` Tom Rini
2016-08-06  0:59   ` [U-Boot] [U-Boot,v2,7/7] " Tom Rini

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=1469667444-4686-4-git-send-email-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@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