From patchwork Fri Jan 18 15:19:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Holger Freyther X-Patchwork-Id: 213647 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 0B3172C007B for ; Sat, 19 Jan 2013 02:48:25 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 905CB4A0F4; Fri, 18 Jan 2013 16:48:17 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 47+jGja39qCi; Fri, 18 Jan 2013 16:48:17 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CD36F4A0C2; Fri, 18 Jan 2013 16:48:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A94B74A0BF for ; Fri, 18 Jan 2013 16:28:39 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 HD-KwgU00dbJ for ; Fri, 18 Jan 2013 16:28:38 +0100 (CET) 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.sysmocom.de (sysmocom.de [78.46.147.233]) by theia.denx.de (Postfix) with ESMTP id 2418C4A0BD for ; Fri, 18 Jan 2013 16:28:33 +0100 (CET) Received: from sangmingze-mail.local (91-66-230-199-dynip.superkabel.de [91.66.230.199]) by mail.sysmocom.de (Postfix) with ESMTPSA id 462A325434F1; Fri, 18 Jan 2013 15:33:43 +0000 (UTC) Received: from localhost.lan ([127.0.0.1] helo=xiaoyu.lan) by sangmingze-mail.local with esmtp (Exim 4.80) (envelope-from ) id 1TwDjb-0002i4-L8; Fri, 18 Jan 2013 16:19:59 +0100 From: Holger Hans Peter Freyther To: u-boot@lists.denx.de Date: Fri, 18 Jan 2013 16:19:50 +0100 Message-Id: <1358522390-10161-3-git-send-email-holger@freyther.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1358522390-10161-1-git-send-email-holger@freyther.de> References: <1358522390-10161-1-git-send-email-holger@freyther.de> X-Mailman-Approved-At: Fri, 18 Jan 2013 16:48:04 +0100 Cc: Holger Hans Peter Freyther Subject: [U-Boot] [PATCH 3/3] mac: Fix the condition check for setting the MAC from the EEPROM X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The issue got introduced in a cleanup by Manjunath Hadli in commit 826e99136e2bce61f3f6572e32d7aa724c116e6d. The eth_getenv_enetaddr_by_index method will validate the MAC addr and if none is set in the environment 0 will be returned. Set the MAC from the eeprom if no valid address is found in environment. --- arch/arm/cpu/arm926ejs/davinci/misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/davinci/misc.c b/arch/arm/cpu/arm926ejs/davinci/misc.c index c310c69..162c1e0 100644 --- a/arch/arm/cpu/arm926ejs/davinci/misc.c +++ b/arch/arm/cpu/arm926ejs/davinci/misc.c @@ -104,7 +104,7 @@ void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr) int ret; ret = eth_getenv_enetaddr_by_index("eth", 0, env_enetaddr); - if (ret) { + if (!ret) { /* * There is no MAC address in the environment, so we * initialize it from the value in the EEPROM. @@ -115,7 +115,7 @@ void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr) ret = !eth_setenv_enetaddr("ethaddr", rom_enetaddr); } if (!ret) - printf("Failed to set mac address from EEPROM\n"); + printf("Failed to set mac address from EEPROM: %d\n", ret); } #endif /* CONFIG_DRIVER_TI_EMAC */