From patchwork Thu Jul 28 00:57:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 653518 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3s0D6L4fCFz9ryZ for ; Thu, 28 Jul 2016 10:59:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=ZSU2JV46; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E9FE1A7535; Thu, 28 Jul 2016 02:59:31 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0LpgkPjT24Zf; Thu, 28 Jul 2016 02:59:31 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A8869A76F3; Thu, 28 Jul 2016 02:59:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 211D0A7537 for ; Thu, 28 Jul 2016 02:58:41 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Qr1zBs-o5SwW for ; Thu, 28 Jul 2016 02:58:41 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by theia.denx.de (Postfix) with ESMTPS id 29692A761F for ; Thu, 28 Jul 2016 02:58:30 +0200 (CEST) Received: by mail-lf0-f68.google.com with SMTP id l89so2890709lfi.2 for ; Wed, 27 Jul 2016 17:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0e5Mc0uAZwcU80SF/a+9iyNeYKnHq3ZFRSouFv9DGdY=; b=ZSU2JV463SD7EONWJnWZByRAxJMZj5PXEJvEmEuj8uDsASSKhjXhp2Ouf86Wbx3TT7 9Ts1l+RHBBsOr3zX+eoUH1c2bxxPJCROENSvh+yzzPk48WeQgebmDblA4ddIaLJWIhXw 90xLiBO5DDn9Q4keJHzHjjRRjtoVv7HNFpvPug8yKkghAbBDXWrPZaeWWtVZTkGx3980 uXnyju1NtyGrfRKlnad8SsSD5T1qGlUo5hFWOXbqWxSaLMDWZP0+OdllI6oez978AOd7 57deOC5+ZwTrN80f6dDkMEeQnADgjRJZgny3GLZSfCK+0gFmkA55xip6z35JNYm4NQbG reNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0e5Mc0uAZwcU80SF/a+9iyNeYKnHq3ZFRSouFv9DGdY=; b=AhrDCt00cnnGyP0dtOtQrYcUWIwqj6r/cyaj7rQqE0/jPf3PQjDoQ4xQQuHQslmJB/ vRCZcNpYDQ4d7I87g9knN55Or7Un7kgdVYgXUUHhWd+cTp3s0eXHwu0ejXeuDdeMxIXq VAcRi1H2RMXYOms3gzTRc6OzYBdb9HdxEHnIv/FQN67+nMLzHqnOrXR6V21WWtGNQ8bo sgxgxNXxeZ8TfLIjSIVKSm0kM1WCsSk/JCU1kKjMLueLMjGYra8tC298OXuwa7SxP+QF lILcBPiWKZKeNfHmA7YILgZNlBliqVko7Y5Y4MR23YIeFw5xBWXLmyqdIJY6FHJwAA5v whzg== X-Gm-Message-State: AEkoouvr1QkSR68ejUBL3BiFJ22NxnhkXA2NH359jRMbo3m1mggEu9GS/ZNY8LPSq+TGvA== X-Received: by 10.46.0.201 with SMTP id e70mr12189395lji.57.1469667509798; Wed, 27 Jul 2016 17:58:29 -0700 (PDT) Received: from octofox.metropolis ([5.19.183.212]) by smtp.gmail.com with ESMTPSA id l10sm1420720lfd.19.2016.07.27.17.58.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Jul 2016 17:58:29 -0700 (PDT) From: Max Filippov To: u-boot@lists.denx.de Date: Thu, 28 Jul 2016 03:57:23 +0300 Message-Id: <1469667444-4686-7-git-send-email-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1469667444-4686-1-git-send-email-jcmvbkbc@gmail.com> References: <1469667444-4686-1-git-send-email-jcmvbkbc@gmail.com> Subject: [U-Boot] [PATCH v2 6/7] cmd/bdinfo: extract print_baudrate X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" print_baudrate outputs serial baud rate. Signed-off-by: Max Filippov Reviewed-by: Tom Rini Reviewed-by: Simon Glass --- cmd/bdinfo.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 4ffb757..403ed3e 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -146,6 +146,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) { @@ -204,7 +215,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; @@ -225,7 +236,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; } @@ -245,7 +256,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); @@ -281,7 +292,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; } @@ -311,7 +322,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; } @@ -333,7 +344,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; } @@ -348,7 +359,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); @@ -365,7 +376,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; } @@ -390,7 +401,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 @@ -425,7 +436,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; } @@ -453,7 +464,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; } @@ -484,7 +495,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; } @@ -498,7 +509,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; } @@ -511,7 +522,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; }