All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/36] Tidy up the 'bd' command.
@ 2020-05-04 23:16 Simon Glass
  2020-05-04 23:16 ` [PATCH 01/36] bdinfo: nds32: Use generic bd_info Simon Glass
                   ` (36 more replies)
  0 siblings, 37 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:16 UTC (permalink / raw)
  To: u-boot

The code for the 'bd' command never got the 'generic board' treatment many
years ago when global_data and bd_info were converted. As a result it
still has a lot of arch-specific duplication of generic code.

This series aims to make as much code in this file generic as possible, so
that it is easy to add new info on all architectures.

For the three architectures that actually need additional code (ARM, PPC
and m68k) this is moved into arch-specific files.

With this series, bdinfo.c drops from nearly 500 lines to just over 100.

It also makes x86 report the frame buffer address properly (the original
goal of my effort).


Simon Glass (36):
  bdinfo: nds32: Use generic bd_info
  bdinfo: riscv: Use generic bd_info
  bdinfo: m68k: Drop bd_info->bi_ipbfreq
  bdinfo: xtensa: Create a generic do_bdinfo for xtensa
  bdinfo: mips: Use the generic bd command
  bdinfo: nios2: Use the generic bd command
  bdinfo: microblaze: Use the generic bd command
  bdinfo: sh: Use the generic bd command
  bdinfo: x86: Use the generic bd command
  bdinfo: sandbox: Use the generic bd command
  bdinfo: nds32: Use the generic bd command
  bdinfo: riscv: Use the generic bd command
  bdinfo: arm: Use the generic bd command
  bdinfo: Drop the option to not use the generic 'bd' command
  bdinfo: Drop unused __maybe_unused
  bdinfo: microblaze: sh: nios2: Drop arch-specific flash info
  bdinfo: Drop unnecessary inline on functions
  bdinfo: Drop print_std_bdinfo()
  bdinfo: ppc: Drop arch-specific print_baudrate()
  bdinfo: sh: arc: Drop arch-specific print_bi_mem()
  bdinfo: Drop print_bi_boot_params()
  bdinfo: Drop print_bi_flash()
  bdinfo: Drop print_cpu_word_size()
  bdinfo: net: ppc: Drop bi_enet1addr and other similar info
  bdinfo: net: ppc: Drop prints for CONFIG_HAS_ETHn
  bdinfo: net: Drop legacy ethernet bdinfo
  bdinfo: net: Inline print_eths()
  bdinfo: net: Inline print_eth_ip_addr()
  bdinfo: Export some basic printing functions
  bdinfo: arm: Move ARM-specific info into its own file
  bdinfo: ppc: Move PPC-specific info into its own file
  bdinfo: m68k: Move m68k-specific info into its own file
  bdinfo: m68k: ppc: Move arch-specific code from bdinfo
  bdinfo: Update the file comments
  bdinfo: dm: Update fb_base when using driver model
  bdinfo: x86: vesa: Update fb_base to the correct value

 arch/arm/lib/Makefile           |   1 +
 arch/arm/lib/bdinfo.c           |  51 ++++
 arch/m68k/lib/Makefile          |   1 +
 arch/m68k/lib/bdinfo.c          |  34 +++
 arch/nds32/include/asm/u-boot.h |  20 +-
 arch/powerpc/lib/Makefile       |   2 +
 arch/powerpc/lib/bdinfo.c       |  46 ++++
 arch/riscv/include/asm/u-boot.h |  19 +-
 arch/x86/lib/fsp/fsp_graphics.c |   5 +-
 cmd/bdinfo.c                    | 451 +++-----------------------------
 common/board_r.c                |  16 +-
 drivers/video/video-uclass.c    |   1 +
 include/asm-generic/u-boot.h    |  18 --
 include/init.h                  |   9 +
 14 files changed, 185 insertions(+), 489 deletions(-)
 create mode 100644 arch/arm/lib/bdinfo.c
 create mode 100644 arch/m68k/lib/bdinfo.c
 create mode 100644 arch/powerpc/lib/bdinfo.c

-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 01/36] bdinfo: nds32: Use generic bd_info
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
@ 2020-05-04 23:16 ` Simon Glass
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4704736@ATCPCS16.andestech.com>
  2020-05-06  8:06   ` Bin Meng
  2020-05-04 23:16 ` [PATCH 02/36] bdinfo: riscv: " Simon Glass
                   ` (35 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:16 UTC (permalink / raw)
  To: u-boot

At present nds32 still uses its own private bd_info struct. Move it over
to use the generic one like other archs.

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

 arch/nds32/include/asm/u-boot.h | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/arch/nds32/include/asm/u-boot.h b/arch/nds32/include/asm/u-boot.h
index 8c949e7fb7..7b6e905f2a 100644
--- a/arch/nds32/include/asm/u-boot.h
+++ b/arch/nds32/include/asm/u-boot.h
@@ -19,26 +19,10 @@
 #ifndef _U_BOOT_H_
 #define _U_BOOT_H_	1
 
+/* Use the generic board which requires a unified bd_info */
+#include <asm-generic/u-boot.h>
 #include <asm/u-boot-nds32.h>
 
-
-typedef struct bd_info {
-	unsigned long	bi_arch_number;	/* unique id for this board */
-	unsigned long	bi_boot_params;	/* where this board expects params */
-	unsigned long	bi_memstart;	/* start of DRAM memory */
-	unsigned long	bi_memsize;	/* size	 of DRAM memory in bytes */
-	unsigned long	bi_flashstart;	/* start of FLASH memory */
-	unsigned long	bi_flashsize;	/* size	 of FLASH memory */
-	unsigned long	bi_flashoffset; /* reserved area for startup monitor */
-	unsigned char	bi_enetaddr[6];
-
-	struct				/* RAM configuration */
-	{
-		unsigned long start;
-		unsigned long size;
-	} bi_dram[CONFIG_NR_DRAM_BANKS];
-} bd_t;
-
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_NDS32
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 02/36] bdinfo: riscv: Use generic bd_info
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
  2020-05-04 23:16 ` [PATCH 01/36] bdinfo: nds32: Use generic bd_info Simon Glass
@ 2020-05-04 23:16 ` Simon Glass
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4704741@ATCPCS16.andestech.com>
  2020-05-06  8:06   ` Bin Meng
  2020-05-04 23:16 ` [PATCH 03/36] bdinfo: m68k: Drop bd_info->bi_ipbfreq Simon Glass
                   ` (34 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:16 UTC (permalink / raw)
  To: u-boot

At present riscv still uses its own private bd_info struct. Move it over
to use the generic one like other archs.

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

 arch/riscv/include/asm/u-boot.h | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/arch/riscv/include/asm/u-boot.h b/arch/riscv/include/asm/u-boot.h
index 5ba8e77812..d5e1d5f323 100644
--- a/arch/riscv/include/asm/u-boot.h
+++ b/arch/riscv/include/asm/u-boot.h
@@ -18,25 +18,10 @@
 #ifndef _U_BOOT_H_
 #define _U_BOOT_H_	1
 
+/* Use the generic board which requires a unified bd_info */
+#include <asm-generic/u-boot.h>
 #include <asm/u-boot-riscv.h>
 
-
-typedef struct bd_info {
-	unsigned long	bi_boot_params;	/* where this board expects params */
-	unsigned long	bi_memstart;	/* start of DRAM memory */
-	unsigned long	bi_memsize;	/* size	 of DRAM memory in bytes */
-	unsigned long	bi_flashstart;	/* start of FLASH memory */
-	unsigned long	bi_flashsize;	/* size	 of FLASH memory */
-	unsigned long	bi_flashoffset; /* reserved area for startup monitor */
-	unsigned char	bi_enetaddr[6];
-
-	struct				/* RAM configuration */
-	{
-		unsigned long start;
-		unsigned long size;
-	} bi_dram[CONFIG_NR_DRAM_BANKS];
-} bd_t;
-
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_RISCV
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 03/36] bdinfo: m68k: Drop bd_info->bi_ipbfreq
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
  2020-05-04 23:16 ` [PATCH 01/36] bdinfo: nds32: Use generic bd_info Simon Glass
  2020-05-04 23:16 ` [PATCH 02/36] bdinfo: riscv: " Simon Glass
@ 2020-05-04 23:16 ` Simon Glass
  2020-05-06  8:06   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 04/36] bdinfo: xtensa: Create a generic do_bdinfo for xtensa Simon Glass
                   ` (33 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:16 UTC (permalink / raw)
  To: u-boot

This field is not used anymore. Drop it.

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

 include/asm-generic/u-boot.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/asm-generic/u-boot.h b/include/asm-generic/u-boot.h
index cc94d39069..be0014c3b3 100644
--- a/include/asm-generic/u-boot.h
+++ b/include/asm-generic/u-boot.h
@@ -60,7 +60,6 @@ typedef struct bd_info {
 	unsigned long	bi_vco;		/* VCO Out from PLL, in MHz */
 #endif
 #if defined(CONFIG_M68K)
-	unsigned long	bi_ipbfreq;	/* IPB Bus Freq, in MHz */
 	unsigned long	bi_pcifreq;	/* PCI Bus Freq, in MHz */
 #endif
 #if defined(CONFIG_EXTRA_CLOCK)
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 04/36] bdinfo: xtensa: Create a generic do_bdinfo for xtensa
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (2 preceding siblings ...)
  2020-05-04 23:16 ` [PATCH 03/36] bdinfo: m68k: Drop bd_info->bi_ipbfreq Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:07   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 05/36] bdinfo: mips: Use the generic bd command Simon Glass
                   ` (32 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This arch uses only the generic function. It would be nice if all the
archs did the same. As a first step, create a new generic function for the
'bd' command and make xtensa use it.

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

 cmd/bdinfo.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 9edcf8d74e..9247180a29 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -474,14 +474,20 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #elif defined(CONFIG_XTENSA)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+#define USE_GENERIC
+
+#else
+ #error "a case for this architecture does not exist!"
+#endif
+
+/* Temporary check for archs that use generic bdinfo. Eventually all will */
+#ifdef USE_GENERIC
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
 	print_std_bdinfo(gd->bd);
+
 	return 0;
 }
-
-#else
- #error "a case for this architecture does not exist!"
 #endif
 
 /* -------------------------------------------------------------------- */
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 05/36] bdinfo: mips: Use the generic bd command
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (3 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 04/36] bdinfo: xtensa: Create a generic do_bdinfo for xtensa Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:07   ` Bin Meng
  2020-05-06 15:29   ` Daniel Schwierzeck
  2020-05-04 23:17 ` [PATCH 06/36] bdinfo: nios2: " Simon Glass
                   ` (31 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

MIPS currently has a few extra things which are generally useful. Add them
to the generic function and move MIPS over to use it.

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

 cmd/bdinfo.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 9247180a29..6ccbd2f50f 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -299,15 +299,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #elif defined(CONFIG_MIPS)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	print_std_bdinfo(gd->bd);
-	print_num("relocaddr", gd->relocaddr);
-	print_num("reloc off", gd->reloc_off);
-	print_cpu_word_size();
-
-	return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_ARM)
 
@@ -485,6 +477,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[])
 {
 	print_std_bdinfo(gd->bd);
+	print_num("relocaddr", gd->relocaddr);
+	print_num("reloc off", gd->reloc_off);
+	print_cpu_word_size();
 
 	return 0;
 }
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 06/36] bdinfo: nios2: Use the generic bd command
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (4 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 05/36] bdinfo: mips: Use the generic bd command Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:07   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 07/36] bdinfo: microblaze: " Simon Glass
                   ` (30 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

Nios2 currently has some code to output SRAM information which is behind
an #ifdef. No nios2 boards define this option, so the code can be removed.

Move Nios2 over to use the generic function.

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

 cmd/bdinfo.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 6ccbd2f50f..405a915861 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -220,24 +220,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #elif defined(CONFIG_NIOS2)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_bi_dram(bd);
-	print_bi_flash(bd);
-
-#if defined(CONFIG_SYS_SRAM_BASE)
-	print_num ("sram start",	(ulong)bd->bi_sramstart);
-	print_num ("sram size",		(ulong)bd->bi_sramsize);
-#endif
-
-	print_eth_ip_addr();
-	print_baudrate();
-	print_cpu_word_size();
-
-	return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_MICROBLAZE)
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 07/36] bdinfo: microblaze: Use the generic bd command
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (5 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 06/36] bdinfo: nios2: " Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:07   ` Bin Meng
  2020-05-06 15:56   ` Daniel Schwierzeck
  2020-05-04 23:17 ` [PATCH 08/36] bdinfo: sh: " Simon Glass
                   ` (29 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

Microblaze prints out ethernet and FDT information. This is useful to
most archs, so move it into the generic code and move microblaze over to
use it.

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

 cmd/bdinfo.c | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 405a915861..dc5a09f8ce 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -224,29 +224,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #elif defined(CONFIG_MICROBLAZE)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_bi_dram(bd);
-	print_bi_flash(bd);
-#if defined(CONFIG_SYS_SRAM_BASE)
-	print_num("sram start     ",	(ulong)bd->bi_sramstart);
-	print_num("sram size      ",	(ulong)bd->bi_sramsize);
-#endif
-#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
-	print_eths();
-#endif
-	print_baudrate();
-	print_num("relocaddr", gd->relocaddr);
-	print_num("reloc off", gd->reloc_off);
-	print_num("fdt_blob", (ulong)gd->fdt_blob);
-	print_num("new_fdt", (ulong)gd->new_fdt);
-	print_num("fdt_size", (ulong)gd->fdt_size);
-	print_cpu_word_size();
-
-	return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_M68K)
 
@@ -463,6 +441,12 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	print_num("relocaddr", gd->relocaddr);
 	print_num("reloc off", gd->reloc_off);
 	print_cpu_word_size();
+#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
+	print_eths();
+#endif
+	print_num("fdt_blob", (ulong)gd->fdt_blob);
+	print_num("new_fdt", (ulong)gd->new_fdt);
+	print_num("fdt_size", (ulong)gd->fdt_size);
 
 	return 0;
 }
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 08/36] bdinfo: sh: Use the generic bd command
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (6 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 07/36] bdinfo: microblaze: " Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:07   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 09/36] bdinfo: x86: " Simon Glass
                   ` (28 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This arch has no code that is not already in the generic function. Drop
the arch-specific function and change sh over to use the generic one.

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

 cmd/bdinfo.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index dc5a09f8ce..0b9ac21848 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -325,18 +325,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 
 #elif defined(CONFIG_SH)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_bi_mem(bd);
-	print_bi_flash(bd);
-	print_eth_ip_addr();
-	print_baudrate();
-	print_cpu_word_size();
-
-	return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_X86)
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 09/36] bdinfo: x86: Use the generic bd command
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (7 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 08/36] bdinfo: sh: " Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:07   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 10/36] bdinfo: sandbox: " Simon Glass
                   ` (27 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This arch shows 'ethspeed' info but only the freescale drivers use it, so
it can be dropped.

It also calls print_bi_dram() which is safe to call from any arch since it
has an #ifdef inside it. Add this to the generic do_bdinfo() and move x86
over to use it. Put it first since pytests rely on seeing it before
memstart in find_ram_base().

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

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

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 0b9ac21848..0b903d234e 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -329,25 +329,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 
 #elif defined(CONFIG_X86)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_bi_boot_params(bd);
-
-	print_bi_dram(bd);
-
-	print_num("relocaddr", gd->relocaddr);
-	print_num("reloc off", gd->reloc_off);
-#if defined(CONFIG_CMD_NET)
-	print_eth_ip_addr();
-	print_mhz("ethspeed",	    bd->bi_ethspeed);
-#endif
-	print_baudrate();
-	print_cpu_word_size();
-
-	return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_SANDBOX)
 
@@ -426,6 +408,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #ifdef USE_GENERIC
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
+	print_bi_dram(gd->bd);
 	print_std_bdinfo(gd->bd);
 	print_num("relocaddr", gd->relocaddr);
 	print_num("reloc off", gd->reloc_off);
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 10/36] bdinfo: sandbox: Use the generic bd command
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (8 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 09/36] bdinfo: x86: " Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:07   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 11/36] bdinfo: nds32: " Simon Glass
                   ` (26 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

Sandbox has a printout of 'FB base' but this code is not used since
sandbox uses driver model for everything.

Move sandbox over to use the generic do_bdinfo().

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

 cmd/bdinfo.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 0b903d234e..dce24b43fa 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -333,21 +333,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 
 #elif defined(CONFIG_SANDBOX)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_bi_boot_params(bd);
-	print_bi_dram(bd);
-	print_eth_ip_addr();
-
-#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
-	print_num("FB base  ", gd->fb_base);
-#endif
-	print_cpu_word_size();
-
-	return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_NDS32)
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 11/36] bdinfo: nds32: Use the generic bd command
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (9 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 10/36] bdinfo: sandbox: " Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA470474E@ATCPCS16.andestech.com>
  2020-05-06  8:07   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 12/36] bdinfo: riscv: " Simon Glass
                   ` (25 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This arch has none of its own info to show. Move it over to use the
generic do_bdinfo().

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

 cmd/bdinfo.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index dce24b43fa..6a2bbfb348 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -337,19 +337,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 
 #elif defined(CONFIG_NDS32)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_num("arch_number",	bd->bi_arch_number);
-	print_bi_boot_params(bd);
-	print_bi_dram(bd);
-	print_eth_ip_addr();
-	print_baudrate();
-	print_cpu_word_size();
-
-	return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_RISCV)
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 12/36] bdinfo: riscv: Use the generic bd command
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (10 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 11/36] bdinfo: nds32: " Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4704755@ATCPCS16.andestech.com>
  2020-05-06  8:07   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 13/36] bdinfo: arm: " Simon Glass
                   ` (24 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This arch has none of its own info to show. Move it over to use the
generic do_bdinfo().

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

 cmd/bdinfo.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 6a2bbfb348..0e96dd619c 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -341,20 +341,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 
 #elif defined(CONFIG_RISCV)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_bi_boot_params(bd);
-	print_bi_dram(bd);
-	print_num("relocaddr", gd->relocaddr);
-	print_num("reloc off", gd->reloc_off);
-	print_eth_ip_addr();
-	print_baudrate();
-	print_cpu_word_size();
-
-	return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_ARC)
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 13/36] bdinfo: arm: Use the generic bd command
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (11 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 12/36] bdinfo: riscv: " Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:07   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 14/36] bdinfo: Drop the option to not use the generic 'bd' command Simon Glass
                   ` (23 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

Unfortunately ARM has a lot of special stuff. Move it into the generic
function for now, so we can have it all in one place.

Add in the frame-buffer printout, since it supports driver model too.

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

 cmd/bdinfo.c | 250 +++++++++++++++++++++------------------------------
 1 file changed, 104 insertions(+), 146 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 0e96dd619c..f07f92463c 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)
 
@@ -228,35 +183,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #elif defined(CONFIG_M68K)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_bi_mem(bd);
-	print_bi_flash(bd);
-#if defined(CONFIG_SYS_INIT_RAM_ADDR)
-	print_num("sramstart",		(ulong)bd->bi_sramstart);
-	print_num("sramsize",		(ulong)bd->bi_sramsize);
-#endif
-#if defined(CONFIG_SYS_MBAR)
-	print_num("mbar",		bd->bi_mbar_base);
-#endif
-	print_mhz("cpufreq",		bd->bi_intfreq);
-	print_mhz("busfreq",		bd->bi_busfreq);
-#ifdef CONFIG_PCI
-	print_mhz("pcifreq",		bd->bi_pcifreq);
-#endif
-#ifdef CONFIG_EXTRA_CLOCK
-	print_mhz("flbfreq",		bd->bi_flbfreq);
-	print_mhz("inpfreq",		bd->bi_inpfreq);
-	print_mhz("vcofreq",		bd->bi_vcofreq);
-#endif
-	print_eth_ip_addr();
-	print_baudrate();
-	print_cpu_word_size();
-
-	return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_MIPS)
 
@@ -264,64 +191,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #elif defined(CONFIG_ARM)
 
-static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_num("arch_number",	bd->bi_arch_number);
-	print_bi_boot_params(bd);
-	print_bi_dram(bd);
-
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-	if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) {
-		print_num("Secure ram",
-			  gd->arch.secure_ram & MEM_RESERVE_SECURE_ADDR_MASK);
-	}
-#endif
-#ifdef CONFIG_RESV_RAM
-	if (gd->arch.resv_ram)
-		print_num("Reserved ram", gd->arch.resv_ram);
-#endif
-#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
-	print_eths();
-#endif
-	print_baudrate();
-#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
-	print_num("TLB addr", gd->arch.tlb_addr);
-#endif
-	print_num("relocaddr", gd->relocaddr);
-	print_num("reloc off", gd->reloc_off);
-	print_num("irq_sp", gd->irq_sp);	/* irq stack pointer */
-	print_num("sp start ", gd->start_addr_sp);
-#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO)
-	print_num("FB base  ", gd->fb_base);
-#endif
-	/*
-	 * TODO: Currently only support for davinci SOC's is added.
-	 * Remove this check once all the board implement this.
-	 */
-#ifdef CONFIG_CLOCKS
-	printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
-	printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
-	printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
-#endif
-#ifdef CONFIG_BOARD_TYPES
-	printf("Board Type  = %ld\n", gd->board_type);
-#endif
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
-	printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr,
-	       CONFIG_VAL(SYS_MALLOC_F_LEN));
-#endif
-#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
-	print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
-#endif
-	if (gd->fdt_blob)
-		print_num("fdt_blob", (ulong)gd->fdt_blob);
-	print_cpu_word_size();
-
-	return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_SH)
 
@@ -345,17 +215,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 
 #elif defined(CONFIG_ARC)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_bi_mem(bd);
-	print_eth_ip_addr();
-	print_baudrate();
-	print_cpu_word_size();
-
-	return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_XTENSA)
 
@@ -367,10 +227,22 @@ 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
+	if (IS_ENABLED(CONFIG_ARM))
+		print_num("arch_number", bd->bi_arch_number);
+	print_bi_dram(bd);
+	print_std_bdinfo(bd);
 	print_num("relocaddr", gd->relocaddr);
 	print_num("reloc off", gd->reloc_off);
 	print_cpu_word_size();
@@ -380,6 +252,92 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	print_num("fdt_blob", (ulong)gd->fdt_blob);
 	print_num("new_fdt", (ulong)gd->new_fdt);
 	print_num("fdt_size", (ulong)gd->fdt_size);
+#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO)
+	print_num("FB base  ", gd->fb_base);
+#endif
+
+	/* This section is used only by ARM */
+#ifdef CONFIG_ARM
+#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
+	if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) {
+		print_num("Secure ram",
+			  gd->arch.secure_ram & MEM_RESERVE_SECURE_ADDR_MASK);
+	}
+#endif
+#ifdef CONFIG_RESV_RAM
+	if (gd->arch.resv_ram)
+		print_num("Reserved ram", gd->arch.resv_ram);
+#endif
+#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
+	print_num("TLB addr", gd->arch.tlb_addr);
+#endif
+	print_num("irq_sp", gd->irq_sp);	/* irq stack pointer */
+	print_num("sp start ", gd->start_addr_sp);
+	/*
+	 * TODO: Currently only support for davinci SOC's is added.
+	 * Remove this check once all the board implement this.
+	 */
+#ifdef CONFIG_CLOCKS
+	printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
+	printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
+	printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
+#endif
+#ifdef CONFIG_BOARD_TYPES
+	printf("Board Type  = %ld\n", gd->board_type);
+#endif
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+	printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr,
+	       CONFIG_VAL(SYS_MALLOC_F_LEN));
+#endif
+#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
+	print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
+#endif
+#endif /* CONFIG_ARM */
+
+	/* 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
+		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
+
+	/* This is used by m68k and ppc */
+#if defined(CONFIG_SYS_INIT_RAM_ADDR)
+	print_num("sramstart", (ulong)bd->bi_sramstart);
+	print_num("sramsize", (ulong)bd->bi_sramsize);
+#endif
+	if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_M68K))
+		print_mhz("busfreq", bd->bi_busfreq);
+
+	/* The rest are used only by m68k */
+#ifdef CONFIG_M68K
+#if defined(CONFIG_SYS_MBAR)
+	print_num("mbar", bd->bi_mbar_base);
+#endif
+	print_mhz("cpufreq", bd->bi_intfreq);
+	if (IS_ENABLED(CONFIG_PCI))
+		print_mhz("pcifreq", bd->bi_pcifreq);
+#ifdef CONFIG_EXTRA_CLOCK
+	print_mhz("flbfreq", bd->bi_flbfreq);
+	print_mhz("inpfreq", bd->bi_inpfreq);
+	print_mhz("vcofreq", bd->bi_vcofreq);
+#endif
+#endif
 
 	return 0;
 }
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 14/36] bdinfo: Drop the option to not use the generic 'bd' command
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (12 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 13/36] bdinfo: arm: " Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:07   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 15/36] bdinfo: Drop unused __maybe_unused Simon Glass
                   ` (22 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

Now that all architectures are using the generic do_bdinfo(), drop the
option to not use it. When new architectures are added, they will get at
least some useful information from the generic implementation.

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

 cmd/bdinfo.c | 59 ----------------------------------------------------
 1 file changed, 59 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index f07f92463c..13b4f2ebba 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -169,64 +169,6 @@ static inline void __maybe_unused print_std_bdinfo(const bd_t *bd)
 	print_baudrate();
 }
 
