From patchwork Tue Aug 25 11:55:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Schmelzer X-Patchwork-Id: 510470 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 A69801401EF for ; Tue, 25 Aug 2015 21:58:03 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 427454B65B; Tue, 25 Aug 2015 13:58:01 +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 wa45s0Hgpw5F; Tue, 25 Aug 2015 13:58:00 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7B46F4B64D; Tue, 25 Aug 2015 13:58:00 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 36E4B4B64D for ; Tue, 25 Aug 2015 13:57:58 +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 QAhK4CDFkHKQ for ; Tue, 25 Aug 2015 13:57:58 +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.schmelzer.or.at (mail.schmelzer.or.at [87.106.47.214]) by theia.denx.de (Postfix) with ESMTP id 0FF954B639 for ; Tue, 25 Aug 2015 13:57:54 +0200 (CEST) Received: from localhost (s15287728.onlinehome-server.info [127.0.0.1]) by hamspirit.at (Postfix) with ESMTP id 454A38F480C5; Tue, 25 Aug 2015 11:57:54 +0000 (UTC) Received: from mail.schmelzer.or.at ([127.0.0.1]) by localhost (s15287728.onlinehome-server.info [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mfT5JSu1OuSr; Tue, 25 Aug 2015 11:57:48 +0000 (UTC) Received: from hpm-debian.br-automation.co.at (212095007164.public.telering.at [212.95.7.164]) by hamspirit.at (Postfix) with ESMTP id 8E7288F480BB; Tue, 25 Aug 2015 11:57:46 +0000 (UTC) From: Hannes Schmelzer To: u-boot@lists.denx.de Date: Tue, 25 Aug 2015 13:55:41 +0200 Message-Id: <1440503741-3685-1-git-send-email-oe5hpm@oevsv.at> X-Mailer: git-send-email 1.9.1 Cc: trini@konsulko.com, Hannes Schmelzer , Masahiro Yamada , Joe Hershberger , Hannes Schmelzer Subject: [U-Boot] [PATCH] board/BuR: simplify default IP-setup on B&R boards. 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" To simplify and having a common default IP-setup on all B&R boards we introduce an environment variable "brdefaultip" which does following. Test if ${ipaddr} is empty, if yes it set's up some defaults: - ipaddr : 192.168.60.1 - netmask : 255.255.255.0 - gatewayip: 192.168.60.254 - serverip : 192.168.60.254 This environment is ran from CONFIG_PREBOOT. All other "tricks" are dropped. Signed-off-by: Hannes Schmelzer Reviewed-by: Tom Rini Acked-by: Joe Hershberger --- board/BuR/kwb/board.c | 10 ---------- include/configs/bur_am335x_common.h | 12 +++++------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/board/BuR/kwb/board.c b/board/BuR/kwb/board.c index 640aca4..039ec20 100644 --- a/board/BuR/kwb/board.c +++ b/board/BuR/kwb/board.c @@ -283,16 +283,6 @@ int board_late_init(void) } /* setup vxworks bootline */ char *vxworksbootline = (char *)VXWORKS_BOOTLINE; - - /* setup default IP, in case if there is nothing in environment */ - if (!getenv("ipaddr")) { - setenv("ipaddr", "192.168.60.1"); - setenv("netmask", "255.255.255.0"); - setenv("serverip", "192.168.60.254"); - setenv("gatewayip", "192.168.60.254"); - puts("net: had no IP! made default setup.\n"); - } - sprintf(vxworksbootline, "%s h=%s e=%s:%s g=%s %s o=0x%08x;0x%08x;0x%08x;0x%08x", DEFAULT_BOOTLINE, diff --git a/include/configs/bur_am335x_common.h b/include/configs/bur_am335x_common.h index 838ef1f..c696092 100644 --- a/include/configs/bur_am335x_common.h +++ b/include/configs/bur_am335x_common.h @@ -14,18 +14,16 @@ /* ------------------------------------------------------------------------- */ #define BUR_COMMON_ENV \ "usbscript=usb start && fatload usb 0 0x80000000 usbscript.img && source\0" \ -"defaultip=192.168.60.253\0" \ -"defaultsip=192.168.60.254\0" \ +"brdefaultip=if test -r ${ipaddr}; then; else" \ +" setenv ipaddr 192.168.60.1; setenv serverip 192.168.60.254;" \ +" setenv gatewayip 192.168.60.254; setenv netmask 255.255.255.0; fi;\0" \ "netconsole=echo switching to network console ...; " \ -"if dhcp; then setenv ncip ${serverip}; " \ -"else " \ -"setenv ncip 192.168.60.254; setenv serverip 192.168.60.254; " \ -"setenv gatewayip 192.168.60.254; setenv ipaddr 192.168.60.1; " \ -"fi; " \ +"if dhcp; then; else run brdefaultip; fi; setenv ncip ${serverip}; " \ "setcurs 1 9; lcdputs myip; setcurs 10 9; lcdputs ${ipaddr};" \ "setcurs 1 10;lcdputs serverip; setcurs 10 10; lcdputs ${serverip};" \ "setenv stdout nc;setenv stdin nc;setenv stderr nc\0" +#define CONFIG_PREBOOT "run brdefaultip" #define CONFIG_CMD_TIME #define CONFIG_SYS_GENERIC_BOARD