From patchwork Thu Nov 4 10:13:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bernstein, Michael" X-Patchwork-Id: 71989 Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id C24E312A81E3 for ; Thu, 4 Nov 2010 11:14:33 +0100 (CET) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id ADFC23335219 for ; Thu, 4 Nov 2010 11:14:33 +0100 (CET) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.17) for (single-drop); Thu, 04 Nov 2010 11:14:33 +0100 (CET) Received: from murder ([192.168.8.180]) by backend2 (Cyrus v2.2.12) with LMTPA; Thu, 04 Nov 2010 11:13:19 +0100 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend1.mail.m-online.net (Cyrus v2.2.12) with LMTPA; Thu, 04 Nov 2010 11:13:19 +0100 Received: from scanner-2.m-online.net (scanner-2.mail.m-online.net [192.168.8.166]) by mail.m-online.net (Postfix) with ESMTP id 2656A1C001A3; Thu, 4 Nov 2010 11:13:19 +0100 (CET) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-2.m-online.net (Postfix) with ESMTP id 270B3468D7F; Thu, 4 Nov 2010 11:13:15 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 87786280AD; Thu, 4 Nov 2010 11:13:13 +0100 (CET) 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 x8E4qJb-L9T8; Thu, 4 Nov 2010 11:13:13 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 604BC280AF; Thu, 4 Nov 2010 11:13:08 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 45336280AA for ; Thu, 4 Nov 2010 11:13:05 +0100 (CET) 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 KD4wQy59gdEO for ; Thu, 4 Nov 2010 11:13:04 +0100 (CET) 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 cwaremx01.controlware.de (cwaremx01.controlware.de [193.22.120.74]) by theia.denx.de (Postfix) with ESMTPS id 83C872808B for ; Thu, 4 Nov 2010 11:13:04 +0100 (CET) Received: from cwaremx01.controlware.de (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id 63462101E6AE_CD28340B for ; Thu, 4 Nov 2010 09:56:16 +0000 (GMT) Received: from ntexfe1.controlware.de (unknown [172.16.60.160]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "owa.controlware.de", Issuer "ntsubca" (not verified)) by cwaremx01.controlware.de (Sophos Email Appliance) with ESMTP id 72BCA102D581_CD2833FF for ; Thu, 4 Nov 2010 09:56:14 +0000 (GMT) Received: from NTEXCCR.controlware.de ([172.16.60.171]) by ntexfe1.controlware.de ([172.16.60.160]) with mapi; Thu, 4 Nov 2010 11:13:01 +0100 From: "Bernstein, Michael" To: "U-Boot Mailingliste (u-boot@lists.denx.de)" Date: Thu, 4 Nov 2010 11:13:00 +0100 Thread-Topic: [PATCH 1/2] use MAC from environment and add support for new NET_MULTI api in ethernet driver of KS8695 Thread-Index: Act8CNwIfEGl4290RC+ukPEhD9Nx8A== Message-ID: Accept-Language: de-DE Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: de-DE MIME-Version: 1.0 Subject: [U-Boot] [PATCH 1/2] use MAC from environment and add support for new NET_MULTI api in ethernet driver of KS8695 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 X-Virus-Scanned: by amavisd-new at m-online.net Hello, Use MAC from the environment instead of read a hard coded address in the ethernet driver of the KS8695. Signed-off-by: Michael Bernstein --- -- diff --unified --recursive --new-file u-boot-2009.11/drivers/net/ks8695eth.c u-boot-2009.11,new/drivers/net/ks8695eth.c --- u-boot-2009.11/drivers/net/ks8695eth.c 2009-12-15 23:20:54.000000000 +0100 +++ u-boot-2009.11.new/drivers/net/ks8695eth.c 2010-01-22 19:52:39.000000000 +0100 @@ -82,19 +82,23 @@ void ks8695_getmac(void) { - unsigned char *fp; - int i; + if (!eth_getenv_enetaddr("ethaddr", ð_mac[0])) { + /* no mac in environment - fallback to old */ + /* code which reads the mac from memory. */ + unsigned char *fp; + int i; + + /* Check if flash MAC is valid */ + fp = (unsigned char *) 0x0201c000; + for (i = 0; (i < 6); i++) { + if ((fp[i] != 0) && (fp[i] != 0xff)) + break; + } - /* Check if flash MAC is valid */ - fp = (unsigned char *) 0x0201c000; - for (i = 0; (i < 6); i++) { - if ((fp[i] != 0) && (fp[i] != 0xff)) - break; + /* If we found a valid looking MAC address then use it */ + if (i < 6) + memcpy(ð_mac[0], fp, 6); } - - /* If we found a valid looking MAC address then use it */ - if (i < 6) - memcpy(ð_mac[0], fp, 6); } /****************************************************************************/ @@ -137,7 +141,7 @@ ks8695_rx[i].addr = (uint32_t) &ks8695_bufs[(i+TXDESCS)*BUFSIZE]; ks8695_rx[i].next = (uint32_t) &ks8695_rx[i+1]; } - ks8695_rx[RXDESCS-1].ctrl |= 0x00080000; + ks8695_rx[RXDESCS-1].ctrl |= 0x02000000; ks8695_rx[RXDESCS-1].next = (uint32_t) &ks8695_rx[0]; /* The KS8695 is pretty slow reseting the ethernets... */