From patchwork Fri Sep 30 11:39:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: nagabhushana.netagunte@ti.com X-Patchwork-Id: 117106 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 89978B6F75 for ; Fri, 30 Sep 2011 21:40:20 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6D43B285EF; Fri, 30 Sep 2011 13:40:17 +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 eQE0HoduFhVL; Fri, 30 Sep 2011 13:40:17 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6CC2C285BC; Fri, 30 Sep 2011 13:40:14 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 00A59285BC for ; Fri, 30 Sep 2011 13:40:10 +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 ND504r7V6zst for ; Fri, 30 Sep 2011 13:40:08 +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 devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by theia.denx.de (Postfix) with ESMTPS id BBBD5285BA for ; Fri, 30 Sep 2011 13:40:06 +0200 (CEST) Received: from dbdp20.itg.ti.com ([172.24.170.38]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id p8UBe1Kx026647 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 30 Sep 2011 06:40:03 -0500 Received: from dbde70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p8UBe0OB004524 for ; Fri, 30 Sep 2011 17:10:01 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 8.3.106.1; Fri, 30 Sep 2011 17:10:00 +0530 Received: from psplinux051.india.ti.com (psplinux051.india.ti.com [172.24.162.244]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p8UBdxEM006015; Fri, 30 Sep 2011 17:09:59 +0530 (IST) Received: from psplinux051.india.ti.com (localhost [127.0.0.1]) by psplinux051.india.ti.com (8.13.1/8.13.1) with ESMTP id p8UBdxvX011236; Fri, 30 Sep 2011 17:09:59 +0530 Received: (from x0144960@localhost) by psplinux051.india.ti.com (8.13.1/8.13.1/Submit) id p8UBdxTr011233; Fri, 30 Sep 2011 17:09:59 +0530 From: To: Date: Fri, 30 Sep 2011 17:09:59 +0530 Message-ID: <1317382799-11205-1-git-send-email-nagabhushana.netagunte@ti.com> X-Mailer: git-send-email 1.6.2.4 MIME-Version: 1.0 Cc: sudhakar.raj@ti.com, manjunath.hadli@ti.com Subject: [U-Boot] [PATCH] da830: add support to read mac addr from EEPROM X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 From: Nagabhushana Netagunte da830 boards have mac address stored in I2C EEPROM. This patch adds support to restore mac address from EEPROM if environment variable 'ethaddr' is not set. Signed-off-by: Sudhakar Rajashekhara Signed-off-by: Nagabhushana Netagunte --- board/davinci/da8xxevm/da830evm.c | 20 ++++++++++++++++++++ include/configs/da830evm.h | 1 + 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c index 0650653..69ed293 100644 --- a/board/davinci/da8xxevm/da830evm.c +++ b/board/davinci/da8xxevm/da830evm.c @@ -188,6 +188,26 @@ int board_init(void) #define PHY_SW_I2C_ADDR 0x5f /* Address of PHY on i2c bus */ +int misc_init_r(void) +{ + uint8_t eeprom_enetaddr[6]; + uint8_t val[2]; + + if (!eth_getenv_enetaddr("ethaddr", eeprom_enetaddr)) { + /* Read Ethernet MAC address from EEPROM if available. */ + if (dvevm_read_mac_address(eeprom_enetaddr)) + /* Set Ethernet MAC address from EEPROM */ + davinci_sync_env_enetaddr(eeprom_enetaddr); + } + + val[0] = 0x01; + val[1] = 0x23; + + if (i2c_write(PHY_SW_I2C_ADDR, 0, 0, val, 2)) + printf("Ethernet switch start failed!\n"); + +} + /* * Initializes on-board ethernet controllers. */ diff --git a/include/configs/da830evm.h b/include/configs/da830evm.h index 66fdea2..a451513 100644 --- a/include/configs/da830evm.h +++ b/include/configs/da830evm.h @@ -160,6 +160,7 @@ /* * U-Boot general configuration */ +#define CONFIG_MISC_INIT_R #undef CONFIG_USE_IRQ /* No IRQ/FIQ in U-Boot */ #undef CONFIG_MISC_INIT_R #undef CONFIG_BOOTDELAY