-#if defined(CONFIG_PPC)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_NIOS2)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_MICROBLAZE)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_M68K)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_MIPS)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_ARM)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_SH)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_X86)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_SANDBOX)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_NDS32)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_RISCV)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_ARC)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_XTENSA)
-
-#define USE_GENERIC
-
-#else
- #error "a case for this architecture does not exist!"
-#endif
-
-/* 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 */
@@ -341,7 +283,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 
 	return 0;
 }
-#endif
 
 /* -------------------------------------------------------------------- */
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 15/36] bdinfo: Drop unused __maybe_unused
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (13 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 14/36] bdinfo: Drop the option to not use the generic 'bd' command Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:07   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 16/36] bdinfo: microblaze: sh: nios2: Drop arch-specific flash info Simon Glass
                   ` (21 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

Some of these are not needed now. Drop them to avoid cluttering the code.

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

 cmd/bdinfo.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 13b4f2ebba..204d4c5db1 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -15,12 +15,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-__maybe_unused void print_cpu_word_size(void)
+void print_cpu_word_size(void)
 {
 	printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
 }
 
-__maybe_unused
 static void print_num(const char *name, ulong value)
 {
 	printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value);
@@ -67,7 +66,6 @@ static void print_lnum(const char *name, unsigned long long value)
 	printf("%-12s= 0x%.8llX\n", name, value);
 }
 
-__maybe_unused
 static void print_mhz(const char *name, unsigned long hz)
 {
 	char buf[32];
@@ -160,7 +158,7 @@ static inline void print_baudrate(void)
 #endif
 }
 
-static inline void __maybe_unused print_std_bdinfo(const bd_t *bd)
+static inline void print_std_bdinfo(const bd_t *bd)
 {
 	print_bi_boot_params(bd);
 	print_bi_mem(bd);
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 16/36] bdinfo: microblaze: sh: nios2: Drop arch-specific flash info
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (14 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 15/36] bdinfo: Drop unused __maybe_unused Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:09   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 17/36] bdinfo: Drop unnecessary inline on functions Simon Glass
                   ` (20 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

The differences these architectures have are minor and not worth the extra
code. Use the generic version always.

Tidy up the code style by removing unnecessary tabs.

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

 cmd/bdinfo.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 204d4c5db1..3d16f4cc1a 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -110,20 +110,9 @@ static inline void print_bi_dram(const bd_t *bd)
 
 static inline void print_bi_flash(const bd_t *bd)
 {
-#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_SH)
-	print_num("flash start    ",	(ulong)bd->bi_flashstart);
-	print_num("flash size     ",	(ulong)bd->bi_flashsize);
-	print_num("flash offset   ",	(ulong)bd->bi_flashoffset);
-
-#elif defined(CONFIG_NIOS2)
-	print_num("flash start",	(ulong)bd->bi_flashstart);
-	print_num("flash size",		(ulong)bd->bi_flashsize);
-	print_num("flash offset",	(ulong)bd->bi_flashoffset);
-#else
-	print_num("flashstart",		(ulong)bd->bi_flashstart);
-	print_num("flashsize",		(ulong)bd->bi_flashsize);
-	print_num("flashoffset",	(ulong)bd->bi_flashoffset);
-#endif
+	print_num("flashstart", (ulong)bd->bi_flashstart);
+	print_num("flashsize", (ulong)bd->bi_flashsize);
+	print_num("flashoffset", (ulong)bd->bi_flashoffset);
 }
 
 static inline void print_eth_ip_addr(void)
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 17/36] bdinfo: Drop unnecessary inline on functions
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (15 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 16/36] bdinfo: microblaze: sh: nios2: Drop arch-specific flash info Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:09   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 18/36] bdinfo: Drop print_std_bdinfo() Simon Glass
                   ` (19 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This serves no purpose since the compiler will inline the functions
automatically. Drop use of inline in this file.

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

 cmd/bdinfo.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 3d16f4cc1a..6e5b3d997d 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -60,7 +60,6 @@ static void print_eths(void)
 }
 #endif
 
-__maybe_unused
 static void print_lnum(const char *name, unsigned long long value)
 {
 	printf("%-12s= 0x%.8llX\n", name, value);
@@ -74,12 +73,12 @@ static void print_mhz(const char *name, unsigned long hz)
 }
 
 
-static inline void print_bi_boot_params(const bd_t *bd)
+static void print_bi_boot_params(const bd_t *bd)
 {
 	print_num("boot_params",	(ulong)bd->bi_boot_params);
 }
 
-static inline void print_bi_mem(const bd_t *bd)
+static void print_bi_mem(const bd_t *bd)
 {
 #if defined(CONFIG_SH)
 	print_num("mem start      ",	(ulong)bd->bi_memstart);
@@ -93,7 +92,7 @@ static inline void print_bi_mem(const bd_t *bd)
 #endif
 }
 
-static inline void print_bi_dram(const bd_t *bd)
+static void print_bi_dram(const bd_t *bd)
 {
 #ifdef CONFIG_NR_DRAM_BANKS
 	int i;
@@ -108,14 +107,14 @@ static inline void print_bi_dram(const bd_t *bd)
 #endif
 }
 
-static inline void print_bi_flash(const bd_t *bd)
+static void print_bi_flash(const bd_t *bd)
 {
 	print_num("flashstart", (ulong)bd->bi_flashstart);
 	print_num("flashsize", (ulong)bd->bi_flashsize);
 	print_num("flashoffset", (ulong)bd->bi_flashoffset);
 }
 
-static inline void print_eth_ip_addr(void)
+static void print_eth_ip_addr(void)
 {
 #if defined(CONFIG_CMD_NET)
 	print_eth(0);
@@ -138,7 +137,7 @@ static inline void print_eth_ip_addr(void)
 #endif
 }
 
-static inline void print_baudrate(void)
+static void print_baudrate(void)
 {
 #if defined(CONFIG_PPC)
 	printf("baudrate    = %6u bps\n", gd->baudrate);
@@ -147,7 +146,7 @@ static inline void print_baudrate(void)
 #endif
 }
 
-static inline void print_std_bdinfo(const bd_t *bd)
+static void print_std_bdinfo(const bd_t *bd)
 {
 	print_bi_boot_params(bd);
 	print_bi_mem(bd);
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 18/36] bdinfo: Drop print_std_bdinfo()
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (16 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 17/36] bdinfo: Drop unnecessary inline on functions Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:09   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 19/36] bdinfo: ppc: Drop arch-specific print_baudrate() Simon Glass
                   ` (18 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

Everything in this function is standard now so it serves no purpose. Move
it into the generic do_bdinfo() function.

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

 cmd/bdinfo.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 6e5b3d997d..4e08d9e40a 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -146,15 +146,6 @@ static void print_baudrate(void)
 #endif
 }
 
-static void print_std_bdinfo(const bd_t *bd)
-{
-	print_bi_boot_params(bd);
-	print_bi_mem(bd);
-	print_bi_flash(bd);
-	print_eth_ip_addr();
-	print_baudrate();
-}
-
 void __weak board_detail(void)
 {
 	/* Please define board_detail() for your PPC platform */
@@ -169,7 +160,12 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 #endif
 	if (IS_ENABLED(CONFIG_ARM))
 		print_num("arch_number", bd->bi_arch_number);
+	print_bi_boot_params(bd);
 	print_bi_dram(bd);
+	print_bi_mem(bd);
+	print_bi_flash(bd);
+	print_eth_ip_addr();
+	print_baudrate();
 	print_std_bdinfo(bd);
 	print_num("relocaddr", gd->relocaddr);
 	print_num("reloc off", gd->reloc_off);
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 19/36] bdinfo: ppc: Drop arch-specific print_baudrate()
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (17 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 18/36] bdinfo: Drop print_std_bdinfo() Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:09   ` Bin Meng
  2020-05-06 15:09   ` Stefan Roese
  2020-05-04 23:17 ` [PATCH 20/36] bdinfo: sh: arc: Drop arch-specific print_bi_mem() Simon Glass
                   ` (17 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This function outputs the same basic info. Since the baud rate is commonly
115200 these is often no difference. Drop the arch-specific code and
inline it to avoid a one-line function.

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

 cmd/bdinfo.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 4e08d9e40a..62eea010c5 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -137,15 +137,6 @@ static void print_eth_ip_addr(void)
 #endif
 }
 
-static void print_baudrate(void)
-{
-#if defined(CONFIG_PPC)
-	printf("baudrate    = %6u bps\n", gd->baudrate);
-#else
-	printf("baudrate    = %u bps\n", gd->baudrate);
-#endif
-}
-
 void __weak board_detail(void)
 {
 	/* Please define board_detail() for your PPC platform */
@@ -165,8 +156,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	print_bi_mem(bd);
 	print_bi_flash(bd);
 	print_eth_ip_addr();
-	print_baudrate();
-	print_std_bdinfo(bd);
+	printf("baudrate    = %u bps\n", gd->baudrate);
 	print_num("relocaddr", gd->relocaddr);
 	print_num("reloc off", gd->reloc_off);
 	print_cpu_word_size();
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 20/36] bdinfo: sh: arc: Drop arch-specific print_bi_mem()
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (18 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 19/36] bdinfo: ppc: Drop arch-specific print_baudrate() Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:09   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 21/36] bdinfo: Drop print_bi_boot_params() Simon Glass
                   ` (16 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

It isn't worth having arch-specific code for such minor output
differences. In fact it is better if all archs are consistent.

Drop the arch-specific code in print_bi_mem() and inline it to avoid a
two-line function.

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

 cmd/bdinfo.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 62eea010c5..5ffd86e508 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -78,20 +78,6 @@ static void print_bi_boot_params(const bd_t *bd)
 	print_num("boot_params",	(ulong)bd->bi_boot_params);
 }
 
-static void print_bi_mem(const bd_t *bd)
-{
-#if defined(CONFIG_SH)
-	print_num("mem start      ",	(ulong)bd->bi_memstart);
-	print_lnum("mem size       ",	(u64)bd->bi_memsize);
-#elif defined(CONFIG_ARC)
-	print_num("mem start",		(ulong)bd->bi_memstart);
-	print_lnum("mem size",		(u64)bd->bi_memsize);
-#else
-	print_num("memstart",		(ulong)bd->bi_memstart);
-	print_lnum("memsize",		(u64)bd->bi_memsize);
-#endif
-}
-
 static void print_bi_dram(const bd_t *bd)
 {
 #ifdef CONFIG_NR_DRAM_BANKS
@@ -153,7 +139,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		print_num("arch_number", bd->bi_arch_number);
 	print_bi_boot_params(bd);
 	print_bi_dram(bd);
-	print_bi_mem(bd);
+	print_num("memstart", (ulong)bd->bi_memstart);
+	print_lnum("memsize", (u64)bd->bi_memsize);
 	print_bi_flash(bd);
 	print_eth_ip_addr();
 	printf("baudrate    = %u bps\n", gd->baudrate);
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 21/36] bdinfo: Drop print_bi_boot_params()
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (19 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 20/36] bdinfo: sh: arc: Drop arch-specific print_bi_mem() Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:09   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 22/36] bdinfo: Drop print_bi_flash() Simon Glass
                   ` (15 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This function only has one line of code in it so inline it.

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

 cmd/bdinfo.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 5ffd86e508..b65eec332d 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -72,12 +72,6 @@ static void print_mhz(const char *name, unsigned long hz)
 	printf("%-12s= %6s MHz\n", name, strmhz(buf, hz));
 }
 
