From patchwork Wed Aug 17 12:40:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Miao X-Patchwork-Id: 3482 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 46DF723F46 for ; Wed, 17 Aug 2011 12:40:41 +0000 (UTC) Received: from mail-ew0-f52.google.com (mail-ew0-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id 33E48A18201 for ; Wed, 17 Aug 2011 12:40:39 +0000 (UTC) Received: by ewy28 with SMTP id 28so484218ewy.11 for ; Wed, 17 Aug 2011 05:40:39 -0700 (PDT) Received: by 10.213.29.147 with SMTP id q19mr1210345ebc.132.1313584838777; Wed, 17 Aug 2011 05:40:38 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.213.102.5 with SMTP id e5cs15582ebo; Wed, 17 Aug 2011 05:40:38 -0700 (PDT) Received: by 10.224.194.136 with SMTP id dy8mr1111965qab.336.1313584836816; Wed, 17 Aug 2011 05:40:36 -0700 (PDT) Received: from mail-vw0-f50.google.com (mail-vw0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id gh8si3077122qab.10.2011.08.17.05.40.35 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 17 Aug 2011 05:40:35 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.y.miao@gmail.com designates 209.85.212.50 as permitted sender) client-ip=209.85.212.50; Authentication-Results: mx.google.com; spf=pass (google.com: domain of eric.y.miao@gmail.com designates 209.85.212.50 as permitted sender) smtp.mail=eric.y.miao@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by vws14 with SMTP id 14so715721vws.37 for ; Wed, 17 Aug 2011 05:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=ntxUKgMA03zfx861DICuCmq5HwisjTI1nN0P5QhbjGE=; b=iZS7ZRV7/O6kuuRX3HmkGRDTybD/eaw0Cp/NgO46DIVyEInGK2CnztpMMih84CsR2b rZak0CgtlgFF/Uv2loK4ztcA7o3QF7CMgNX2NmjfPTbwPUOaEJNkmxpB53tFvwg44sEI 6x/eSMlagA3h2KI9bD/RWIp4R+TseeTxNud7E= Received: by 10.52.27.34 with SMTP id q2mr848601vdg.214.1313584835105; Wed, 17 Aug 2011 05:40:35 -0700 (PDT) MIME-Version: 1.0 Sender: eric.y.miao@gmail.com Received: by 10.52.106.170 with HTTP; Wed, 17 Aug 2011 05:40:15 -0700 (PDT) In-Reply-To: <1313559224-4627-1-git-send-email-eric.miao@linaro.org> References: <1313559224-4627-1-git-send-email-eric.miao@linaro.org> From: Eric Miao Date: Wed, 17 Aug 2011 20:40:15 +0800 X-Google-Sender-Auth: 5NLV6aLnRIPE42moZyZU8ur0toI Message-ID: Subject: Fwd: [PATCH] net/eth.c: fix eth_write_hwaddr() to use dev->enetaddr as fall back To: John Rigby , Jason Hui , Spring Zhang Cc: Linaro Dev Guys, The patch below fixed the recent ethernet not working issue due to absence of MAC address. It's Acked-by the original guilty commit author, please consider merging into next release of u-boot. The real problem, however, is that kernel ethernet driver has an incorrect assumption on a correct configuration of registers of the MAC address by the boot loader, which isn't always true. So the next fix would be the kernel driver to be independent of the boot loader. Still figuring the correct way for this though. ---------- Forwarded message ---------- From: Eric Miao Date: Wed, Aug 17, 2011 at 1:33 PM Subject: [PATCH] net/eth.c: fix eth_write_hwaddr() to use dev->enetaddr as fall back To: u-boot@lists.denx.de Cc: Simon Glass , Eric Miao Ignore the return value of eth_getenv_enetaddr_by_index(), and if it fails, fall back to use dev->enetaddr, which could be filled up by the ethernet device driver. Actually, this is the original behavior, and was later changed by commit 48506a2cde2458fa1f8c5993afc98e5a4617e1d3. Signed-off-by: Eric Miao ---  net/eth.c |    3 +--  1 files changed, 1 insertions(+), 2 deletions(-)                if (memcmp(dev->enetaddr, "\0\0\0\0\0\0", 6) && -- 1.7.4.1 diff --git a/net/eth.c b/net/eth.c index a34fe59..c4fbe11 100644 --- a/net/eth.c +++ b/net/eth.c @@ -195,8 +195,7 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,        unsigned char env_enetaddr[6];        int ret = 0; -       if (!eth_getenv_enetaddr_by_index(base_name, eth_number, env_enetaddr)) -               return -1; +       eth_getenv_enetaddr_by_index(base_name, eth_number, env_enetaddr);        if (memcmp(env_enetaddr, "\0\0\0\0\0\0", 6)) {