From patchwork Thu Aug 9 13:33:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Vernier X-Patchwork-Id: 176086 X-Patchwork-Delegate: albert.aribaud@free.fr 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 642602C00E4 for ; Thu, 9 Aug 2012 23:33:30 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0BF75280FF; Thu, 9 Aug 2012 15:33:27 +0200 (CEST) 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 yOza3N3dzpv1; Thu, 9 Aug 2012 15:33:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AC3AE280E2; Thu, 9 Aug 2012 15:33:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B9FC3280EB for ; Thu, 9 Aug 2012 15:33:21 +0200 (CEST) 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 iIDcRRTKzIiK for ; Thu, 9 Aug 2012 15:33:20 +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-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) by theia.denx.de (Postfix) with ESMTPS id 067B5280DE for ; Thu, 9 Aug 2012 15:33:18 +0200 (CEST) Received: by lbbgg6 with SMTP id gg6so269916lbb.3 for ; Thu, 09 Aug 2012 06:33:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:organization :x-mailer:mime-version:content-type:content-transfer-encoding :x-gm-message-state; bh=2ZjMmefQex7cO+v74pQuxhpP6W9YB8RvajSIwQX0m3U=; b=OzmEw20n9GV54uh0oqwjKmS7gtULrnRazSkVVkVmTYyypVyYMeeuRtmhF5UkxF4jj0 WOLwCmad4IGTX8DsG/oJ4HwbQ7lfX4y1NpnX6/iC9488Iw4sn9Uwq8BfENySkT77CooO 2aJj/NMDEI8ApJyrMf3OVv3pdB5BI4LLaHHQt8kH+9fCP6G7P4Cy5GI/dos0KKSqIH2i eKI1U8ltzcKMNzOObh9mTku9uIpunbvyVXsyXr2io8wTiMFQu78bOAel4hAXyScAWf9i MxgrPNjTgH1FMLCwiLDnSp0nzUBAU0b2JNMN+75C/TxrmAmASR56vm9AthoDiWeLOu2A 80lA== Received: by 10.112.42.164 with SMTP id p4mr827767lbl.54.1344519197680; Thu, 09 Aug 2012 06:33:17 -0700 (PDT) Received: from latmask.vernier.se (c213-89-175-97.bredband.comhem.se. [213.89.175.97]) by mx.google.com with ESMTPS id j1sm346281lby.8.2012.08.09.06.33.16 (version=SSLv3 cipher=OTHER); Thu, 09 Aug 2012 06:33:17 -0700 (PDT) Date: Thu, 9 Aug 2012 15:33:06 +0200 From: Yann Vernier To: u-boot@lists.denx.de Message-ID: <20120809153306.4e5dad97@latmask.vernier.se> In-Reply-To: <20120706133342.47ace724@aari01-12> References: <20120706133342.47ace724@aari01-12> Organization: ORSoC AB X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Gm-Message-State: ALoCoQmN77QVhhlJSqkpegn/3nC4jnNIeOVnVqgACXYn9qboHN01hXDhmhB5B4Q52lXj0C0MEMPx Subject: [U-Boot] [PATCH 11/11] arm: cm4008, cm41xx: read MAC address from flash 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Previously code to do this was in the Ethernet driver itself. Since it is board specific, moved it here, and altered it to support preset MAC from environment. Signed-off-by: Yann Vernier --- board/cm4008/cm4008.c | 12 ++++++++++++ board/cm41xx/cm41xx.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/board/cm4008/cm4008.c b/board/cm4008/cm4008.c index 6c0da9a..e14f8f4 100644 --- a/board/cm4008/cm4008.c +++ b/board/cm4008/cm4008.c @@ -75,10 +75,22 @@ int board_late_init (void) return 0; } +#ifdef CONFIG_DRIVER_KS8695ETH int board_eth_init(bd_t *bis) { + uchar enetaddr[6]; + const uchar * const fp=CONFIG_SYS_FLASH_BASE+0x1c000; + + /* read MAC address from flash */ + if (!eth_getenv_enetaddr("ethaddr", enetaddr)) { + memcpy(&enetaddr[0], fp, 6); + if (is_valid_ether_addr(enetaddr)) + eth_setenv_enetaddr("ethaddr", enetaddr); + } + return ks8695_eth_initialize(); } +#endif int board_init (void) { diff --git a/board/cm41xx/cm41xx.c b/board/cm41xx/cm41xx.c index 6aef617..771701d 100644 --- a/board/cm41xx/cm41xx.c +++ b/board/cm41xx/cm41xx.c @@ -75,10 +75,22 @@ int board_late_init (void) return 0; } +#ifdef CONFIG_DRIVER_KS8695ETH int board_eth_init(bd_t *bis) { + uchar enetaddr[6]; + const uchar * const fp=CONFIG_SYS_FLASH_BASE+0x1c000; + + /* read MAC address from flash */ + if (!eth_getenv_enetaddr("ethaddr", enetaddr)) { + memcpy(&enetaddr[0], fp, 6); + if (is_valid_ether_addr(enetaddr)) + eth_setenv_enetaddr("ethaddr", enetaddr); + } + return ks8695_eth_initialize(); } +#endif int board_init (void) {