-
-static void print_bi_boot_params(const bd_t *bd)
-{
-	print_num("boot_params",	(ulong)bd->bi_boot_params);
-}
-
 static void print_bi_dram(const bd_t *bd)
 {
 #ifdef CONFIG_NR_DRAM_BANKS
@@ -137,7 +131,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 #endif
 	if (IS_ENABLED(CONFIG_ARM))
 		print_num("arch_number", bd->bi_arch_number);
-	print_bi_boot_params(bd);
+	print_num("boot_params", (ulong)bd->bi_boot_params);
 	print_bi_dram(bd);
 	print_num("memstart", (ulong)bd->bi_memstart);
 	print_lnum("memsize", (u64)bd->bi_memsize);
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 22/36] bdinfo: Drop print_bi_flash()
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (20 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 21/36] bdinfo: Drop print_bi_boot_params() Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:09   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 23/36] bdinfo: Drop print_cpu_word_size() Simon Glass
                   ` (14 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This function only has three lines of code in it so inline it.

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

 cmd/bdinfo.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index b65eec332d..f22dc7a129 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -87,13 +87,6 @@ static void print_bi_dram(const bd_t *bd)
 #endif
 }
 
-static void print_bi_flash(const bd_t *bd)
-{
-	print_num("flashstart", (ulong)bd->bi_flashstart);
-	print_num("flashsize", (ulong)bd->bi_flashsize);
-	print_num("flashoffset", (ulong)bd->bi_flashoffset);
-}
-
 static void print_eth_ip_addr(void)
 {
 #if defined(CONFIG_CMD_NET)
@@ -135,7 +128,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	print_bi_dram(bd);
 	print_num("memstart", (ulong)bd->bi_memstart);
 	print_lnum("memsize", (u64)bd->bi_memsize);
-	print_bi_flash(bd);
+	print_num("flashstart", (ulong)bd->bi_flashstart);
+	print_num("flashsize", (ulong)bd->bi_flashsize);
+	print_num("flashoffset", (ulong)bd->bi_flashoffset);
 	print_eth_ip_addr();
 	printf("baudrate    = %u bps\n", gd->baudrate);
 	print_num("relocaddr", gd->relocaddr);
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 23/36] bdinfo: Drop print_cpu_word_size()
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (21 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 22/36] bdinfo: Drop print_bi_flash() Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:09   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 24/36] bdinfo: net: ppc: Drop bi_enet1addr and other similar info Simon Glass
                   ` (13 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This function only has one line of code in it so inline it.

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

 cmd/bdinfo.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index f22dc7a129..d0afef5b5e 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -15,11 +15,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void print_cpu_word_size(void)
-{
-	printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
-}
-
 static void print_num(const char *name, ulong value)
 {
 	printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value);
@@ -135,7 +130,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	printf("baudrate    = %u bps\n", gd->baudrate);
 	print_num("relocaddr", gd->relocaddr);
 	print_num("reloc off", gd->reloc_off);
-	print_cpu_word_size();
+	printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
 #if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
 	print_eths();
 #endif
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 24/36] bdinfo: net: ppc: Drop bi_enet1addr and other similar info
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (22 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 23/36] bdinfo: Drop print_cpu_word_size() Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:09   ` Bin Meng
  2020-05-06 15:09   ` Stefan Roese
  2020-05-04 23:17 ` [PATCH 25/36] bdinfo: net: ppc: Drop prints for CONFIG_HAS_ETHn Simon Glass
                   ` (12 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

These values were 'old' in 2013 so it should be safe to remove them. They
are never set in U-Boot anyway, so the values will always be zero.

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

 common/board_r.c             | 16 +---------------
 include/asm-generic/u-boot.h | 17 -----------------
 2 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/common/board_r.c b/common/board_r.c
index d9015cd057..4876afba6b 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -525,21 +525,7 @@ static int initr_ethaddr(void)
 
 	/* kept around for legacy kernels only ... ignore the next section */
 	eth_env_get_enetaddr("ethaddr", bd->bi_enetaddr);
-#ifdef CONFIG_HAS_ETH1
-	eth_env_get_enetaddr("eth1addr", bd->bi_enet1addr);
-#endif
-#ifdef CONFIG_HAS_ETH2
-	eth_env_get_enetaddr("eth2addr", bd->bi_enet2addr);
-#endif
-#ifdef CONFIG_HAS_ETH3
-	eth_env_get_enetaddr("eth3addr", bd->bi_enet3addr);
-#endif
-#ifdef CONFIG_HAS_ETH4
-	eth_env_get_enetaddr("eth4addr", bd->bi_enet4addr);
-#endif
-#ifdef CONFIG_HAS_ETH5
-	eth_env_get_enetaddr("eth5addr", bd->bi_enet5addr);
-#endif
+
 	return 0;
 }
 #endif /* CONFIG_CMD_NET */
diff --git a/include/asm-generic/u-boot.h b/include/asm-generic/u-boot.h
index be0014c3b3..0ec4522653 100644
--- a/include/asm-generic/u-boot.h
+++ b/include/asm-generic/u-boot.h
@@ -67,23 +67,6 @@ typedef struct bd_info {
 	unsigned long bi_vcofreq;	/* vco Freq in MHz */
 	unsigned long bi_flbfreq;	/* Flexbus Freq in MHz */
 #endif
-
-#ifdef CONFIG_HAS_ETH1
-	unsigned char   bi_enet1addr[6];	/* OLD: see README.enetaddr */
-#endif
-#ifdef CONFIG_HAS_ETH2
-	unsigned char	bi_enet2addr[6];	/* OLD: see README.enetaddr */
-#endif
-#ifdef CONFIG_HAS_ETH3
-	unsigned char   bi_enet3addr[6];	/* OLD: see README.enetaddr */
-#endif
-#ifdef CONFIG_HAS_ETH4
-	unsigned char   bi_enet4addr[6];	/* OLD: see README.enetaddr */
-#endif
-#ifdef CONFIG_HAS_ETH5
-	unsigned char   bi_enet5addr[6];	/* OLD: see README.enetaddr */
-#endif
-
 	ulong	        bi_arch_number;	/* unique id for this board */
 	ulong	        bi_boot_params;	/* where this board expects params */
 #ifdef CONFIG_NR_DRAM_BANKS
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 25/36] bdinfo: net: ppc: Drop prints for CONFIG_HAS_ETHn
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (23 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 24/36] bdinfo: net: ppc: Drop bi_enet1addr and other similar info Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:09   ` Bin Meng
  2020-05-06 15:10   ` Stefan Roese
  2020-05-04 23:17 ` [PATCH 26/36] bdinfo: net: Drop legacy ethernet bdinfo Simon Glass
                   ` (11 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

These config options have not been migrated to Kconfig. This should be
handled using driver model, iterating over the available Ethernet devices.
For now, remove the code.

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

 cmd/bdinfo.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index d0afef5b5e..6fa8b32389 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -86,21 +86,6 @@ static void print_eth_ip_addr(void)
 {
 #if defined(CONFIG_CMD_NET)
 	print_eth(0);
-#if defined(CONFIG_HAS_ETH1)
-	print_eth(1);
-#endif
-#if defined(CONFIG_HAS_ETH2)
-	print_eth(2);
-#endif
-#if defined(CONFIG_HAS_ETH3)
-	print_eth(3);
-#endif
-#if defined(CONFIG_HAS_ETH4)
-	print_eth(4);
-#endif
-#if defined(CONFIG_HAS_ETH5)
-	print_eth(5);
-#endif
 	printf("IP addr     = %s\n", env_get("ipaddr"));
 #endif
 }
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 26/36] bdinfo: net: Drop legacy ethernet bdinfo
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (24 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 25/36] bdinfo: net: ppc: Drop prints for CONFIG_HAS_ETHn Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:09   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 27/36] bdinfo: net: Inline print_eths() Simon Glass
                   ` (10 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This code pre-dates driver model and the migration date is nearly upon us.
Pare the print_eths() function down and enable it for driver model, since
it works correctly.

The IP address is already printed in print_eth_ip_addr() so we can remove
that.

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

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

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 6fa8b32389..ba69575fc2 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -34,26 +34,10 @@ static void print_eth(int idx)
 	printf("%-12s= %s\n", name, val);
 }
 
-#ifndef CONFIG_DM_ETH
-__maybe_unused
 static void print_eths(void)
 {
-	struct eth_device *dev;
-	int i = 0;
-
-	do {
-		dev = eth_get_dev_by_index(i);
-		if (dev) {
-			printf("eth%dname    = %s\n", i, dev->name);
-			print_eth(i);
-			i++;
-		}
-	} while (dev);
-
 	printf("current eth = %s\n", eth_get_name());
-	printf("ip_addr     = %s\n", env_get("ipaddr"));
 }
-#endif
 
 static void print_lnum(const char *name, unsigned long long value)
 {
@@ -116,9 +100,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	print_num("relocaddr", gd->relocaddr);
 	print_num("reloc off", gd->reloc_off);
 	printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
-#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
-	print_eths();
-#endif
+	if (IS_ENABLED(CONFIG_CMD_NET))
+		print_eths();
 	print_num("fdt_blob", (ulong)gd->fdt_blob);
 	print_num("new_fdt", (ulong)gd->new_fdt);
 	print_num("fdt_size", (ulong)gd->fdt_size);
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 27/36] bdinfo: net: Inline print_eths()
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (25 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 26/36] bdinfo: net: Drop legacy ethernet bdinfo Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:10   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 28/36] bdinfo: net: Inline print_eth_ip_addr() Simon Glass
                   ` (9 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This function has only one line of code so inline it.

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

 cmd/bdinfo.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index ba69575fc2..e6237daf93 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -34,11 +34,6 @@ static void print_eth(int idx)
 	printf("%-12s= %s\n", name, val);
 }
 
-static void print_eths(void)
-{
-	printf("current eth = %s\n", eth_get_name());
-}
-
 static void print_lnum(const char *name, unsigned long long value)
 {
 	printf("%-12s= 0x%.8llX\n", name, value);
@@ -101,7 +96,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	print_num("reloc off", gd->reloc_off);
 	printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
 	if (IS_ENABLED(CONFIG_CMD_NET))
-		print_eths();
+		printf("current eth = %s\n", eth_get_name());
 	print_num("fdt_blob", (ulong)gd->fdt_blob);
 	print_num("new_fdt", (ulong)gd->new_fdt);
 	print_num("fdt_size", (ulong)gd->fdt_size);
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 28/36] bdinfo: net: Inline print_eth_ip_addr()
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (26 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 27/36] bdinfo: net: Inline print_eths() Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:10   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 29/36] bdinfo: Export some basic printing functions Simon Glass
                   ` (8 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

This function only has two lines of code now, so inline it.

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

 cmd/bdinfo.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index e6237daf93..e30d530411 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -20,7 +20,6 @@ static void print_num(const char *name, ulong value)
 	printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value);
 }
 
-__maybe_unused
 static void print_eth(int idx)
 {
 	char name[10], *val;
@@ -61,14 +60,6 @@ static void print_bi_dram(const bd_t *bd)
 #endif
 }
 
-static void print_eth_ip_addr(void)
-{
-#if defined(CONFIG_CMD_NET)
-	print_eth(0);
-	printf("IP addr     = %s\n", env_get("ipaddr"));
-#endif
-}
-
 void __weak board_detail(void)
 {
 	/* Please define board_detail() for your PPC platform */
@@ -90,13 +81,15 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	print_num("flashstart", (ulong)bd->bi_flashstart);
 	print_num("flashsize", (ulong)bd->bi_flashsize);
 	print_num("flashoffset", (ulong)bd->bi_flashoffset);
-	print_eth_ip_addr();
 	printf("baudrate    = %u bps\n", gd->baudrate);
 	print_num("relocaddr", gd->relocaddr);
 	print_num("reloc off", gd->reloc_off);
 	printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
-	if (IS_ENABLED(CONFIG_CMD_NET))
+	if (IS_ENABLED(CONFIG_CMD_NET)) {
 		printf("current eth = %s\n", eth_get_name());
+		print_eth(0);
+		printf("IP addr     = %s\n", env_get("ipaddr"));
+	}
 	print_num("fdt_blob", (ulong)gd->fdt_blob);
 	print_num("new_fdt", (ulong)gd->new_fdt);
 	print_num("fdt_size", (ulong)gd->fdt_size);
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 29/36] bdinfo: Export some basic printing functions
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (27 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 28/36] bdinfo: net: Inline print_eth_ip_addr() Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:10   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 30/36] bdinfo: arm: Move ARM-specific info into its own file Simon Glass
                   ` (7 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

At present the functions to print a number and a frequency are static. We
want to move some of the code in here to an arch-specific file. For
consistency that code should use these same functions. So export them with
an appropriate name.

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

 cmd/bdinfo.c   | 78 +++++++++++++++++++++++++-------------------------
 include/init.h |  6 ++++
 2 files changed, 45 insertions(+), 39 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index e30d530411..c6096a5fd3 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -15,7 +15,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static void print_num(const char *name, ulong value)
+void bdinfo_print_num(const char *name, ulong value)
 {
 	printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value);
 }
@@ -38,7 +38,7 @@ static void print_lnum(const char *name, unsigned long long value)
 	printf("%-12s= 0x%.8llX\n", name, value);
 }
 
-static void print_mhz(const char *name, unsigned long hz)
+void bdinfo_print_mhz(const char *name, unsigned long hz)
 {
 	char buf[32];
 
@@ -52,9 +52,9 @@ static void print_bi_dram(const bd_t *bd)
 
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
 		if (bd->bi_dram[i].size) {
-			print_num("DRAM bank",	i);
-			print_num("-> start",	bd->bi_dram[i].start);
-			print_num("-> size",	bd->bi_dram[i].size);
+			bdinfo_print_num("DRAM bank",	i);
+			bdinfo_print_num("-> start",	bd->bi_dram[i].start);
+			bdinfo_print_num("-> size",	bd->bi_dram[i].size);
 		}
 	}
 #endif
@@ -70,50 +70,50 @@ 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);
+	bdinfo_print_num("bd address", (ulong)bd);
 #endif
 	if (IS_ENABLED(CONFIG_ARM))
-		print_num("arch_number", bd->bi_arch_number);
-	print_num("boot_params", (ulong)bd->bi_boot_params);
+		bdinfo_print_num("arch_number", bd->bi_arch_number);
+	bdinfo_print_num("boot_params", (ulong)bd->bi_boot_params);
 	print_bi_dram(bd);
-	print_num("memstart", (ulong)bd->bi_memstart);
+	bdinfo_print_num("memstart", (ulong)bd->bi_memstart);
 	print_lnum("memsize", (u64)bd->bi_memsize);
-	print_num("flashstart", (ulong)bd->bi_flashstart);
-	print_num("flashsize", (ulong)bd->bi_flashsize);
-	print_num("flashoffset", (ulong)bd->bi_flashoffset);
+	bdinfo_print_num("flashstart", (ulong)bd->bi_flashstart);
+	bdinfo_print_num("flashsize", (ulong)bd->bi_flashsize);
+	bdinfo_print_num("flashoffset", (ulong)bd->bi_flashoffset);
 	printf("baudrate    = %u bps\n", gd->baudrate);
-	print_num("relocaddr", gd->relocaddr);
-	print_num("reloc off", gd->reloc_off);
+	bdinfo_print_num("relocaddr", gd->relocaddr);
+	bdinfo_print_num("reloc off", gd->reloc_off);
 	printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
 	if (IS_ENABLED(CONFIG_CMD_NET)) {
 		printf("current eth = %s\n", eth_get_name());
 		print_eth(0);
 		printf("IP addr     = %s\n", env_get("ipaddr"));
 	}
-	print_num("fdt_blob", (ulong)gd->fdt_blob);
-	print_num("new_fdt", (ulong)gd->new_fdt);
-	print_num("fdt_size", (ulong)gd->fdt_size);
+	bdinfo_print_num("fdt_blob", (ulong)gd->fdt_blob);
+	bdinfo_print_num("new_fdt", (ulong)gd->new_fdt);
+	bdinfo_print_num("fdt_size", (ulong)gd->fdt_size);
 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO)
-	print_num("FB base  ", gd->fb_base);
+	bdinfo_print_num("FB base  ", gd->fb_base);
 #endif
 
 	/* This section is used only by ARM */
 #ifdef CONFIG_ARM
 #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
 	if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) {
-		print_num("Secure ram",
+		bdinfo_print_num("Secure ram",
 			  gd->arch.secure_ram & MEM_RESERVE_SECURE_ADDR_MASK);
 	}
 #endif
 #ifdef CONFIG_RESV_RAM
 	if (gd->arch.resv_ram)
-		print_num("Reserved ram", gd->arch.resv_ram);
+		bdinfo_print_num("Reserved ram", gd->arch.resv_ram);
 #endif
 #if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
-	print_num("TLB addr", gd->arch.tlb_addr);
+	bdinfo_print_num("TLB addr", gd->arch.tlb_addr);
 #endif
-	print_num("irq_sp", gd->irq_sp);	/* irq stack pointer */
-	print_num("sp start ", gd->start_addr_sp);
+	bdinfo_print_num("irq_sp", gd->irq_sp);	/* irq stack pointer */
+	bdinfo_print_num("sp start ", gd->start_addr_sp);
 	/*
 	 * TODO: Currently only support for davinci SOC's is added.
 	 * Remove this check once all the board implement this.
@@ -131,17 +131,17 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	       CONFIG_VAL(SYS_MALLOC_F_LEN));
 #endif
 #if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
-	print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
+	bdinfo_print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
 #endif
 #endif /* CONFIG_ARM */
 
 	/* This section is used only by ppc */
 #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
-	print_num("immr_base", bd->bi_immr_base);
+	bdinfo_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);
+		bdinfo_print_num("bootflags", bd->bi_bootflags);
+		bdinfo_print_mhz("intfreq", bd->bi_intfreq);
 #ifdef CONFIG_ENABLE_36BIT_PHYS
 		if (IS_ENABLED(CONFIG_PHYS_64BIT))
 			puts("addressing  = 36-bit\n");
@@ -151,32 +151,32 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		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);
+	bdinfo_print_mhz("cpmfreq", bd->bi_cpmfreq);
+	bdinfo_print_mhz("vco", bd->bi_vco);
+	bdinfo_print_mhz("sccfreq", bd->bi_sccfreq);
+	bdinfo_print_mhz("brgfreq", bd->bi_brgfreq);
 #endif
 
 	/* This is used by m68k and ppc */
 #if defined(CONFIG_SYS_INIT_RAM_ADDR)
-	print_num("sramstart", (ulong)bd->bi_sramstart);
-	print_num("sramsize", (ulong)bd->bi_sramsize);
+	bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
+	bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
 #endif
 	if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_M68K))
-		print_mhz("busfreq", bd->bi_busfreq);
+		bdinfo_print_mhz("busfreq", bd->bi_busfreq);
 
 	/* The rest are used only by m68k */
 #ifdef CONFIG_M68K
 #if defined(CONFIG_SYS_MBAR)
 	print_num("mbar", bd->bi_mbar_base);
 #endif
-	print_mhz("cpufreq", bd->bi_intfreq);
+	bdinfo_print_mhz("cpufreq", bd->bi_intfreq);
 	if (IS_ENABLED(CONFIG_PCI))
-		print_mhz("pcifreq", bd->bi_pcifreq);
+		bdinfo_print_mhz("pcifreq", bd->bi_pcifreq);
 #ifdef CONFIG_EXTRA_CLOCK
-	print_mhz("flbfreq", bd->bi_flbfreq);
-	print_mhz("inpfreq", bd->bi_inpfreq);
-	print_mhz("vcofreq", bd->bi_vcofreq);
+	bdinfo_print_mhz("flbfreq", bd->bi_flbfreq);
+	bdinfo_print_mhz("inpfreq", bd->bi_inpfreq);
+	bdinfo_print_mhz("vcofreq", bd->bi_vcofreq);
 #endif
 #endif
 
