diff mbox series

[v2,14/39] bdinfo: powerpc: Use the generic bd command

Message ID 20200510201702.196031-6-sjg@chromium.org
State Accepted
Commit 2e0fa21785ad24da212f49553a7d1775f4eaca95
Headers show
Series Tidy up the 'bd' command. | expand

Commit Message

Simon Glass May 10, 2020, 8:16 p.m. UTC
Unfortunately PowerPC has a lot of special stuff. Move it into the generic
function for now, so we can have it all in one place.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2:
- Fix up inadvertent merge of PowerPC/ARM/m68k/arc patches

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

Comments

Bin Meng May 17, 2020, 2:01 p.m. UTC | #1
On Mon, May 11, 2020 at 4:17 AM Simon Glass <sjg at chromium.org> wrote:
>
> Unfortunately PowerPC has a lot of special stuff. Move it into the generic
> function for now, so we can have it all in one place.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> Changes in v2:
> - Fix up inadvertent merge of PowerPC/ARM/m68k/arc patches
>
>  cmd/bdinfo.c | 89 ++++++++++++++++++++++++----------------------------
>  1 file changed, 41 insertions(+), 48 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
diff mbox series

Patch

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 0e96dd619c..05e4a05b77 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -170,53 +170,8 @@  static inline void __maybe_unused print_std_bdinfo(const bd_t *bd)
 }
 
 #if defined(CONFIG_PPC)
-void __weak board_detail(void)
-{
-	/* Please define board_detail() for your platform */
-}
-
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	bd_t *bd = gd->bd;
-
-#ifdef DEBUG
-	print_num("bd address",		(ulong)bd);
-#endif
-	print_bi_mem(bd);
-	print_bi_flash(bd);
-	print_num("sramstart",		bd->bi_sramstart);
-	print_num("sramsize",		bd->bi_sramsize);
-#if	defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
-	print_num("immr_base",		bd->bi_immr_base);
-#endif
-	print_num("bootflags",		bd->bi_bootflags);
-#if defined(CONFIG_CPM2)
-	print_mhz("vco",		bd->bi_vco);
-	print_mhz("sccfreq",		bd->bi_sccfreq);
-	print_mhz("brgfreq",		bd->bi_brgfreq);
-#endif
-	print_mhz("intfreq",		bd->bi_intfreq);
-#if defined(CONFIG_CPM2)
-	print_mhz("cpmfreq",		bd->bi_cpmfreq);
-#endif
-	print_mhz("busfreq",		bd->bi_busfreq);
-
-#ifdef CONFIG_ENABLE_36BIT_PHYS
-#ifdef CONFIG_PHYS_64BIT
-	puts("addressing  = 36-bit\n");
-#else
-	puts("addressing  = 32-bit\n");
-#endif
-#endif
-
-	print_eth_ip_addr();
-	print_baudrate();
-	print_num("relocaddr", gd->relocaddr);
-	board_detail();
-	print_cpu_word_size();
 
-	return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_NIOS2)
 
@@ -367,10 +322,20 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 /* Temporary check for archs that use generic bdinfo. Eventually all will */
 #ifdef USE_GENERIC
+void __weak board_detail(void)
+{
+	/* Please define board_detail() for your PPC platform */
+}
+
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
-	print_bi_dram(gd->bd);
-	print_std_bdinfo(gd->bd);
+	bd_t *bd = gd->bd;
+
+#ifdef DEBUG
+	print_num("bd address", (ulong)bd);
+#endif
+	print_bi_dram(bd);
+	print_std_bdinfo(bd);
 	print_num("relocaddr", gd->relocaddr);
 	print_num("reloc off", gd->reloc_off);
 	print_cpu_word_size();
@@ -381,6 +346,34 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	print_num("new_fdt", (ulong)gd->new_fdt);
 	print_num("fdt_size", (ulong)gd->fdt_size);
 
+	/* This section is used only by ppc */
+#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
+	print_num("immr_base", bd->bi_immr_base);
+#endif
+	if (IS_ENABLED(CONFIG_PPC)) {
+		print_num("bootflags", bd->bi_bootflags);
+		print_mhz("intfreq", bd->bi_intfreq);
+#ifdef CONFIG_ENABLE_36BIT_PHYS
+		if (IS_ENABLED(CONFIG_PHYS_64BIT))
+			puts("addressing  = 36-bit\n");
+		else
+			puts("addressing  = 32-bit\n");
+#endif
+		print_mhz("busfreq", bd->bi_busfreq);
+		board_detail();
+	}
+#if defined(CONFIG_CPM2)
+	print_mhz("cpmfreq", bd->bi_cpmfreq);
+	print_mhz("vco", bd->bi_vco);
+	print_mhz("sccfreq", bd->bi_sccfreq);
+	print_mhz("brgfreq", bd->bi_brgfreq);
+#endif
+
+#if defined(CONFIG_SYS_INIT_RAM_ADDR)
+	print_num("sramstart", (ulong)bd->bi_sramstart);
+	print_num("sramsize", (ulong)bd->bi_sramsize);
+#endif
+
 	return 0;
 }
 #endif