From patchwork Fri Oct 5 12:09:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Vernier X-Patchwork-Id: 189468 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 C60682C0086 for ; Fri, 5 Oct 2012 22:12:36 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 34FEB280C9; Fri, 5 Oct 2012 14:12:35 +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 bsM20Ms9pbtI; Fri, 5 Oct 2012 14:12:34 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ACEE5280CC; Fri, 5 Oct 2012 14:10:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AC0472809F for ; Fri, 5 Oct 2012 14:10:36 +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 AMLJJP46O50f for ; Fri, 5 Oct 2012 14:10:36 +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 E3C5E28091 for ; Fri, 5 Oct 2012 14:10:24 +0200 (CEST) Received: by mail-lb0-f172.google.com with SMTP id k13so1325163lbo.3 for ; Fri, 05 Oct 2012 05:10:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:x-gm-message-state; bh=SAP1WT5Zaq9OVj7Qan9BbB1N6m/p0UYaxHvj/fV/zCs=; b=Oez3oz/hyMDwnI/CPY7bZvFDQ0E0RzN7UBlTFb/7eV9Q5D1pQrN3WpgqHggiom4ag+ O2z0dloOHE01/NZ2y/OUA9dzVyy6oE9p7avTTidCoitE00D5Ra8pFVf08VMONj7qvpi9 8BvZLIYd62ho2TZ3igQLKhOYjjHzIV2c9cR9qLFUayZcJ7r7lZFDne32DHVKeDX7arc4 J+hfkAQQ7c/dPD/bRoRSi/NInQHDhhUOpbgEsClfFHmoXzse1WpwW+tdtunV8pzcG/Qa Z0NM471/cFyoCcbB9JdHgNSPRbiT1QauhaG753eXrnZXiP3+prYxgpx/NIQ/Ie9IIydV hRtw== Received: by 10.112.86.102 with SMTP id o6mr3696122lbz.113.1349439024765; Fri, 05 Oct 2012 05:10:24 -0700 (PDT) Received: from latmask.orsoc.lan (c213-89-175-97.bredband.comhem.se. [213.89.175.97]) by mx.google.com with ESMTPS id fp7sm1102794lab.4.2012.10.05.05.10.24 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Oct 2012 05:10:24 -0700 (PDT) From: Yann Vernier To: u-boot@lists.denx.de Date: Fri, 5 Oct 2012 14:09:58 +0200 Message-Id: <1349438998-10954-12-git-send-email-yann.vernier@orsoc.se> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1349438998-10954-1-git-send-email-yann.vernier@orsoc.se> References: <1349438998-10954-1-git-send-email-yann.vernier@orsoc.se> In-Reply-To: <20121004111506.1777a119@lilith> References: <20121004111506.1777a119@lilith> X-Gm-Message-State: ALoCoQm+J3fITwhLIn+oxUY5hfQenUbAbGodO7ZCo9h7yKQ6kf3kWsgNHfAOPCCrczp2ekASSpkQ 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: , MIME-Version: 1.0 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. --- 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) {