diff --git a/include/init.h b/include/init.h
index b5a167b6ed..af4deed566 100644
--- a/include/init.h
+++ b/include/init.h
@@ -261,6 +261,12 @@ void relocate_code(ulong start_addr_sp, struct global_data *new_gd,
 	__attribute__ ((noreturn));
 #endif
 
+/* Print a numeric value (for use in arch_print_bdinfo()) */
+void bdinfo_print_num(const char *name, ulong value);
+
+/* Print a clock speed in MHz */
+void bdinfo_print_mhz(const char *name, unsigned long hz);
+
 #endif	/* __ASSEMBLY__ */
 /* Put only stuff here that the assembler can digest */
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 30/36] bdinfo: arm: Move ARM-specific info into its own file
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (28 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 29/36] bdinfo: Export some basic printing functions Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:10   ` Bin Meng
  2020-05-06 16:10   ` Daniel Schwierzeck
  2020-05-04 23:17 ` [PATCH 31/36] bdinfo: ppc: Move PPC-specific " Simon Glass
                   ` (6 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

We don't really want to have ARM-specific code in a generic file. Create
a new arch-specific function to hold it, and move it into that.

Make the function weak so that any arch can implement it.

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

 arch/arm/lib/Makefile |  1 +
 arch/arm/lib/bdinfo.c | 51 +++++++++++++++++++++++++++++++++++++++++++
 cmd/bdinfo.c          | 44 +++++--------------------------------
 include/init.h        |  3 +++
 4 files changed, 61 insertions(+), 38 deletions(-)
 create mode 100644 arch/arm/lib/bdinfo.c

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index b839aa7a50..27b12e7f2b 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -43,6 +43,7 @@ obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o
 obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o
 obj-$(CONFIG_SEMIHOSTING) += semihosting.o
 
+obj-y	+= bdinfo.o
 obj-y	+= sections.o
 obj-y	+= stack.o
 ifdef CONFIG_CPU_V7M
diff --git a/arch/arm/lib/bdinfo.c b/arch/arm/lib/bdinfo.c
new file mode 100644
index 0000000000..ce8edd0313
--- /dev/null
+++ b/arch/arm/lib/bdinfo.c
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * ARM-specific information for the 'bd' command
+ *
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ */
+
+#include <common.h>
+#include <init.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void arch_print_bdinfo(void)
+{
+#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
+	if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) {
+		bdinfo_print_num("Secure ram",
+				 gd->arch.secure_ram &
+				 MEM_RESERVE_SECURE_ADDR_MASK);
+	}
+#endif
+#ifdef CONFIG_RESV_RAM
+	if (gd->arch.resv_ram)
+		bdinfo_print_num("Reserved ram", gd->arch.resv_ram);
+#endif
+#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
+	bdinfo_print_num("TLB addr", gd->arch.tlb_addr);
+#endif
+	bdinfo_print_num("irq_sp", gd->irq_sp);	/* irq stack pointer */
+	bdinfo_print_num("sp start ", gd->start_addr_sp);
+	/*
+	 * TODO: Currently only support for davinci SOC's is added.
+	 * Remove this check once all the board implement this.
+	 */
+#ifdef CONFIG_CLOCKS
+	printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
+	printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
+	printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
+#endif
+#ifdef CONFIG_BOARD_TYPES
+	printf("Board Type  = %ld\n", gd->board_type);
+#endif
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+	printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr,
+	       CONFIG_VAL(SYS_MALLOC_F_LEN));
+#endif
+#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
+	bdinfo_print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
+#endif
+}
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index c6096a5fd3..55a9244aef 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -65,6 +65,10 @@ void __weak board_detail(void)
 	/* Please define board_detail() for your PPC platform */
 }
 
+__weak void arch_print_bdinfo(void)
+{
+}
+
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
 	bd_t *bd = gd->bd;
@@ -97,43 +101,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	bdinfo_print_num("FB base  ", gd->fb_base);
 #endif
 
-	/* This section is used only by ARM */
-#ifdef CONFIG_ARM
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-	if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) {
-		bdinfo_print_num("Secure ram",
-			  gd->arch.secure_ram & MEM_RESERVE_SECURE_ADDR_MASK);
-	}
-#endif
-#ifdef CONFIG_RESV_RAM
-	if (gd->arch.resv_ram)
-		bdinfo_print_num("Reserved ram", gd->arch.resv_ram);
-#endif
-#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
-	bdinfo_print_num("TLB addr", gd->arch.tlb_addr);
-#endif
-	bdinfo_print_num("irq_sp", gd->irq_sp);	/* irq stack pointer */
-	bdinfo_print_num("sp start ", gd->start_addr_sp);
-	/*
-	 * TODO: Currently only support for davinci SOC's is added.
-	 * Remove this check once all the board implement this.
-	 */
-#ifdef CONFIG_CLOCKS
-	printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
-	printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
-	printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
-#endif
-#ifdef CONFIG_BOARD_TYPES
-	printf("Board Type  = %ld\n", gd->board_type);
-#endif
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
-	printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr,
-	       CONFIG_VAL(SYS_MALLOC_F_LEN));
-#endif
-#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
-	bdinfo_print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
-#endif
-#endif /* CONFIG_ARM */
+	arch_print_bdinfo();
 
 	/* This section is used only by ppc */
 #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
@@ -168,7 +136,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	/* The rest are used only by m68k */
 #ifdef CONFIG_M68K
 #if defined(CONFIG_SYS_MBAR)
-	print_num("mbar", bd->bi_mbar_base);
+	bdinfo_print_num("mbar", bd->bi_mbar_base);
 #endif
 	bdinfo_print_mhz("cpufreq", bd->bi_intfreq);
 	if (IS_ENABLED(CONFIG_PCI))
diff --git a/include/init.h b/include/init.h
index af4deed566..e727031514 100644
--- a/include/init.h
+++ b/include/init.h
@@ -267,6 +267,9 @@ void bdinfo_print_num(const char *name, ulong value);
 /* Print a clock speed in MHz */
 void bdinfo_print_mhz(const char *name, unsigned long hz);
 
+/* Show arch-specific information for the 'bd' command */
+void arch_print_bdinfo(void);
+
 #endif	/* __ASSEMBLY__ */
 /* Put only stuff here that the assembler can digest */
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 31/36] bdinfo: ppc: Move PPC-specific info into its own file
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (29 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 30/36] bdinfo: arm: Move ARM-specific info into its own file Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:10   ` Bin Meng
  2020-05-06 15:10   ` Stefan Roese
  2020-05-04 23:17 ` [PATCH 32/36] bdinfo: m68k: Move m68k-specific " Simon Glass
                   ` (5 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

We don't really want to have PPC-specific code in a generic file. Create
a new arch-specific function to hold it, and move it into that.

Make the function weak so that any arch can implement it.

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

 arch/powerpc/lib/Makefile |  2 ++
 arch/powerpc/lib/bdinfo.c | 41 +++++++++++++++++++++++++++++++++++++++
 cmd/bdinfo.c              | 27 --------------------------
 3 files changed, 43 insertions(+), 27 deletions(-)
 create mode 100644 arch/powerpc/lib/bdinfo.c

diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 01c9dd51be..f61809ab05 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -15,6 +15,8 @@ MINIMAL=y
 endif
 endif
 
+obj-y	+= bdinfo.o
+
 ifdef MINIMAL
 obj-y += cache.o time.o
 ifndef CONFIG_TIMER
diff --git a/arch/powerpc/lib/bdinfo.c b/arch/powerpc/lib/bdinfo.c
new file mode 100644
index 0000000000..da09bb276f
--- /dev/null
+++ b/arch/powerpc/lib/bdinfo.c
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * PPC-specific information for the 'bd' command
+ *
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ */
+
+#include <common.h>
+#include <init.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void __weak board_detail(void)
+{
+	/* Please define board_detail() for your PPC platform */
+}
+
+void arch_print_bdinfo(void)
+{
+	bd_t *bd = gd->bd;
+
+#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
+	bdinfo_print_num("immr_base", bd->bi_immr_base);
+#endif
+	bdinfo_print_num("bootflags", bd->bi_bootflags);
+	bdinfo_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
+	board_detail();
+#if defined(CONFIG_CPM2)
+	bdinfo_print_mhz("cpmfreq", bd->bi_cpmfreq);
+	bdinfo_print_mhz("vco", bd->bi_vco);
+	bdinfo_print_mhz("sccfreq", bd->bi_sccfreq);
+	bdinfo_print_mhz("brgfreq", bd->bi_brgfreq);
+#endif
+}
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 55a9244aef..570022052c 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -60,11 +60,6 @@ static void print_bi_dram(const bd_t *bd)
 #endif
 }
 
-void __weak board_detail(void)
-{
-	/* Please define board_detail() for your PPC platform */
-}
-
 __weak void arch_print_bdinfo(void)
 {
 }
@@ -103,28 +98,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 
 	arch_print_bdinfo();
 
-	/* This section is used only by ppc */
-#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
-	bdinfo_print_num("immr_base", bd->bi_immr_base);
-#endif
-	if (IS_ENABLED(CONFIG_PPC)) {
-		bdinfo_print_num("bootflags", bd->bi_bootflags);
-		bdinfo_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
-		board_detail();
-	}
-#if defined(CONFIG_CPM2)
-	bdinfo_print_mhz("cpmfreq", bd->bi_cpmfreq);
-	bdinfo_print_mhz("vco", bd->bi_vco);
-	bdinfo_print_mhz("sccfreq", bd->bi_sccfreq);
-	bdinfo_print_mhz("brgfreq", bd->bi_brgfreq);
-#endif
-
 	/* This is used by m68k and ppc */
 #if defined(CONFIG_SYS_INIT_RAM_ADDR)
 	bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 32/36] bdinfo: m68k: Move m68k-specific info into its own file
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (30 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 31/36] bdinfo: ppc: Move PPC-specific " Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:10   ` Bin Meng
  2020-05-06 20:11   ` Angelo Dureghello
  2020-05-04 23:17 ` [PATCH 33/36] bdinfo: m68k: ppc: Move arch-specific code from bdinfo Simon Glass
                   ` (4 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

We don't really want to have m68k-specific code in a generic file. Create
a new arch-specific function to hold it, and move it into that.

Make the function weak so that any arch can implement it.

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

 arch/m68k/lib/Makefile |  1 +
 arch/m68k/lib/bdinfo.c | 29 +++++++++++++++++++++++++++++
 cmd/bdinfo.c           | 15 ---------------
 3 files changed, 30 insertions(+), 15 deletions(-)
 create mode 100644 arch/m68k/lib/bdinfo.c

diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index a040f40eb8..b66d66afd2 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -7,6 +7,7 @@
 ## if the user asked for it
 lib-$(CONFIG_USE_PRIVATE_LIBGCC) += lshrdi3.o muldi3.o ashldi3.o
 
+obj-y	+= bdinfo.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 obj-y	+= cache.o
 obj-y	+= interrupts.o
diff --git a/arch/m68k/lib/bdinfo.c b/arch/m68k/lib/bdinfo.c
new file mode 100644
index 0000000000..09a1abfc21
--- /dev/null
+++ b/arch/m68k/lib/bdinfo.c
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * PPC-specific information for the 'bd' command
+ *
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ */
+
+#include <common.h>
+#include <init.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void arch_print_bdinfo(void)
+{
+	bd_t *bd = gd->bd;
+
+#if defined(CONFIG_SYS_MBAR)
+	bdinfo_print_num("mbar", bd->bi_mbar_base);
+#endif
+	bdinfo_print_mhz("cpufreq", bd->bi_intfreq);
+	if (IS_ENABLED(CONFIG_PCI))
+		bdinfo_print_mhz("pcifreq", bd->bi_pcifreq);
+#ifdef CONFIG_EXTRA_CLOCK
+	bdinfo_print_mhz("flbfreq", bd->bi_flbfreq);
+	bdinfo_print_mhz("inpfreq", bd->bi_inpfreq);
+	bdinfo_print_mhz("vcofreq", bd->bi_vcofreq);
+#endif
+}
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 570022052c..f0afdb153f 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -106,21 +106,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_M68K))
 		bdinfo_print_mhz("busfreq", bd->bi_busfreq);
 
-	/* The rest are used only by m68k */
-#ifdef CONFIG_M68K
-#if defined(CONFIG_SYS_MBAR)
-	bdinfo_print_num("mbar", bd->bi_mbar_base);
-#endif
-	bdinfo_print_mhz("cpufreq", bd->bi_intfreq);
-	if (IS_ENABLED(CONFIG_PCI))
-		bdinfo_print_mhz("pcifreq", bd->bi_pcifreq);
-#ifdef CONFIG_EXTRA_CLOCK
-	bdinfo_print_mhz("flbfreq", bd->bi_flbfreq);
-	bdinfo_print_mhz("inpfreq", bd->bi_inpfreq);
-	bdinfo_print_mhz("vcofreq", bd->bi_vcofreq);
-#endif
-#endif
-
 	return 0;
 }
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 33/36] bdinfo: m68k: ppc: Move arch-specific code from bdinfo
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (31 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 32/36] bdinfo: m68k: Move m68k-specific " Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:10   ` Bin Meng
  2020-05-06 15:10   ` Stefan Roese
  2020-05-04 23:17 ` [PATCH 34/36] bdinfo: Update the file comments Simon Glass
                   ` (3 subsequent siblings)
  36 siblings, 2 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

We don't have an easy way to share these three lines of code with two
architectures. We also want to make it clear that this code is actually
arch-specific.

So just duplicate it in each arch-specific file.

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

 arch/m68k/lib/bdinfo.c    | 5 +++++
 arch/powerpc/lib/bdinfo.c | 5 +++++
 cmd/bdinfo.c              | 8 --------
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/m68k/lib/bdinfo.c b/arch/m68k/lib/bdinfo.c
index 09a1abfc21..971c47c306 100644
--- a/arch/m68k/lib/bdinfo.c
+++ b/arch/m68k/lib/bdinfo.c
@@ -15,6 +15,11 @@ void arch_print_bdinfo(void)
 {
 	bd_t *bd = gd->bd;
 
+#if defined(CONFIG_SYS_INIT_RAM_ADDR)
+	bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
+	bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
+#endif
+	bdinfo_print_mhz("busfreq", bd->bi_busfreq);
 #if defined(CONFIG_SYS_MBAR)
 	bdinfo_print_num("mbar", bd->bi_mbar_base);
 #endif
diff --git a/arch/powerpc/lib/bdinfo.c b/arch/powerpc/lib/bdinfo.c
index da09bb276f..d8c64155f0 100644
--- a/arch/powerpc/lib/bdinfo.c
+++ b/arch/powerpc/lib/bdinfo.c
@@ -20,6 +20,11 @@ void arch_print_bdinfo(void)
 {
 	bd_t *bd = gd->bd;
 
+#if defined(CONFIG_SYS_INIT_RAM_ADDR)
+	bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
+	bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
+#endif
+	bdinfo_print_mhz("busfreq", bd->bi_busfreq);
 #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
 	bdinfo_print_num("immr_base", bd->bi_immr_base);
 #endif
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index f0afdb153f..aea7cf904a 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -98,14 +98,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 
 	arch_print_bdinfo();
 
-	/* This is used by m68k and ppc */
-#if defined(CONFIG_SYS_INIT_RAM_ADDR)
-	bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
-	bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
-#endif
-	if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_M68K))
-		bdinfo_print_mhz("busfreq", bd->bi_busfreq);
-
 	return 0;
 }
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 34/36] bdinfo: Update the file comments
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (32 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 33/36] bdinfo: m68k: ppc: Move arch-specific code from bdinfo Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:10   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 35/36] bdinfo: dm: Update fb_base when using driver model Simon Glass
                   ` (2 subsequent siblings)
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

Update the comment at the top of the file to indicate what this file does.
Also drop the line at the bottom and an unnecessary header include.

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

 cmd/bdinfo.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index aea7cf904a..8c498d4290 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -1,17 +1,15 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
+ * Implements the 'bd' command to show board information
+ *
  * (C) Copyright 2003
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  */
 
-/*
- * Boot support
- */
 #include <common.h>
 #include <command.h>
 #include <env.h>
 #include <vsprintf.h>
-#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -101,8 +99,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	return 0;
 }
 
-/* -------------------------------------------------------------------- */
-
 U_BOOT_CMD(
 	bdinfo,	1,	1,	do_bdinfo,
 	"print Board Info structure",
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 35/36] bdinfo: dm: Update fb_base when using driver model
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (33 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 34/36] bdinfo: Update the file comments Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:10   ` Bin Meng
  2020-05-04 23:17 ` [PATCH 36/36] bdinfo: x86: vesa: Update fb_base to the correct value Simon Glass
  2020-05-06  9:28 ` [PATCH 00/36] Tidy up the 'bd' command Alexey Brodkin
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

Update this value with the address of a video device so that it shows with
the 'bd' command.

It would be better to obtain the address from the uclass by looking in
struct video_uc_platdata for each device. We can move over to that once
DM_VIDEO migration is complete.

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

 drivers/video/video-uclass.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 3d658e61d7..e7229cefaf 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -82,6 +82,7 @@ int video_reserve(ulong *addrp)
 		      __func__, size, *addrp, dev->name);
 	}
 	gd->video_bottom = *addrp;
+	gd->fb_base = *addrp;
 	debug("Video frame buffers from %lx to %lx\n", gd->video_bottom,
 	      gd->video_top);
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 36/36] bdinfo: x86: vesa: Update fb_base to the correct value
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (34 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 35/36] bdinfo: dm: Update fb_base when using driver model Simon Glass
@ 2020-05-04 23:17 ` Simon Glass
  2020-05-06  8:10   ` Bin Meng
  2020-05-06  9:28 ` [PATCH 00/36] Tidy up the 'bd' command Alexey Brodkin
  36 siblings, 1 reply; 93+ messages in thread
From: Simon Glass @ 2020-05-04 23:17 UTC (permalink / raw)
  To: u-boot

Set this value in global_data so that it is reported correctly on x86
boards.

In fact, space is allocated for the frame buffer even though it is not
used. The FSP picks the address itself, which is why the current value
is wrong.

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

 arch/x86/lib/fsp/fsp_graphics.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/lib/fsp/fsp_graphics.c b/arch/x86/lib/fsp/fsp_graphics.c
index 98b762209f..46fb907dc3 100644
--- a/arch/x86/lib/fsp/fsp_graphics.c
+++ b/arch/x86/lib/fsp/fsp_graphics.c
@@ -96,6 +96,7 @@ static int fsp_video_probe(struct udevice *dev)
 	 * For IGD, it seems to be always on BAR2.
 	 */
 	vesa->phys_base_ptr = dm_pci_read_bar32(dev, 2);
+	gd->fb_base = vesa->phys_base_ptr;
 
 	ret = vbe_setup_video_priv(vesa, uc_priv, plat);
 	if (ret)
@@ -104,8 +105,8 @@ static int fsp_video_probe(struct udevice *dev)
 	mtrr_add_request(MTRR_TYPE_WRCOMB, vesa->phys_base_ptr, 256 << 20);
 	mtrr_commit(true);
 
-	printf("%dx%dx%d\n", uc_priv->xsize, uc_priv->ysize,
-	       vesa->bits_per_pixel);
+	printf("%dx%dx%d @ %x\n", uc_priv->xsize, uc_priv->ysize,
+	       vesa->bits_per_pixel, vesa->phys_base_ptr);
 
 	return 0;
 
-- 
2.26.2.526.g744177e7f7-goog

