[U-Boot] [PATCH 5/6] cmd/bdinfo: extract print_baudrate
Max Filippov
jcmvbkbc at gmail.com
Wed Jul 27 07:27:38 CEST 2016
print_baudrate outputs serial baud rate.
Signed-off-by: Max Filippov <jcmvbkbc at gmail.com>
---
cmd/bdinfo.c | 39 +++++++++++++++++++++++++--------------
1 file changed, 25 insertions(+), 14 deletions(-)
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index ab56ea5..b4abb91 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -144,6 +144,17 @@ static inline void print_eth_ip_addr(void)
#endif
}
+static inline void print_baudrate(void)
+{
+#if defined(CONFIG_PPC)
+ printf("baudrate = %6u bps\n", gd->baudrate);
+#elif defined(CONFIG_SPARC)
+ printf("baudrate = %6u bps\n", gd->baudrate);
+#else
+ printf("baudrate = %u bps\n", gd->baudrate);
+#endif
+}
+
#if defined(CONFIG_PPC)
void __weak board_detail(void)
{
@@ -202,7 +213,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#endif
print_eth_ip_addr();
- printf("baudrate = %6u bps\n", gd->baudrate);
+ print_baudrate();
print_num("relocaddr", gd->relocaddr);
board_detail();
return 0;
@@ -223,7 +234,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#endif
print_eth_ip_addr();
- printf("baudrate = %u bps\n", gd->baudrate);
+ print_baudrate();
return 0;
}
@@ -243,7 +254,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
print_eths();
#endif
- printf("baudrate = %u bps\n", gd->baudrate);
+ print_baudrate();
print_num("relocaddr", gd->relocaddr);
print_num("reloc off", gd->reloc_off);
print_num("fdt_blob", (ulong)gd->fdt_blob);
@@ -279,7 +290,7 @@ int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
GENERATED_GBL_DATA_SIZE);
print_eth_ip_addr();
- printf("baudrate = %6u bps\n", gd->baudrate);
+ print_baudrate();
return 0;
}
@@ -309,7 +320,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_mhz("vcofreq", bd->bi_vcofreq);
#endif
print_eth_ip_addr();
- printf("baudrate = %u bps\n", gd->baudrate);
+ print_baudrate();
return 0;
}
@@ -331,7 +342,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();
- printf("baudrate = %u bps\n", gd->baudrate);
+ print_baudrate();
return 0;
}
@@ -346,7 +357,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();
- printf("baudrate = %u bps\n", gd->baudrate);
+ print_baudrate();
print_num("relocaddr", gd->relocaddr);
print_num("reloc off", gd->reloc_off);
@@ -363,7 +374,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();
- printf("baudrate = %u bps\n", gd->baudrate);
+ print_baudrate();
return 0;
}
@@ -388,7 +399,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
print_eths();
#endif
- printf("baudrate = %u bps\n", gd->baudrate);
+ print_baudrate();
#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
print_num("TLB addr", gd->arch.tlb_addr);
#endif
@@ -423,7 +434,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();
- printf("baudrate = %u bps\n", gd->baudrate);
+ print_baudrate();
return 0;
}
@@ -451,7 +462,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_eth_ip_addr();
print_mhz("ethspeed", bd->bi_ethspeed);
#endif
- printf("baudrate = %u bps\n", gd->baudrate);
+ print_baudrate();
return 0;
}
@@ -482,7 +493,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_bi_boot_params(bd);
print_bi_dram(bd);
print_eth_ip_addr();
- printf("baudrate = %u bps\n", gd->baudrate);
+ print_baudrate();
return 0;
}
@@ -496,7 +507,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();
- printf("baudrate = %u bps\n", gd->baudrate);
+ print_baudrate();
return 0;
}
@@ -509,7 +520,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_bi_mem(bd);
print_eth_ip_addr();
- printf("baudrate = %d bps\n", gd->baudrate);
+ print_baudrate();
return 0;
}
--
2.1.4
More information about the U-Boot
mailing list