From patchwork Wed Jul 17 20:16:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 259754 X-Patchwork-Delegate: marek.vasut@gmail.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 739412C009F for ; Thu, 18 Jul 2013 06:18:21 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 42B424A10D; Wed, 17 Jul 2013 22:17:41 +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 KikoYpb1yToZ; Wed, 17 Jul 2013 22:17:41 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DEC394A0C7; Wed, 17 Jul 2013 22:16:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 718EE4A0F5 for ; Wed, 17 Jul 2013 22:16:38 +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 g79wz+XBf0hS for ; Wed, 17 Jul 2013 22:16:34 +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 1F5AF4A0B9 for ; Wed, 17 Jul 2013 22:16:18 +0200 (CEST) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r6HKGEvM026230; Wed, 17 Jul 2013 15:16:14 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r6HKGEm7017441; Wed, 17 Jul 2013 15:16:14 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Wed, 17 Jul 2013 15:16:14 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r6HKGEUI032715; Wed, 17 Jul 2013 15:16:14 -0500 Received: from localhost (h114-146.vpn.ti.com [172.24.114.146]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id r6HKGDt00890; Wed, 17 Jul 2013 15:16:13 -0500 (CDT) From: Dan Murphy To: , , Date: Wed, 17 Jul 2013 15:16:05 -0500 Message-ID: <1374092167-27645-6-git-send-email-dmurphy@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1374092167-27645-1-git-send-email-dmurphy@ti.com> References: <1374092167-27645-1-git-send-email-dmurphy@ti.com> MIME-Version: 1.0 Cc: rogerq@ti.com Subject: [U-Boot] [PATCH v3 5/7] ARM: OMAP5-uevm: Add USB MAC ethernet address 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 Set the usbethaddr based on the OMAP DIE_ID registers which should be unique for each processor. Then set this as the usb ethernet MAC address. Signed-off-by: Dan Murphy --- v3 - new patch board/ti/omap5_uevm/evm.c | 26 ++++++++++++++++++++++++++ include/configs/omap5_uevm.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c index bf14cd2..9add0fd 100644 --- a/board/ti/omap5_uevm/evm.c +++ b/board/ti/omap5_uevm/evm.c @@ -33,6 +33,11 @@ #include #include #include + +#define MAX_DEVICE_MAC 20 +#define DIE_ID_REG_BASE (OMAP54XX_L4_CORE_BASE + 0x2000) +#define DIE_ID_REG_OFFSET 0x200 + #endif DECLARE_GLOBAL_DATA_PTR; @@ -121,6 +126,27 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { int ret; int auxclk; + int val[4] = { 0 }; + int reg; + char device_mac[MAX_DEVICE_MAC]; + + reg = DIE_ID_REG_BASE + DIE_ID_REG_OFFSET; + + val[0] = readl(reg); + val[1] = readl(reg + 0x8); + val[2] = readl(reg + 0xC); + val[3] = readl(reg + 0x10); + + /* create a fake MAC address from the processor ID code. + * first byte is 0x02 to signify locally administered. + */ + snprintf(device_mac, MAX_DEVICE_MAC, "%02X:%02X:%02X:%02X:%02X:%02X", + 0x02, val[3] & 0xff, val[2] & 0xff, val[1] & 0xff, + val[0] & 0xff, (val[0] >> 8 & 0xff)); + +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + setenv("usbethaddr", device_mac); +#endif auxclk = readl((*prcm)->scrm_auxclk1); /* Request auxilary clock */ diff --git a/include/configs/omap5_uevm.h b/include/configs/omap5_uevm.h index 0740a32..53b86ec 100644 --- a/include/configs/omap5_uevm.h +++ b/include/configs/omap5_uevm.h @@ -79,5 +79,7 @@ #define CONSOLEDEV "ttyO2" +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + #define CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC 16296 #endif /* __CONFIG_OMAP5_EVM_H */