^ permalink raw reply related	[flat|nested] 93+ messages in thread

* [PATCH 01/36] bdinfo: nds32: Use generic bd_info
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4704736@ATCPCS16.andestech.com>
@ 2020-05-05  1:16     ` Rick Chen
  0 siblings, 0 replies; 93+ messages in thread
From: Rick Chen @ 2020-05-05  1:16 UTC (permalink / raw)
  To: u-boot

> From: Simon Glass [mailto:sjg at chromium.org]
> Sent: Tuesday, May 05, 2020 7:17 AM
> To: U-Boot Mailing List
> Cc: Tom Rini; Simon Glass; Joe Hershberger; Macpaul Lin; Rick Jian-Zhi Chen(???)
> Subject: [PATCH 01/36] bdinfo: nds32: Use generic bd_info
>
> At present nds32 still uses its own private bd_info struct. Move it over to use the generic one like other archs.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>

Reviewed-by: Rick Chen <rick@andestech.com>

>  arch/nds32/include/asm/u-boot.h | 20 ++------------------
>  1 file changed, 2 insertions(+), 18 deletions(-)
>
> diff --git a/arch/nds32/include/asm/u-boot.h b/arch/nds32/include/asm/u-boot.h index 8c949e7fb7..7b6e905f2a 100644
> --- a/arch/nds32/include/asm/u-boot.h
> +++ b/arch/nds32/include/asm/u-boot.h
> @@ -19,26 +19,10 @@
>  #ifndef _U_BOOT_H_
>  #define _U_BOOT_H_     1
>
> +/* Use the generic board which requires a unified bd_info */ #include
> +<asm-generic/u-boot.h>
>  #include <asm/u-boot-nds32.h>
>
> -
> -typedef struct bd_info {
> -       unsigned long   bi_arch_number; /* unique id for this board */
> -       unsigned long   bi_boot_params; /* where this board expects params */
> -       unsigned long   bi_memstart;    /* start of DRAM memory */
> -       unsigned long   bi_memsize;     /* size  of DRAM memory in bytes */
> -       unsigned long   bi_flashstart;  /* start of FLASH memory */
> -       unsigned long   bi_flashsize;   /* size  of FLASH memory */
> -       unsigned long   bi_flashoffset; /* reserved area for startup monitor */
> -       unsigned char   bi_enetaddr[6];
> -
> -       struct                          /* RAM configuration */
> -       {
> -               unsigned long start;
> -               unsigned long size;
> -       } bi_dram[CONFIG_NR_DRAM_BANKS];
> -} bd_t;
> -
>  /* For image.h:image_check_target_arch() */  #define IH_ARCH_DEFAULT IH_ARCH_NDS32
>
> --
> 2.26.2.526.g744177e7f7-goog

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 02/36] bdinfo: riscv: Use generic bd_info
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4704741@ATCPCS16.andestech.com>
@ 2020-05-05  1:19     ` Rick Chen
  0 siblings, 0 replies; 93+ messages in thread
From: Rick Chen @ 2020-05-05  1:19 UTC (permalink / raw)
  To: u-boot

> From: Simon Glass [mailto:sjg at chromium.org]
> Sent: Tuesday, May 05, 2020 7:17 AM
> To: U-Boot Mailing List
> Cc: Tom Rini; Simon Glass; Joe Hershberger; Rick Jian-Zhi Chen(???)
> Subject: [PATCH 02/36] bdinfo: riscv: Use generic bd_info
>
> At present riscv still uses its own private bd_info struct. Move it over to use the generic one like other archs.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>

Reviewed-by: Rick Chen <rick@andestech.com>

>  arch/riscv/include/asm/u-boot.h | 19 ++-----------------
>  1 file changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/arch/riscv/include/asm/u-boot.h b/arch/riscv/include/asm/u-boot.h index 5ba8e77812..d5e1d5f323 100644
> --- a/arch/riscv/include/asm/u-boot.h
> +++ b/arch/riscv/include/asm/u-boot.h
> @@ -18,25 +18,10 @@
>  #ifndef _U_BOOT_H_
>  #define _U_BOOT_H_     1
>
> +/* Use the generic board which requires a unified bd_info */ #include
> +<asm-generic/u-boot.h>
>  #include <asm/u-boot-riscv.h>
>
> -
> -typedef struct bd_info {
> -       unsigned long   bi_boot_params; /* where this board expects params */
> -       unsigned long   bi_memstart;    /* start of DRAM memory */
> -       unsigned long   bi_memsize;     /* size  of DRAM memory in bytes */
> -       unsigned long   bi_flashstart;  /* start of FLASH memory */
> -       unsigned long   bi_flashsize;   /* size  of FLASH memory */
> -       unsigned long   bi_flashoffset; /* reserved area for startup monitor */
> -       unsigned char   bi_enetaddr[6];
> -
> -       struct                          /* RAM configuration */
> -       {
> -               unsigned long start;
> -               unsigned long size;
> -       } bi_dram[CONFIG_NR_DRAM_BANKS];
> -} bd_t;
> -
>  /* For image.h:image_check_target_arch() */  #define IH_ARCH_DEFAULT IH_ARCH_RISCV
>
> --

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 11/36] bdinfo: nds32: Use the generic bd command
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA470474E@ATCPCS16.andestech.com>
@ 2020-05-05  1:22     ` Rick Chen
  0 siblings, 0 replies; 93+ messages in thread
From: Rick Chen @ 2020-05-05  1:22 UTC (permalink / raw)
  To: u-boot

> From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Simon Glass
> Sent: Tuesday, May 05, 2020 7:17 AM
> To: U-Boot Mailing List
> Cc: Tom Rini; Simon Glass; Bin Meng; Heiko Schocher; Macpaul Lin
> Subject: [PATCH 11/36] bdinfo: nds32: Use the generic bd command
>
> This arch has none of its own info to show. Move it over to use the generic do_bdinfo().
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>

Reviewed-by: Rick Chen <rick@andestech.com>

>  cmd/bdinfo.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index dce24b43fa..6a2bbfb348 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -337,19 +337,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>
>  #elif defined(CONFIG_NDS32)
>
> -int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{
> -       bd_t *bd = gd->bd;
> -
> -       print_num("arch_number",        bd->bi_arch_number);
> -       print_bi_boot_params(bd);
> -       print_bi_dram(bd);
> -       print_eth_ip_addr();
> -       print_baudrate();
> -       print_cpu_word_size();
> -
> -       return 0;
> -}
> +#define USE_GENERIC
>
>  #elif defined(CONFIG_RISCV)
>
> --
> 2.26.2.526.g744177e7f7-goog

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 12/36] bdinfo: riscv: Use the generic bd command
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4704755@ATCPCS16.andestech.com>
@ 2020-05-05  1:24     ` Rick Chen
  0 siblings, 0 replies; 93+ messages in thread
From: Rick Chen @ 2020-05-05  1:24 UTC (permalink / raw)
  To: u-boot

> From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Simon Glass
> Sent: Tuesday, May 05, 2020 7:17 AM
> To: U-Boot Mailing List
> Cc: Tom Rini; Simon Glass; Bin Meng; Heiko Schocher
> Subject: [PATCH 12/36] bdinfo: riscv: Use the generic bd command
>
> This arch has none of its own info to show. Move it over to use the generic do_bdinfo().
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>

Reviewed-by: Rick Chen <rick@andestech.com>

>  cmd/bdinfo.c | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 6a2bbfb348..0e96dd619c 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -341,20 +341,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>
>  #elif defined(CONFIG_RISCV)
>
> -int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{
> -       bd_t *bd = gd->bd;
> -
> -       print_bi_boot_params(bd);
> -       print_bi_dram(bd);
> -       print_num("relocaddr", gd->relocaddr);
> -       print_num("reloc off", gd->reloc_off);
> -       print_eth_ip_addr();
> -       print_baudrate();
> -       print_cpu_word_size();
> -
> -       return 0;
> -}
> +#define USE_GENERIC
>
>  #elif defined(CONFIG_ARC)
>
> --
> 2.26.2.526.g744177e7f7-goog

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 01/36] bdinfo: nds32: Use generic bd_info
  2020-05-04 23:16 ` [PATCH 01/36] bdinfo: nds32: Use generic bd_info Simon Glass
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4704736@ATCPCS16.andestech.com>
@ 2020-05-06  8:06   ` Bin Meng
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:06 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> At present nds32 still uses its own private bd_info struct. Move it over
> to use the generic one like other archs.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/nds32/include/asm/u-boot.h | 20 ++------------------
>  1 file changed, 2 insertions(+), 18 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 02/36] bdinfo: riscv: Use generic bd_info
  2020-05-04 23:16 ` [PATCH 02/36] bdinfo: riscv: " Simon Glass
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4704741@ATCPCS16.andestech.com>
@ 2020-05-06  8:06   ` Bin Meng
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:06 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> At present riscv still uses its own private bd_info struct. Move it over
> to use the generic one like other archs.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/riscv/include/asm/u-boot.h | 19 ++-----------------
>  1 file changed, 2 insertions(+), 17 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 03/36] bdinfo: m68k: Drop bd_info->bi_ipbfreq
  2020-05-04 23:16 ` [PATCH 03/36] bdinfo: m68k: Drop bd_info->bi_ipbfreq Simon Glass
@ 2020-05-06  8:06   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:06 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This field is not used anymore. Drop it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  include/asm-generic/u-boot.h | 1 -
>  1 file changed, 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 04/36] bdinfo: xtensa: Create a generic do_bdinfo for xtensa
  2020-05-04 23:17 ` [PATCH 04/36] bdinfo: xtensa: Create a generic do_bdinfo for xtensa Simon Glass
@ 2020-05-06  8:07   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:07 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This arch uses only the generic function. It would be nice if all the
> archs did the same. As a first step, create a new generic function for the
> 'bd' command and make xtensa use it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 05/36] bdinfo: mips: Use the generic bd command
  2020-05-04 23:17 ` [PATCH 05/36] bdinfo: mips: Use the generic bd command Simon Glass
@ 2020-05-06  8:07   ` Bin Meng
  2020-05-06 15:29   ` Daniel Schwierzeck
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:07 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> MIPS currently has a few extra things which are generally useful. Add them
> to the generic function and move MIPS over to use it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 06/36] bdinfo: nios2: Use the generic bd command
  2020-05-04 23:17 ` [PATCH 06/36] bdinfo: nios2: " Simon Glass
@ 2020-05-06  8:07   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:07 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> Nios2 currently has some code to output SRAM information which is behind
> an #ifdef. No nios2 boards define this option, so the code can be removed.
>
> Move Nios2 over to use the generic function.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 19 +------------------
>  1 file changed, 1 insertion(+), 18 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 07/36] bdinfo: microblaze: Use the generic bd command
  2020-05-04 23:17 ` [PATCH 07/36] bdinfo: microblaze: " Simon Glass
@ 2020-05-06  8:07   ` Bin Meng
  2020-05-06 15:56   ` Daniel Schwierzeck
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:07 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> Microblaze prints out ethernet and FDT information. This is useful to
> most archs, so move it into the generic code and move microblaze over to
> use it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 30 +++++++-----------------------
>  1 file changed, 7 insertions(+), 23 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 08/36] bdinfo: sh: Use the generic bd command
  2020-05-04 23:17 ` [PATCH 08/36] bdinfo: sh: " Simon Glass
@ 2020-05-06  8:07   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:07 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This arch has no code that is not already in the generic function. Drop
> the arch-specific function and change sh over to use the generic one.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 09/36] bdinfo: x86: Use the generic bd command
  2020-05-04 23:17 ` [PATCH 09/36] bdinfo: x86: " Simon Glass
@ 2020-05-06  8:07   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:07 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This arch shows 'ethspeed' info but only the freescale drivers use it, so
> it can be dropped.
>
> It also calls print_bi_dram() which is safe to call from any arch since it
> has an #ifdef inside it. Add this to the generic do_bdinfo() and move x86
> over to use it. Put it first since pytests rely on seeing it before
> memstart in find_ram_base().
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 21 ++-------------------
>  1 file changed, 2 insertions(+), 19 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 10/36] bdinfo: sandbox: Use the generic bd command
  2020-05-04 23:17 ` [PATCH 10/36] bdinfo: sandbox: " Simon Glass
@ 2020-05-06  8:07   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:07 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> Sandbox has a printout of 'FB base' but this code is not used since
> sandbox uses driver model for everything.
>
> Move sandbox over to use the generic do_bdinfo().
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 16 +---------------
>  1 file changed, 1 insertion(+), 15 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 11/36] bdinfo: nds32: Use the generic bd command
  2020-05-04 23:17 ` [PATCH 11/36] bdinfo: nds32: " Simon Glass
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA470474E@ATCPCS16.andestech.com>
@ 2020-05-06  8:07   ` Bin Meng
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:07 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This arch has none of its own info to show. Move it over to use the
> generic do_bdinfo().
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 12/36] bdinfo: riscv: Use the generic bd command
  2020-05-04 23:17 ` [PATCH 12/36] bdinfo: riscv: " Simon Glass
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4704755@ATCPCS16.andestech.com>
@ 2020-05-06  8:07   ` Bin Meng
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:07 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This arch has none of its own info to show. Move it over to use the
> generic do_bdinfo().
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 13/36] bdinfo: arm: Use the generic bd command
  2020-05-04 23:17 ` [PATCH 13/36] bdinfo: arm: " Simon Glass
@ 2020-05-06  8:07   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:07 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> Unfortunately ARM has a lot of special stuff. Move it into the generic
> function for now, so we can have it all in one place.
>
> Add in the frame-buffer printout, since it supports driver model too.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 250 +++++++++++++++++++++------------------------------
>  1 file changed, 104 insertions(+), 146 deletions(-)
>
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> index 0e96dd619c..f07f92463c 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)

This commit has both PPC and ARM changes. Could them be split into 2 patches?

> -void __weak board_detail(void)
> -{
> -       /* Please define board_detail() for your platform */
> -}
> -

Regards,
Bin

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 14/36] bdinfo: Drop the option to not use the generic 'bd' command
  2020-05-04 23:17 ` [PATCH 14/36] bdinfo: Drop the option to not use the generic 'bd' command Simon Glass
@ 2020-05-06  8:07   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:07 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> Now that all architectures are using the generic do_bdinfo(), drop the
> option to not use it. When new architectures are added, they will get at
> least some useful information from the generic implementation.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 59 ----------------------------------------------------
>  1 file changed, 59 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 15/36] bdinfo: Drop unused __maybe_unused
  2020-05-04 23:17 ` [PATCH 15/36] bdinfo: Drop unused __maybe_unused Simon Glass
@ 2020-05-06  8:07   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:07 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> Some of these are not needed now. Drop them to avoid cluttering the code.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 16/36] bdinfo: microblaze: sh: nios2: Drop arch-specific flash info
  2020-05-04 23:17 ` [PATCH 16/36] bdinfo: microblaze: sh: nios2: Drop arch-specific flash info Simon Glass
@ 2020-05-06  8:09   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:09 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> The differences these architectures have are minor and not worth the extra
> code. Use the generic version always.
>
> Tidy up the code style by removing unnecessary tabs.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 17 +++--------------
>  1 file changed, 3 insertions(+), 14 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 17/36] bdinfo: Drop unnecessary inline on functions
  2020-05-04 23:17 ` [PATCH 17/36] bdinfo: Drop unnecessary inline on functions Simon Glass
@ 2020-05-06  8:09   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:09 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This serves no purpose since the compiler will inline the functions
> automatically. Drop use of inline in this file.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> index 3d16f4cc1a..6e5b3d997d 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -60,7 +60,6 @@ static void print_eths(void)
>  }
>  #endif
>
> -__maybe_unused

This should be squashed into patch [15/36] bdinfo: Drop unused __maybe_unused

>  static void print_lnum(const char *name, unsigned long long value)
>  {
>         printf("%-12s= 0x%.8llX\n", name, value);
> @@ -74,12 +73,12 @@ static void print_mhz(const char *name, unsigned long hz)
>  }
>
>
> -static inline void print_bi_boot_params(const bd_t *bd)
> +static void print_bi_boot_params(const bd_t *bd)
>  {
>         print_num("boot_params",        (ulong)bd->bi_boot_params);
>  }
>
> -static inline void print_bi_mem(const bd_t *bd)
> +static void print_bi_mem(const bd_t *bd)
>  {
>  #if defined(CONFIG_SH)
>         print_num("mem start      ",    (ulong)bd->bi_memstart);
> @@ -93,7 +92,7 @@ static inline void print_bi_mem(const bd_t *bd)
>  #endif
>  }
>
> -static inline void print_bi_dram(const bd_t *bd)
> +static void print_bi_dram(const bd_t *bd)
>  {
>  #ifdef CONFIG_NR_DRAM_BANKS
>         int i;
> @@ -108,14 +107,14 @@ static inline void print_bi_dram(const bd_t *bd)
>  #endif
>  }
>
> -static inline void print_bi_flash(const bd_t *bd)
> +static void print_bi_flash(const bd_t *bd)
>  {
>         print_num("flashstart", (ulong)bd->bi_flashstart);
>         print_num("flashsize", (ulong)bd->bi_flashsize);
>         print_num("flashoffset", (ulong)bd->bi_flashoffset);
>  }
>
> -static inline void print_eth_ip_addr(void)
> +static void print_eth_ip_addr(void)
>  {
>  #if defined(CONFIG_CMD_NET)
>         print_eth(0);
> @@ -138,7 +137,7 @@ static inline void print_eth_ip_addr(void)
>  #endif
>  }
>
> -static inline void print_baudrate(void)
> +static void print_baudrate(void)
>  {
>  #if defined(CONFIG_PPC)
>         printf("baudrate    = %6u bps\n", gd->baudrate);
> @@ -147,7 +146,7 @@ static inline void print_baudrate(void)
>  #endif
>  }
>
> -static inline void print_std_bdinfo(const bd_t *bd)
> +static void print_std_bdinfo(const bd_t *bd)
>  {
>         print_bi_boot_params(bd);
>         print_bi_mem(bd);
> --

Other than that,
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Regards,
Bin

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 18/36] bdinfo: Drop print_std_bdinfo()
  2020-05-04 23:17 ` [PATCH 18/36] bdinfo: Drop print_std_bdinfo() Simon Glass
@ 2020-05-06  8:09   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:09 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> Everything in this function is standard now so it serves no purpose. Move
> it into the generic do_bdinfo() function.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 19/36] bdinfo: ppc: Drop arch-specific print_baudrate()
  2020-05-04 23:17 ` [PATCH 19/36] bdinfo: ppc: Drop arch-specific print_baudrate() Simon Glass
@ 2020-05-06  8:09   ` Bin Meng
  2020-05-06 15:09   ` Stefan Roese
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:09 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This function outputs the same basic info. Since the baud rate is commonly
> 115200 these is often no difference. Drop the arch-specific code and
> inline it to avoid a one-line function.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 20/36] bdinfo: sh: arc: Drop arch-specific print_bi_mem()
  2020-05-04 23:17 ` [PATCH 20/36] bdinfo: sh: arc: Drop arch-specific print_bi_mem() Simon Glass
@ 2020-05-06  8:09   ` Bin Meng
  2020-05-06  9:04     ` Alexey Brodkin
  0 siblings, 1 reply; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:09 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> It isn't worth having arch-specific code for such minor output
> differences. In fact it is better if all archs are consistent.
>
> Drop the arch-specific code in print_bi_mem() and inline it to avoid a
> two-line function.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 17 ++---------------
>  1 file changed, 2 insertions(+), 15 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 21/36] bdinfo: Drop print_bi_boot_params()
  2020-05-04 23:17 ` [PATCH 21/36] bdinfo: Drop print_bi_boot_params() Simon Glass
@ 2020-05-06  8:09   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:09 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This function only has one line of code in it so inline it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 22/36] bdinfo: Drop print_bi_flash()
  2020-05-04 23:17 ` [PATCH 22/36] bdinfo: Drop print_bi_flash() Simon Glass
@ 2020-05-06  8:09   ` Bin Meng
  2020-05-06 14:10     ` Tom Rini
  2020-05-06 14:47     ` Simon Glass
  0 siblings, 2 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:09 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This function only has three lines of code in it so inline it.

What's our guideline for inlining functions? To me if there is only
one line, inline the function looks good to me. But 3 lines? I am not
sure.

>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
>

Regards,
Bin

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 23/36] bdinfo: Drop print_cpu_word_size()
  2020-05-04 23:17 ` [PATCH 23/36] bdinfo: Drop print_cpu_word_size() Simon Glass
@ 2020-05-06  8:09   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:09 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This function only has one line of code in it so inline it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 24/36] bdinfo: net: ppc: Drop bi_enet1addr and other similar info
  2020-05-04 23:17 ` [PATCH 24/36] bdinfo: net: ppc: Drop bi_enet1addr and other similar info Simon Glass
@ 2020-05-06  8:09   ` Bin Meng
  2020-05-06 15:09   ` Stefan Roese
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:09 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> These values were 'old' in 2013 so it should be safe to remove them. They
> are never set in U-Boot anyway, so the values will always be zero.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  common/board_r.c             | 16 +---------------
>  include/asm-generic/u-boot.h | 17 -----------------
>  2 files changed, 1 insertion(+), 32 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 25/36] bdinfo: net: ppc: Drop prints for CONFIG_HAS_ETHn
  2020-05-04 23:17 ` [PATCH 25/36] bdinfo: net: ppc: Drop prints for CONFIG_HAS_ETHn Simon Glass
@ 2020-05-06  8:09   ` Bin Meng
  2020-05-06 15:10   ` Stefan Roese
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:09 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> These config options have not been migrated to Kconfig. This should be
> handled using driver model, iterating over the available Ethernet devices.
> For now, remove the code.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 15 ---------------
>  1 file changed, 15 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 26/36] bdinfo: net: Drop legacy ethernet bdinfo
  2020-05-04 23:17 ` [PATCH 26/36] bdinfo: net: Drop legacy ethernet bdinfo Simon Glass
@ 2020-05-06  8:09   ` Bin Meng
  2020-05-06 14:47     ` Simon Glass
  0 siblings, 1 reply; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:09 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This code pre-dates driver model and the migration date is nearly upon us.
> Pare the print_eths() function down and enable it for driver model, since
> it works correctly.
>
> The IP address is already printed in print_eth_ip_addr() so we can remove
> that.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 21 ++-------------------
>  1 file changed, 2 insertions(+), 19 deletions(-)
>
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> index 6fa8b32389..ba69575fc2 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -34,26 +34,10 @@ static void print_eth(int idx)
>         printf("%-12s= %s\n", name, val);
>  }
>
> -#ifndef CONFIG_DM_ETH
> -__maybe_unused
>  static void print_eths(void)
>  {
> -       struct eth_device *dev;
> -       int i = 0;
> -
> -       do {
> -               dev = eth_get_dev_by_index(i);
> -               if (dev) {
> -                       printf("eth%dname    = %s\n", i, dev->name);
> -                       print_eth(i);
> -                       i++;
> -               }
> -       } while (dev);
> -
>         printf("current eth = %s\n", eth_get_name());

Now this is an one-line function. Should we inline it?

> -       printf("ip_addr     = %s\n", env_get("ipaddr"));
>  }
> -#endif
>
>  static void print_lnum(const char *name, unsigned long long value)
>  {
> @@ -116,9 +100,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
>         print_num("relocaddr", gd->relocaddr);
>         print_num("reloc off", gd->reloc_off);
>         printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
> -#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
> -       print_eths();
> -#endif
> +       if (IS_ENABLED(CONFIG_CMD_NET))
> +               print_eths();
>         print_num("fdt_blob", (ulong)gd->fdt_blob);
>         print_num("new_fdt", (ulong)gd->new_fdt);
>         print_num("fdt_size", (ulong)gd->fdt_size);
> --

Regards,
Bin

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 27/36] bdinfo: net: Inline print_eths()
  2020-05-04 23:17 ` [PATCH 27/36] bdinfo: net: Inline print_eths() Simon Glass
@ 2020-05-06  8:10   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:10 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This function has only one line of code so inline it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> index ba69575fc2..e6237daf93 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -34,11 +34,6 @@ static void print_eth(int idx)
>         printf("%-12s= %s\n", name, val);
>  }
>
> -static void print_eths(void)
> -{
> -       printf("current eth = %s\n", eth_get_name());
> -}
> -
>  static void print_lnum(const char *name, unsigned long long value)
>  {
>         printf("%-12s= 0x%.8llX\n", name, value);
> @@ -101,7 +96,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
>         print_num("reloc off", gd->reloc_off);
>         printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
>         if (IS_ENABLED(CONFIG_CMD_NET))
> -               print_eths();
> +               printf("current eth = %s\n", eth_get_name());
>         print_num("fdt_blob", (ulong)gd->fdt_blob);
>         print_num("new_fdt", (ulong)gd->new_fdt);
>         print_num("fdt_size", (ulong)gd->fdt_size);
> --

I think this patch should be squashed into [26/36] bdinfo: net: Drop
legacy ethernet bdinfo

Regards,
Bin

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 28/36] bdinfo: net: Inline print_eth_ip_addr()
  2020-05-04 23:17 ` [PATCH 28/36] bdinfo: net: Inline print_eth_ip_addr() Simon Glass
@ 2020-05-06  8:10   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:10 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This function only has two lines of code now, so inline it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 29/36] bdinfo: Export some basic printing functions
  2020-05-04 23:17 ` [PATCH 29/36] bdinfo: Export some basic printing functions Simon Glass
@ 2020-05-06  8:10   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:10 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> At present the functions to print a number and a frequency are static. We
> want to move some of the code in here to an arch-specific file. For
> consistency that code should use these same functions. So export them with
> an appropriate name.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c   | 78 +++++++++++++++++++++++++-------------------------
>  include/init.h |  6 ++++
>  2 files changed, 45 insertions(+), 39 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 30/36] bdinfo: arm: Move ARM-specific info into its own file
  2020-05-04 23:17 ` [PATCH 30/36] bdinfo: arm: Move ARM-specific info into its own file Simon Glass
@ 2020-05-06  8:10   ` Bin Meng
  2020-05-06 16:10   ` Daniel Schwierzeck
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:10 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> We don't really want to have ARM-specific code in a generic file. Create
> a new arch-specific function to hold it, and move it into that.
>
> Make the function weak so that any arch can implement it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/arm/lib/Makefile |  1 +
>  arch/arm/lib/bdinfo.c | 51 +++++++++++++++++++++++++++++++++++++++++++
>  cmd/bdinfo.c          | 44 +++++--------------------------------
>  include/init.h        |  3 +++
>  4 files changed, 61 insertions(+), 38 deletions(-)
>  create mode 100644 arch/arm/lib/bdinfo.c
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 31/36] bdinfo: ppc: Move PPC-specific info into its own file
  2020-05-04 23:17 ` [PATCH 31/36] bdinfo: ppc: Move PPC-specific " Simon Glass
@ 2020-05-06  8:10   ` Bin Meng
  2020-05-06 15:10   ` Stefan Roese
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:10 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> We don't really want to have PPC-specific code in a generic file. Create
> a new arch-specific function to hold it, and move it into that.
>
> Make the function weak so that any arch can implement it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/powerpc/lib/Makefile |  2 ++
>  arch/powerpc/lib/bdinfo.c | 41 +++++++++++++++++++++++++++++++++++++++
>  cmd/bdinfo.c              | 27 --------------------------
>  3 files changed, 43 insertions(+), 27 deletions(-)
>  create mode 100644 arch/powerpc/lib/bdinfo.c
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 32/36] bdinfo: m68k: Move m68k-specific info into its own file
  2020-05-04 23:17 ` [PATCH 32/36] bdinfo: m68k: Move m68k-specific " Simon Glass
@ 2020-05-06  8:10   ` Bin Meng
  2020-05-06 20:11   ` Angelo Dureghello
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:10 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> We don't really want to have m68k-specific code in a generic file. Create
> a new arch-specific function to hold it, and move it into that.
>
> Make the function weak so that any arch can implement it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/m68k/lib/Makefile |  1 +
>  arch/m68k/lib/bdinfo.c | 29 +++++++++++++++++++++++++++++
>  cmd/bdinfo.c           | 15 ---------------
>  3 files changed, 30 insertions(+), 15 deletions(-)
>  create mode 100644 arch/m68k/lib/bdinfo.c
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 33/36] bdinfo: m68k: ppc: Move arch-specific code from bdinfo
  2020-05-04 23:17 ` [PATCH 33/36] bdinfo: m68k: ppc: Move arch-specific code from bdinfo Simon Glass
@ 2020-05-06  8:10   ` Bin Meng
  2020-05-06 15:10   ` Stefan Roese
  1 sibling, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:10 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> We don't have an easy way to share these three lines of code with two
> architectures. We also want to make it clear that this code is actually
> arch-specific.
>
> So just duplicate it in each arch-specific file.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/m68k/lib/bdinfo.c    | 5 +++++
>  arch/powerpc/lib/bdinfo.c | 5 +++++
>  cmd/bdinfo.c              | 8 --------
>  3 files changed, 10 insertions(+), 8 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 34/36] bdinfo: Update the file comments
  2020-05-04 23:17 ` [PATCH 34/36] bdinfo: Update the file comments Simon Glass
@ 2020-05-06  8:10   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:10 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> Update the comment at the top of the file to indicate what this file does.
> Also drop the line at the bottom and an unnecessary header include.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/bdinfo.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 35/36] bdinfo: dm: Update fb_base when using driver model
  2020-05-04 23:17 ` [PATCH 35/36] bdinfo: dm: Update fb_base when using driver model Simon Glass
@ 2020-05-06  8:10   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:10 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 7:25 AM Simon Glass <sjg@chromium.org> wrote:
>
> Update this value with the address of a video device so that it shows with
> the 'bd' command.
>
> It would be better to obtain the address from the uclass by looking in
> struct video_uc_platdata for each device. We can move over to that once
> DM_VIDEO migration is complete.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/video/video-uclass.c | 1 +
>  1 file changed, 1 insertion(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 36/36] bdinfo: x86: vesa: Update fb_base to the correct value
  2020-05-04 23:17 ` [PATCH 36/36] bdinfo: x86: vesa: Update fb_base to the correct value Simon Glass
@ 2020-05-06  8:10   ` Bin Meng
  0 siblings, 0 replies; 93+ messages in thread
From: Bin Meng @ 2020-05-06  8:10 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> Set this value in global_data so that it is reported correctly on x86
> boards.
>
> In fact, space is allocated for the frame buffer even though it is not
> used. The FSP picks the address itself, which is why the current value
> is wrong.

I don't get it about the "current value is wrong"?

>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/x86/lib/fsp/fsp_graphics.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/lib/fsp/fsp_graphics.c b/arch/x86/lib/fsp/fsp_graphics.c
> index 98b762209f..46fb907dc3 100644
> --- a/arch/x86/lib/fsp/fsp_graphics.c
> +++ b/arch/x86/lib/fsp/fsp_graphics.c
> @@ -96,6 +96,7 @@ static int fsp_video_probe(struct udevice *dev)
>          * For IGD, it seems to be always on BAR2.
>          */
>         vesa->phys_base_ptr = dm_pci_read_bar32(dev, 2);
> +       gd->fb_base = vesa->phys_base_ptr;
>
>         ret = vbe_setup_video_priv(vesa, uc_priv, plat);
>         if (ret)
> @@ -104,8 +105,8 @@ static int fsp_video_probe(struct udevice *dev)
>         mtrr_add_request(MTRR_TYPE_WRCOMB, vesa->phys_base_ptr, 256 << 20);
>         mtrr_commit(true);
>
> -       printf("%dx%dx%d\n", uc_priv->xsize, uc_priv->ysize,
> -              vesa->bits_per_pixel);
> +       printf("%dx%dx%d @ %x\n", uc_priv->xsize, uc_priv->ysize,
> +              vesa->bits_per_pixel, vesa->phys_base_ptr);
>
>         return 0;
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Regards,
Bin

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 20/36] bdinfo: sh: arc: Drop arch-specific print_bi_mem()
  2020-05-06  8:09   ` Bin Meng
@ 2020-05-06  9:04     ` Alexey Brodkin
  0 siblings, 0 replies; 93+ messages in thread
From: Alexey Brodkin @ 2020-05-06  9:04 UTC (permalink / raw)
  To: u-boot

Hi Simon,

> Subject: Re: [PATCH 20/36] bdinfo: sh: arc: Drop arch-specific print_bi_mem()
> 
> On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
> >
> > It isn't worth having arch-specific code for such minor output
> > differences. In fact it is better if all archs are consistent.
> >
> > Drop the arch-specific code in print_bi_mem() and inline it to avoid a
> > two-line function.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  cmd/bdinfo.c | 17 ++---------------
> >  1 file changed, 2 insertions(+), 15 deletions(-)

I guess this entire series is available in the following tree, right?
https://gitlab.denx.de/u-boot/custodians/u-boot-dm/-/tree/bd-working

In that case I'm very happy with that change as well as removal
of the duplicated spaghetti-code - thanks for taking care of that!

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 00/36] Tidy up the 'bd' command.
  2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
                   ` (35 preceding siblings ...)
  2020-05-04 23:17 ` [PATCH 36/36] bdinfo: x86: vesa: Update fb_base to the correct value Simon Glass
@ 2020-05-06  9:28 ` Alexey Brodkin
  2020-05-06 14:47   ` Simon Glass
  36 siblings, 1 reply; 93+ messages in thread
From: Alexey Brodkin @ 2020-05-06  9:28 UTC (permalink / raw)
  To: u-boot

Hi Simon,

> -----Original Message-----
> From: Simon Glass <sjg@chromium.org>
> Sent: Tuesday, May 5, 2020 2:17 AM
> To: U-Boot Mailing List <u-boot@lists.denx.de>

[snip]

> Subject: [PATCH 00/36] Tidy up the 'bd' command.
> 
> The code for the 'bd' command never got the 'generic board' treatment many
> years ago when global_data and bd_info were converted. As a result it
> still has a lot of arch-specific duplication of generic code.
> 
> This series aims to make as much code in this file generic as possible, so
> that it is easy to add new info on all architectures.
> 
> For the three architectures that actually need additional code (ARM, PPC
> and m68k) this is moved into arch-specific files.
> 
> With this series, bdinfo.c drops from nearly 500 lines to just over 100.
> 
> It also makes x86 report the frame buffer address properly (the original
> goal of my effort).
> 
> Simon Glass (36):
>   bdinfo: nds32: Use generic bd_info
>   bdinfo: riscv: Use generic bd_info
>   bdinfo: m68k: Drop bd_info->bi_ipbfreq
>   bdinfo: xtensa: Create a generic do_bdinfo for xtensa
>   bdinfo: mips: Use the generic bd command
>   bdinfo: nios2: Use the generic bd command
>   bdinfo: microblaze: Use the generic bd command
>   bdinfo: sh: Use the generic bd command
>   bdinfo: x86: Use the generic bd command
>   bdinfo: sandbox: Use the generic bd command
>   bdinfo: nds32: Use the generic bd command
>   bdinfo: riscv: Use the generic bd command
>   bdinfo: arm: Use the generic bd command

Looks like this one contains much more than just ARM changes.
Instead it looks like a massive migration to a generic bdinfo.
So I would propose either split it into per-arch changes
(though given this series size it might not be a good idea) or
alternatively maybe just ask for affected architecture maintainers
for an ack?

Also IMHO it would be very convenient to have a link to a git tree
with all these changes - it will significantly simplify review process.

But regardless all my comments above I'd like to note that this series
is very welcome as a long needed clean-up of that per-arch nonsense.
Thanks for doing this significant and useful work!

-Alexey

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 22/36] bdinfo: Drop print_bi_flash()
  2020-05-06  8:09   ` Bin Meng
@ 2020-05-06 14:10     ` Tom Rini
  2020-05-06 14:47     ` Simon Glass
  1 sibling, 0 replies; 93+ messages in thread
From: Tom Rini @ 2020-05-06 14:10 UTC (permalink / raw)
  To: u-boot

On Wed, May 06, 2020 at 04:09:33PM +0800, Bin Meng wrote:
> Hi Simon,
> 
> On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
> >
> > This function only has three lines of code in it so inline it.
> 
> What's our guideline for inlining functions? To me if there is only
> one line, inline the function looks good to me. But 3 lines? I am not
> sure.
> 
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  cmd/bdinfo.c | 11 +++--------
> >  1 file changed, 3 insertions(+), 8 deletions(-)

I'm ambivalent on if this should be moved in to the caller or not (I
first read inlining as marking with inline).  It kinda matters how the
overall function looks when you're done.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200506/974204a4/attachment.sig>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 00/36] Tidy up the 'bd' command.
  2020-05-06  9:28 ` [PATCH 00/36] Tidy up the 'bd' command Alexey Brodkin
@ 2020-05-06 14:47   ` Simon Glass
  0 siblings, 0 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-06 14:47 UTC (permalink / raw)
  To: u-boot

Hi Alexey,


On Wed, 6 May 2020 at 03:28, Alexey Brodkin <Alexey.Brodkin@synopsys.com> wrote:
>
> Hi Simon,
>
> > -----Original Message-----
> > From: Simon Glass <sjg@chromium.org>
> > Sent: Tuesday, May 5, 2020 2:17 AM
> > To: U-Boot Mailing List <u-boot@lists.denx.de>
>
> [snip]
>
> > Subject: [PATCH 00/36] Tidy up the 'bd' command.
> >
> > The code for the 'bd' command never got the 'generic board' treatment many
> > years ago when global_data and bd_info were converted. As a result it
> > still has a lot of arch-specific duplication of generic code.
> >
> > This series aims to make as much code in this file generic as possible, so
> > that it is easy to add new info on all architectures.
> >
> > For the three architectures that actually need additional code (ARM, PPC
> > and m68k) this is moved into arch-specific files.
> >
> > With this series, bdinfo.c drops from nearly 500 lines to just over 100.
> >
> > It also makes x86 report the frame buffer address properly (the original
> > goal of my effort).
> >
> > Simon Glass (36):
> >   bdinfo: nds32: Use generic bd_info
> >   bdinfo: riscv: Use generic bd_info
> >   bdinfo: m68k: Drop bd_info->bi_ipbfreq
> >   bdinfo: xtensa: Create a generic do_bdinfo for xtensa
> >   bdinfo: mips: Use the generic bd command
> >   bdinfo: nios2: Use the generic bd command
> >   bdinfo: microblaze: Use the generic bd command
> >   bdinfo: sh: Use the generic bd command
> >   bdinfo: x86: Use the generic bd command
> >   bdinfo: sandbox: Use the generic bd command
> >   bdinfo: nds32: Use the generic bd command
> >   bdinfo: riscv: Use the generic bd command
> >   bdinfo: arm: Use the generic bd command
>
> Looks like this one contains much more than just ARM changes.
> Instead it looks like a massive migration to a generic bdinfo.
> So I would propose either split it into per-arch changes
> (though given this series size it might not be a good idea) or
> alternatively maybe just ask for affected architecture maintainers
> for an ack?

This is not a very large migration, just a small change to one
command, mostly. We already have generic bdinfo (same 'struct bd') for
all but two archs.

The series is split by arch - see the tags for each commit. That is
why some maintainers get some patches and not others, or at least that
is my hope, since patman runs get_maintainers separately on each
commit.

>
> Also IMHO it would be very convenient to have a link to a git tree
> with all these changes - it will significantly simplify review process.

See u-boot-dm/bd-working for the tree. I always post a series there
before sending, but don't always mention the name, sorry.

> But regardless all my comments above I'd like to note that this series
> is very welcome as a long needed clean-up of that per-arch nonsense.
> Thanks for doing this significant and useful work!

:-)

Regards,
Simon

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 22/36] bdinfo: Drop print_bi_flash()
  2020-05-06  8:09   ` Bin Meng
  2020-05-06 14:10     ` Tom Rini
@ 2020-05-06 14:47     ` Simon Glass
  1 sibling, 0 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-06 14:47 UTC (permalink / raw)
  To: u-boot

Hi Bin,

On Wed, 6 May 2020 at 02:09, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Simon,
>
> On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
> >
> > This function only has three lines of code in it so inline it.
>
> What's our guideline for inlining functions? To me if there is only
> one line, inline the function looks good to me. But 3 lines? I am not
> sure.

Me neither. But in this case I want to get all the code into once
place and the end result is a function with about 30 lines, which
seems OK.


>
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  cmd/bdinfo.c | 11 +++--------
> >  1 file changed, 3 insertions(+), 8 deletions(-)
> >
>

Regards,
SImon

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 26/36] bdinfo: net: Drop legacy ethernet bdinfo
  2020-05-06  8:09   ` Bin Meng
@ 2020-05-06 14:47     ` Simon Glass
  0 siblings, 0 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-06 14:47 UTC (permalink / raw)
  To: u-boot

Hi Bin,

On Wed, 6 May 2020 at 02:10, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Simon,
>
> On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg@chromium.org> wrote:
> >
> > This code pre-dates driver model and the migration date is nearly upon us.
> > Pare the print_eths() function down and enable it for driver model, since
> > it works correctly.
> >
> > The IP address is already printed in print_eth_ip_addr() so we can remove
> > that.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  cmd/bdinfo.c | 21 ++-------------------
> >  1 file changed, 2 insertions(+), 19 deletions(-)
> >
> > diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> > index 6fa8b32389..ba69575fc2 100644
> > --- a/cmd/bdinfo.c
> > +++ b/cmd/bdinfo.c
> > @@ -34,26 +34,10 @@ static void print_eth(int idx)
> >         printf("%-12s= %s\n", name, val);
> >  }
> >
> > -#ifndef CONFIG_DM_ETH
> > -__maybe_unused
> >  static void print_eths(void)
> >  {
> > -       struct eth_device *dev;
> > -       int i = 0;
> > -
> > -       do {
> > -               dev = eth_get_dev_by_index(i);
> > -               if (dev) {
> > -                       printf("eth%dname    = %s\n", i, dev->name);
> > -                       print_eth(i);
> > -                       i++;
> > -               }
> > -       } while (dev);
> > -
> >         printf("current eth = %s\n", eth_get_name());
>
> Now this is an one-line function. Should we inline it?

Yes it goes away in a later commit. Trying to avoid too much confusing
for reviewers.

Regards.

Simon

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 19/36] bdinfo: ppc: Drop arch-specific print_baudrate()
  2020-05-04 23:17 ` [PATCH 19/36] bdinfo: ppc: Drop arch-specific print_baudrate() Simon Glass
  2020-05-06  8:09   ` Bin Meng
@ 2020-05-06 15:09   ` Stefan Roese
  1 sibling, 0 replies; 93+ messages in thread
From: Stefan Roese @ 2020-05-06 15:09 UTC (permalink / raw)
  To: u-boot

On 05.05.20 01:17, Simon Glass wrote:
> This function outputs the same basic info. Since the baud rate is commonly
> 115200 these is often no difference. Drop the arch-specific code and
> inline it to avoid a one-line function.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
> 
>   cmd/bdinfo.c | 12 +-----------
>   1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> index 4e08d9e40a..62eea010c5 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -137,15 +137,6 @@ static void print_eth_ip_addr(void)
>   #endif
>   }
>   
> -static void print_baudrate(void)
> -{
> -#if defined(CONFIG_PPC)
> -	printf("baudrate    = %6u bps\n", gd->baudrate);
> -#else
> -	printf("baudrate    = %u bps\n", gd->baudrate);
> -#endif
> -}
> -
>   void __weak board_detail(void)
>   {
>   	/* Please define board_detail() for your PPC platform */
> @@ -165,8 +156,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
>   	print_bi_mem(bd);
>   	print_bi_flash(bd);
>   	print_eth_ip_addr();
> -	print_baudrate();
> -	print_std_bdinfo(bd);
> +	printf("baudrate    = %u bps\n", gd->baudrate);
>   	print_num("relocaddr", gd->relocaddr);
>   	print_num("reloc off", gd->reloc_off);
>   	print_cpu_word_size();
> 


Viele Gr??e,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 24/36] bdinfo: net: ppc: Drop bi_enet1addr and other similar info
  2020-05-04 23:17 ` [PATCH 24/36] bdinfo: net: ppc: Drop bi_enet1addr and other similar info Simon Glass
  2020-05-06  8:09   ` Bin Meng
@ 2020-05-06 15:09   ` Stefan Roese
  1 sibling, 0 replies; 93+ messages in thread
From: Stefan Roese @ 2020-05-06 15:09 UTC (permalink / raw)
  To: u-boot

On 05.05.20 01:17, Simon Glass wrote:
> These values were 'old' in 2013 so it should be safe to remove them. They
> are never set in U-Boot anyway, so the values will always be zero.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
> 
>   common/board_r.c             | 16 +---------------
>   include/asm-generic/u-boot.h | 17 -----------------
>   2 files changed, 1 insertion(+), 32 deletions(-)
> 
> diff --git a/common/board_r.c b/common/board_r.c
> index d9015cd057..4876afba6b 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -525,21 +525,7 @@ static int initr_ethaddr(void)
>   
>   	/* kept around for legacy kernels only ... ignore the next section */
>   	eth_env_get_enetaddr("ethaddr", bd->bi_enetaddr);
> -#ifdef CONFIG_HAS_ETH1
> -	eth_env_get_enetaddr("eth1addr", bd->bi_enet1addr);
> -#endif
> -#ifdef CONFIG_HAS_ETH2
> -	eth_env_get_enetaddr("eth2addr", bd->bi_enet2addr);
> -#endif
> -#ifdef CONFIG_HAS_ETH3
> -	eth_env_get_enetaddr("eth3addr", bd->bi_enet3addr);
> -#endif
> -#ifdef CONFIG_HAS_ETH4
> -	eth_env_get_enetaddr("eth4addr", bd->bi_enet4addr);
> -#endif
> -#ifdef CONFIG_HAS_ETH5
> -	eth_env_get_enetaddr("eth5addr", bd->bi_enet5addr);
> -#endif
> +
>   	return 0;
>   }
>   #endif /* CONFIG_CMD_NET */
> diff --git a/include/asm-generic/u-boot.h b/include/asm-generic/u-boot.h
> index be0014c3b3..0ec4522653 100644
> --- a/include/asm-generic/u-boot.h
> +++ b/include/asm-generic/u-boot.h
> @@ -67,23 +67,6 @@ typedef struct bd_info {
>   	unsigned long bi_vcofreq;	/* vco Freq in MHz */
>   	unsigned long bi_flbfreq;	/* Flexbus Freq in MHz */
>   #endif
> -
> -#ifdef CONFIG_HAS_ETH1
> -	unsigned char   bi_enet1addr[6];	/* OLD: see README.enetaddr */
> -#endif
> -#ifdef CONFIG_HAS_ETH2
> -	unsigned char	bi_enet2addr[6];	/* OLD: see README.enetaddr */
> -#endif
> -#ifdef CONFIG_HAS_ETH3
> -	unsigned char   bi_enet3addr[6];	/* OLD: see README.enetaddr */
> -#endif
> -#ifdef CONFIG_HAS_ETH4
> -	unsigned char   bi_enet4addr[6];	/* OLD: see README.enetaddr */
> -#endif
> -#ifdef CONFIG_HAS_ETH5
> -	unsigned char   bi_enet5addr[6];	/* OLD: see README.enetaddr */
> -#endif
> -
>   	ulong	        bi_arch_number;	/* unique id for this board */
>   	ulong	        bi_boot_params;	/* where this board expects params */
>   #ifdef CONFIG_NR_DRAM_BANKS
> 


Viele Gr??e,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 25/36] bdinfo: net: ppc: Drop prints for CONFIG_HAS_ETHn
  2020-05-04 23:17 ` [PATCH 25/36] bdinfo: net: ppc: Drop prints for CONFIG_HAS_ETHn Simon Glass
  2020-05-06  8:09   ` Bin Meng
@ 2020-05-06 15:10   ` Stefan Roese
  1 sibling, 0 replies; 93+ messages in thread
From: Stefan Roese @ 2020-05-06 15:10 UTC (permalink / raw)
  To: u-boot

On 05.05.20 01:17, Simon Glass wrote:
> These config options have not been migrated to Kconfig. This should be
> handled using driver model, iterating over the available Ethernet devices.
> For now, remove the code.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
> 
>   cmd/bdinfo.c | 15 ---------------
>   1 file changed, 15 deletions(-)
> 
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> index d0afef5b5e..6fa8b32389 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -86,21 +86,6 @@ static void print_eth_ip_addr(void)
>   {
>   #if defined(CONFIG_CMD_NET)
>   	print_eth(0);
> -#if defined(CONFIG_HAS_ETH1)
> -	print_eth(1);
> -#endif
> -#if defined(CONFIG_HAS_ETH2)
> -	print_eth(2);
> -#endif
> -#if defined(CONFIG_HAS_ETH3)
> -	print_eth(3);
> -#endif
> -#if defined(CONFIG_HAS_ETH4)
> -	print_eth(4);
> -#endif
> -#if defined(CONFIG_HAS_ETH5)
> -	print_eth(5);
> -#endif
>   	printf("IP addr     = %s\n", env_get("ipaddr"));
>   #endif
>   }
> 


Viele Gr??e,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 31/36] bdinfo: ppc: Move PPC-specific info into its own file
  2020-05-04 23:17 ` [PATCH 31/36] bdinfo: ppc: Move PPC-specific " Simon Glass
  2020-05-06  8:10   ` Bin Meng
@ 2020-05-06 15:10   ` Stefan Roese
  1 sibling, 0 replies; 93+ messages in thread
From: Stefan Roese @ 2020-05-06 15:10 UTC (permalink / raw)
  To: u-boot

On 05.05.20 01:17, Simon Glass wrote:
> We don't really want to have PPC-specific code in a generic file. Create
> a new arch-specific function to hold it, and move it into that.
> 
> Make the function weak so that any arch can implement it.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
> 
>   arch/powerpc/lib/Makefile |  2 ++
>   arch/powerpc/lib/bdinfo.c | 41 +++++++++++++++++++++++++++++++++++++++
>   cmd/bdinfo.c              | 27 --------------------------
>   3 files changed, 43 insertions(+), 27 deletions(-)
>   create mode 100644 arch/powerpc/lib/bdinfo.c
> 
> diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
> index 01c9dd51be..f61809ab05 100644
> --- a/arch/powerpc/lib/Makefile
> +++ b/arch/powerpc/lib/Makefile
> @@ -15,6 +15,8 @@ MINIMAL=y
>   endif
>   endif
>   
> +obj-y	+= bdinfo.o
> +
>   ifdef MINIMAL
>   obj-y += cache.o time.o
>   ifndef CONFIG_TIMER
> diff --git a/arch/powerpc/lib/bdinfo.c b/arch/powerpc/lib/bdinfo.c
> new file mode 100644
> index 0000000000..da09bb276f
> --- /dev/null
> +++ b/arch/powerpc/lib/bdinfo.c
> @@ -0,0 +1,41 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * PPC-specific information for the 'bd' command
> + *
> + * (C) Copyright 2003
> + * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> + */
> +
> +#include <common.h>
> +#include <init.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +void __weak board_detail(void)
> +{
> +	/* Please define board_detail() for your PPC platform */
> +}
> +
> +void arch_print_bdinfo(void)
> +{
> +	bd_t *bd = gd->bd;
> +
> +#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
> +	bdinfo_print_num("immr_base", bd->bi_immr_base);
> +#endif
> +	bdinfo_print_num("bootflags", bd->bi_bootflags);
> +	bdinfo_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
> +	board_detail();
> +#if defined(CONFIG_CPM2)
> +	bdinfo_print_mhz("cpmfreq", bd->bi_cpmfreq);
> +	bdinfo_print_mhz("vco", bd->bi_vco);
> +	bdinfo_print_mhz("sccfreq", bd->bi_sccfreq);
> +	bdinfo_print_mhz("brgfreq", bd->bi_brgfreq);
> +#endif
> +}
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> index 55a9244aef..570022052c 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -60,11 +60,6 @@ static void print_bi_dram(const bd_t *bd)
>   #endif
>   }
>   
> -void __weak board_detail(void)
> -{
> -	/* Please define board_detail() for your PPC platform */
> -}
> -
>   __weak void arch_print_bdinfo(void)
>   {
>   }
> @@ -103,28 +98,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
>   
>   	arch_print_bdinfo();
>   
> -	/* This section is used only by ppc */
> -#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
> -	bdinfo_print_num("immr_base", bd->bi_immr_base);
> -#endif
> -	if (IS_ENABLED(CONFIG_PPC)) {
> -		bdinfo_print_num("bootflags", bd->bi_bootflags);
> -		bdinfo_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
> -		board_detail();
> -	}
> -#if defined(CONFIG_CPM2)
> -	bdinfo_print_mhz("cpmfreq", bd->bi_cpmfreq);
> -	bdinfo_print_mhz("vco", bd->bi_vco);
> -	bdinfo_print_mhz("sccfreq", bd->bi_sccfreq);
> -	bdinfo_print_mhz("brgfreq", bd->bi_brgfreq);
> -#endif
> -
>   	/* This is used by m68k and ppc */
>   #if defined(CONFIG_SYS_INIT_RAM_ADDR)
>   	bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
> 


Viele Gr??e,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 33/36] bdinfo: m68k: ppc: Move arch-specific code from bdinfo
  2020-05-04 23:17 ` [PATCH 33/36] bdinfo: m68k: ppc: Move arch-specific code from bdinfo Simon Glass
  2020-05-06  8:10   ` Bin Meng
@ 2020-05-06 15:10   ` Stefan Roese
  1 sibling, 0 replies; 93+ messages in thread
From: Stefan Roese @ 2020-05-06 15:10 UTC (permalink / raw)
  To: u-boot

On 05.05.20 01:17, Simon Glass wrote:
> We don't have an easy way to share these three lines of code with two
> architectures. We also want to make it clear that this code is actually
> arch-specific.
> 
> So just duplicate it in each arch-specific file.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
> 
>   arch/m68k/lib/bdinfo.c    | 5 +++++
>   arch/powerpc/lib/bdinfo.c | 5 +++++
>   cmd/bdinfo.c              | 8 --------
>   3 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/m68k/lib/bdinfo.c b/arch/m68k/lib/bdinfo.c
> index 09a1abfc21..971c47c306 100644
> --- a/arch/m68k/lib/bdinfo.c
> +++ b/arch/m68k/lib/bdinfo.c
> @@ -15,6 +15,11 @@ void arch_print_bdinfo(void)
>   {
>   	bd_t *bd = gd->bd;
>   
> +#if defined(CONFIG_SYS_INIT_RAM_ADDR)
> +	bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
> +	bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
> +#endif
> +	bdinfo_print_mhz("busfreq", bd->bi_busfreq);
>   #if defined(CONFIG_SYS_MBAR)
>   	bdinfo_print_num("mbar", bd->bi_mbar_base);
>   #endif
> diff --git a/arch/powerpc/lib/bdinfo.c b/arch/powerpc/lib/bdinfo.c
> index da09bb276f..d8c64155f0 100644
> --- a/arch/powerpc/lib/bdinfo.c
> +++ b/arch/powerpc/lib/bdinfo.c
> @@ -20,6 +20,11 @@ void arch_print_bdinfo(void)
>   {
>   	bd_t *bd = gd->bd;
>   
> +#if defined(CONFIG_SYS_INIT_RAM_ADDR)
> +	bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
> +	bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
> +#endif
> +	bdinfo_print_mhz("busfreq", bd->bi_busfreq);
>   #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
>   	bdinfo_print_num("immr_base", bd->bi_immr_base);
>   #endif
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> index f0afdb153f..aea7cf904a 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -98,14 +98,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
>   
>   	arch_print_bdinfo();
>   
> -	/* This is used by m68k and ppc */
> -#if defined(CONFIG_SYS_INIT_RAM_ADDR)
> -	bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
> -	bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
> -#endif
> -	if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_M68K))
> -		bdinfo_print_mhz("busfreq", bd->bi_busfreq);
> -
>   	return 0;
>   }
>   
> 


Viele Gr??e,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 05/36] bdinfo: mips: Use the generic bd command
  2020-05-04 23:17 ` [PATCH 05/36] bdinfo: mips: Use the generic bd command Simon Glass
  2020-05-06  8:07   ` Bin Meng
@ 2020-05-06 15:29   ` Daniel Schwierzeck
  1 sibling, 0 replies; 93+ messages in thread
From: Daniel Schwierzeck @ 2020-05-06 15:29 UTC (permalink / raw)
  To: u-boot



Am 05.05.20 um 01:17 schrieb Simon Glass:
> MIPS currently has a few extra things which are generally useful. Add them
> to the generic function and move MIPS over to use it.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  cmd/bdinfo.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

> 
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> index 9247180a29..6ccbd2f50f 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -299,15 +299,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  
>  #elif defined(CONFIG_MIPS)
>  
> -int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> -{
> -	print_std_bdinfo(gd->bd);
> -	print_num("relocaddr", gd->relocaddr);
> -	print_num("reloc off", gd->reloc_off);
> -	print_cpu_word_size();
> -
> -	return 0;
> -}
> +#define USE_GENERIC
>  
>  #elif defined(CONFIG_ARM)
>  
> @@ -485,6 +477,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[])
>  {
>  	print_std_bdinfo(gd->bd);
> +	print_num("relocaddr", gd->relocaddr);
> +	print_num("reloc off", gd->reloc_off);
> +	print_cpu_word_size();
>  
>  	return 0;
>  }
> 

-- 
- Daniel

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 07/36] bdinfo: microblaze: Use the generic bd command
  2020-05-04 23:17 ` [PATCH 07/36] bdinfo: microblaze: " Simon Glass
  2020-05-06  8:07   ` Bin Meng
@ 2020-05-06 15:56   ` Daniel Schwierzeck
  2020-05-10 20:36     ` Simon Glass
  1 sibling, 1 reply; 93+ messages in thread
From: Daniel Schwierzeck @ 2020-05-06 15:56 UTC (permalink / raw)
  To: u-boot



Am 05.05.20 um 01:17 schrieb Simon Glass:
> Microblaze prints out ethernet and FDT information. This is useful to
> most archs, so move it into the generic code and move microblaze over to
> use it.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  cmd/bdinfo.c | 30 +++++++-----------------------
>  1 file changed, 7 insertions(+), 23 deletions(-)
> 
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> index 405a915861..dc5a09f8ce 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -224,29 +224,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  
>  #elif defined(CONFIG_MICROBLAZE)
>  
> -int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> -{
> -	bd_t *bd = gd->bd;
> -
> -	print_bi_dram(bd);
> -	print_bi_flash(bd);
> -#if defined(CONFIG_SYS_SRAM_BASE)
> -	print_num("sram start     ",	(ulong)bd->bi_sramstart);
> -	print_num("sram size      ",	(ulong)bd->bi_sramsize);
> -#endif
> -#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
> -	print_eths();
> -#endif
> -	print_baudrate();
> -	print_num("relocaddr", gd->relocaddr);
> -	print_num("reloc off", gd->reloc_off);
> -	print_num("fdt_blob", (ulong)gd->fdt_blob);
> -	print_num("new_fdt", (ulong)gd->new_fdt);
> -	print_num("fdt_size", (ulong)gd->fdt_size);
> -	print_cpu_word_size();
> -
> -	return 0;
> -}
> +#define USE_GENERIC
>  
>  #elif defined(CONFIG_M68K)
>  
> @@ -463,6 +441,12 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
>  	print_num("relocaddr", gd->relocaddr);
>  	print_num("reloc off", gd->reloc_off);
>  	print_cpu_word_size();
> +#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
> +	print_eths();
> +#endif
> +	print_num("fdt_blob", (ulong)gd->fdt_blob);
> +	print_num("new_fdt", (ulong)gd->new_fdt);
> +	print_num("fdt_size", (ulong)gd->fdt_size);

shouldn't that be guarded with CONFIG_IS_ENABLED(OF_LIBFDT) ?

>  
>  	return 0;
>  }
> 

-- 
- Daniel

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 30/36] bdinfo: arm: Move ARM-specific info into its own file
  2020-05-04 23:17 ` [PATCH 30/36] bdinfo: arm: Move ARM-specific info into its own file Simon Glass
  2020-05-06  8:10   ` Bin Meng
@ 2020-05-06 16:10   ` Daniel Schwierzeck
  1 sibling, 0 replies; 93+ messages in thread
From: Daniel Schwierzeck @ 2020-05-06 16:10 UTC (permalink / raw)
  To: u-boot



Am 05.05.20 um 01:17 schrieb Simon Glass:
> We don't really want to have ARM-specific code in a generic file. Create
> a new arch-specific function to hold it, and move it into that.
> 
> Make the function weak so that any arch can implement it.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  arch/arm/lib/Makefile |  1 +
>  arch/arm/lib/bdinfo.c | 51 +++++++++++++++++++++++++++++++++++++++++++
>  cmd/bdinfo.c          | 44 +++++--------------------------------
>  include/init.h        |  3 +++
>  4 files changed, 61 insertions(+), 38 deletions(-)
>  create mode 100644 arch/arm/lib/bdinfo.c
> 
> diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
> index b839aa7a50..27b12e7f2b 100644
> --- a/arch/arm/lib/Makefile
> +++ b/arch/arm/lib/Makefile
> @@ -43,6 +43,7 @@ obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o
>  obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o
>  obj-$(CONFIG_SEMIHOSTING) += semihosting.o
>  
> +obj-y	+= bdinfo.o
>  obj-y	+= sections.o
>  obj-y	+= stack.o
>  ifdef CONFIG_CPU_V7M
> diff --git a/arch/arm/lib/bdinfo.c b/arch/arm/lib/bdinfo.c
> new file mode 100644
> index 0000000000..ce8edd0313
> --- /dev/null
> +++ b/arch/arm/lib/bdinfo.c
> @@ -0,0 +1,51 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * ARM-specific information for the 'bd' command
> + *
> + * (C) Copyright 2003
> + * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> + */
> +
> +#include <common.h>
> +#include <init.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +void arch_print_bdinfo(void)
> +{
> +#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
> +	if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) {
> +		bdinfo_print_num("Secure ram",
> +				 gd->arch.secure_ram &
> +				 MEM_RESERVE_SECURE_ADDR_MASK);
> +	}
> +#endif
> +#ifdef CONFIG_RESV_RAM
> +	if (gd->arch.resv_ram)
> +		bdinfo_print_num("Reserved ram", gd->arch.resv_ram);
> +#endif
> +#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
> +	bdinfo_print_num("TLB addr", gd->arch.tlb_addr);
> +#endif
> +	bdinfo_print_num("irq_sp", gd->irq_sp);	/* irq stack pointer */
> +	bdinfo_print_num("sp start ", gd->start_addr_sp);
> +	/*
> +	 * TODO: Currently only support for davinci SOC's is added.
> +	 * Remove this check once all the board implement this.
> +	 */
> +#ifdef CONFIG_CLOCKS
> +	printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
> +	printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
> +	printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
> +#endif
> +#ifdef CONFIG_BOARD_TYPES
> +	printf("Board Type  = %ld\n", gd->board_type);
> +#endif



> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> +	printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr,
> +	       CONFIG_VAL(SYS_MALLOC_F_LEN));
> +#endif
> +#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
> +	bdinfo_print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
> +#endif
> +}

that part is not really ARM specific. Maybe it's useful in the generic
function?

-- 
- Daniel

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 32/36] bdinfo: m68k: Move m68k-specific info into its own file
  2020-05-04 23:17 ` [PATCH 32/36] bdinfo: m68k: Move m68k-specific " Simon Glass
  2020-05-06  8:10   ` Bin Meng
@ 2020-05-06 20:11   ` Angelo Dureghello
  1 sibling, 0 replies; 93+ messages in thread
From: Angelo Dureghello @ 2020-05-06 20:11 UTC (permalink / raw)
  To: u-boot

On Tue, May 5, 2020 at 1:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> We don't really want to have m68k-specific code in a generic file. Create
> a new arch-specific function to hold it, and move it into that.
>
> Make the function weak so that any arch can implement it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/m68k/lib/Makefile |  1 +
>  arch/m68k/lib/bdinfo.c | 29 +++++++++++++++++++++++++++++
>  cmd/bdinfo.c           | 15 ---------------
>  3 files changed, 30 insertions(+), 15 deletions(-)
>  create mode 100644 arch/m68k/lib/bdinfo.c

Tested on stmark2

stmark2 $ bdi
boot_params = 0x47d96770
DRAM bank   = 0x00000000
-> start    = 0x40000000
-> size     = 0x08000000
memstart    = 0x40000000
memsize     = 0x08000000
flashstart  = 0x00000000
flashsize   = 0x00000000
flashoffset = 0x00000000
baudrate    = 115200 bps
relocaddr   = 0x47dd5000
reloc off   = 0xfffd4c00
Build       = 32-bit
fdt_blob    = 0x47d90670
new_fdt     = 0x47d90670
fdt_size    = 0x00002860
sramstart   = 0x00000000
sramsize    = 0x00000000
busfreq     =    120 MHz
mbar        = 0xfc000000
cpufreq     =    240 MHz
flbfreq     =     60 MHz
inpfreq     =     30 MHz


Tested-by: Angelo Dureghello <angelo.dureghello@timesys.com>

^ permalink raw reply	[flat|nested] 93+ messages in thread

* [PATCH 07/36] bdinfo: microblaze: Use the generic bd command
  2020-05-06 15:56   ` Daniel Schwierzeck
@ 2020-05-10 20:36     ` Simon Glass
  0 siblings, 0 replies; 93+ messages in thread
From: Simon Glass @ 2020-05-10 20:36 UTC (permalink / raw)
  To: u-boot

Hi Daniel,

On Wed, 6 May 2020 at 09:56, Daniel Schwierzeck
<daniel.schwierzeck@gmail.com> wrote:
>
>
>
> Am 05.05.20 um 01:17 schrieb Simon Glass:
> > Microblaze prints out ethernet and FDT information. This is useful to
> > most archs, so move it into the generic code and move microblaze over to
> > use it.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  cmd/bdinfo.c | 30 +++++++-----------------------
> >  1 file changed, 7 insertions(+), 23 deletions(-)
> >
> > diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> > index 405a915861..dc5a09f8ce 100644
> > --- a/cmd/bdinfo.c
> > +++ b/cmd/bdinfo.c
> > @@ -224,29 +224,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> >
> >  #elif defined(CONFIG_MICROBLAZE)
> >
> > -int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> > -{
> > -     bd_t *bd = gd->bd;
> > -
> > -     print_bi_dram(bd);
> > -     print_bi_flash(bd);
> > -#if defined(CONFIG_SYS_SRAM_BASE)
> > -     print_num("sram start     ",    (ulong)bd->bi_sramstart);
> > -     print_num("sram size      ",    (ulong)bd->bi_sramsize);
> > -#endif
> > -#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
> > -     print_eths();
> > -#endif
> > -     print_baudrate();
> > -     print_num("relocaddr", gd->relocaddr);
> > -     print_num("reloc off", gd->reloc_off);
> > -     print_num("fdt_blob", (ulong)gd->fdt_blob);
> > -     print_num("new_fdt", (ulong)gd->new_fdt);
> > -     print_num("fdt_size", (ulong)gd->fdt_size);
> > -     print_cpu_word_size();
> > -
> > -     return 0;
> > -}
> > +#define USE_GENERIC
> >
> >  #elif defined(CONFIG_M68K)
> >
> > @@ -463,6 +441,12 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
> >       print_num("relocaddr", gd->relocaddr);
> >       print_num("reloc off", gd->reloc_off);
> >       print_cpu_word_size();
> > +#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
> > +     print_eths();
> > +#endif
> > +     print_num("fdt_blob", (ulong)gd->fdt_blob);
> > +     print_num("new_fdt", (ulong)gd->new_fdt);
> > +     print_num("fdt_size", (ulong)gd->fdt_size);
>
> shouldn't that be guarded with CONFIG_IS_ENABLED(OF_LIBFDT) ?

No it doesn't need to be. The commands are not available in SPL, and
U-Boot proper is supposed to use device tree for all boards.

Regards,
Simon

^ permalink raw reply	[flat|nested] 93+ messages in thread

end of thread, other threads:[~2020-05-10 20:36 UTC | newest]

Thread overview: 93+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04 23:16 [PATCH 00/36] Tidy up the 'bd' command Simon Glass
2020-05-04 23:16 ` [PATCH 01/36] bdinfo: nds32: Use generic bd_info Simon Glass
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4704736@ATCPCS16.andestech.com>
2020-05-05  1:16     ` Rick Chen
2020-05-06  8:06   ` Bin Meng
2020-05-04 23:16 ` [PATCH 02/36] bdinfo: riscv: " Simon Glass
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4704741@ATCPCS16.andestech.com>
2020-05-05  1:19     ` Rick Chen
2020-05-06  8:06   ` Bin Meng
2020-05-04 23:16 ` [PATCH 03/36] bdinfo: m68k: Drop bd_info->bi_ipbfreq Simon Glass
2020-05-06  8:06   ` Bin Meng
2020-05-04 23:17 ` [PATCH 04/36] bdinfo: xtensa: Create a generic do_bdinfo for xtensa Simon Glass
2020-05-06  8:07   ` Bin Meng
2020-05-04 23:17 ` [PATCH 05/36] bdinfo: mips: Use the generic bd command Simon Glass
2020-05-06  8:07   ` Bin Meng
2020-05-06 15:29   ` Daniel Schwierzeck
2020-05-04 23:17 ` [PATCH 06/36] bdinfo: nios2: " Simon Glass
2020-05-06  8:07   ` Bin Meng
2020-05-04 23:17 ` [PATCH 07/36] bdinfo: microblaze: " Simon Glass
2020-05-06  8:07   ` Bin Meng
2020-05-06 15:56   ` Daniel Schwierzeck
2020-05-10 20:36     ` Simon Glass
2020-05-04 23:17 ` [PATCH 08/36] bdinfo: sh: " Simon Glass
2020-05-06  8:07   ` Bin Meng
2020-05-04 23:17 ` [PATCH 09/36] bdinfo: x86: " Simon Glass
2020-05-06  8:07   ` Bin Meng
2020-05-04 23:17 ` [PATCH 10/36] bdinfo: sandbox: " Simon Glass
2020-05-06  8:07   ` Bin Meng
2020-05-04 23:17 ` [PATCH 11/36] bdinfo: nds32: " Simon Glass
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA470474E@ATCPCS16.andestech.com>
2020-05-05  1:22     ` Rick Chen
2020-05-06  8:07   ` Bin Meng
2020-05-04 23:17 ` [PATCH 12/36] bdinfo: riscv: " Simon Glass
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4704755@ATCPCS16.andestech.com>
2020-05-05  1:24     ` Rick Chen
2020-05-06  8:07   ` Bin Meng
2020-05-04 23:17 ` [PATCH 13/36] bdinfo: arm: " Simon Glass
2020-05-06  8:07   ` Bin Meng
2020-05-04 23:17 ` [PATCH 14/36] bdinfo: Drop the option to not use the generic 'bd' command Simon Glass
2020-05-06  8:07   ` Bin Meng
2020-05-04 23:17 ` [PATCH 15/36] bdinfo: Drop unused __maybe_unused Simon Glass
2020-05-06  8:07   ` Bin Meng
2020-05-04 23:17 ` [PATCH 16/36] bdinfo: microblaze: sh: nios2: Drop arch-specific flash info Simon Glass
2020-05-06  8:09   ` Bin Meng
2020-05-04 23:17 ` [PATCH 17/36] bdinfo: Drop unnecessary inline on functions Simon Glass
2020-05-06  8:09   ` Bin Meng
2020-05-04 23:17 ` [PATCH 18/36] bdinfo: Drop print_std_bdinfo() Simon Glass
2020-05-06  8:09   ` Bin Meng
2020-05-04 23:17 ` [PATCH 19/36] bdinfo: ppc: Drop arch-specific print_baudrate() Simon Glass
2020-05-06  8:09   ` Bin Meng
2020-05-06 15:09   ` Stefan Roese
2020-05-04 23:17 ` [PATCH 20/36] bdinfo: sh: arc: Drop arch-specific print_bi_mem() Simon Glass
2020-05-06  8:09   ` Bin Meng
2020-05-06  9:04     ` Alexey Brodkin
2020-05-04 23:17 ` [PATCH 21/36] bdinfo: Drop print_bi_boot_params() Simon Glass
2020-05-06  8:09   ` Bin Meng
2020-05-04 23:17 ` [PATCH 22/36] bdinfo: Drop print_bi_flash() Simon Glass
2020-05-06  8:09   ` Bin Meng
2020-05-06 14:10     ` Tom Rini
2020-05-06 14:47     ` Simon Glass
2020-05-04 23:17 ` [PATCH 23/36] bdinfo: Drop print_cpu_word_size() Simon Glass
2020-05-06  8:09   ` Bin Meng
2020-05-04 23:17 ` [PATCH 24/36] bdinfo: net: ppc: Drop bi_enet1addr and other similar info Simon Glass
2020-05-06  8:09   ` Bin Meng
2020-05-06 15:09   ` Stefan Roese
2020-05-04 23:17 ` [PATCH 25/36] bdinfo: net: ppc: Drop prints for CONFIG_HAS_ETHn Simon Glass
2020-05-06  8:09   ` Bin Meng
2020-05-06 15:10   ` Stefan Roese
2020-05-04 23:17 ` [PATCH 26/36] bdinfo: net: Drop legacy ethernet bdinfo Simon Glass
2020-05-06  8:09   ` Bin Meng
2020-05-06 14:47     ` Simon Glass
2020-05-04 23:17 ` [PATCH 27/36] bdinfo: net: Inline print_eths() Simon Glass
2020-05-06  8:10   ` Bin Meng
2020-05-04 23:17 ` [PATCH 28/36] bdinfo: net: Inline print_eth_ip_addr() Simon Glass
2020-05-06  8:10   ` Bin Meng
2020-05-04 23:17 ` [PATCH 29/36] bdinfo: Export some basic printing functions Simon Glass
2020-05-06  8:10   ` Bin Meng
2020-05-04 23:17 ` [PATCH 30/36] bdinfo: arm: Move ARM-specific info into its own file Simon Glass
2020-05-06  8:10   ` Bin Meng
2020-05-06 16:10   ` Daniel Schwierzeck
2020-05-04 23:17 ` [PATCH 31/36] bdinfo: ppc: Move PPC-specific " Simon Glass
2020-05-06  8:10   ` Bin Meng
2020-05-06 15:10   ` Stefan Roese
2020-05-04 23:17 ` [PATCH 32/36] bdinfo: m68k: Move m68k-specific " Simon Glass
2020-05-06  8:10   ` Bin Meng
2020-05-06 20:11   ` Angelo Dureghello
2020-05-04 23:17 ` [PATCH 33/36] bdinfo: m68k: ppc: Move arch-specific code from bdinfo Simon Glass
2020-05-06  8:10   ` Bin Meng
2020-05-06 15:10   ` Stefan Roese
2020-05-04 23:17 ` [PATCH 34/36] bdinfo: Update the file comments Simon Glass
2020-05-06  8:10   ` Bin Meng
2020-05-04 23:17 ` [PATCH 35/36] bdinfo: dm: Update fb_base when using driver model Simon Glass
2020-05-06  8:10   ` Bin Meng
2020-05-04 23:17 ` [PATCH 36/36] bdinfo: x86: vesa: Update fb_base to the correct value Simon Glass
2020-05-06  8:10   ` Bin Meng
2020-05-06  9:28 ` [PATCH 00/36] Tidy up the 'bd' command Alexey Brodkin
2020-05-06 14:47   ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.