[U-Boot] [PATCH 1/2] use MAC from environment and add support for new NET_MULTI api in ethernet driver of KS8695
Bernstein, Michael
Michael.Bernstein at controlware.de
Thu Nov 4 11:13:00 CET 2010
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 <Michael.Bernstein at controlware.de>
---
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... */
--
_________________________________________________
Michael Bernstein
NOC
Controlware GmbH
Waldstrasse 92, 63128 Dietzenbach, GERMANY
Tel.: +49 6074 858-177
Fax: +49 6074 858-148
Michael.Bernstein at controlware.de
www.controlware.de
_________________________________________________
State-of-the-art Technology for Worldwide Telecommunications
<<< Dienstleistung nach Maß >>>
Emergency Response Services
Schnelle und zuverlässige Unterstützung bei IT-Sicherheitsvorfällen aller Art.
Weitere Infos unter http://www.controlware.de/ers
Diese E-Mail kann vertrauliche oder rechtlich geschützte Informationen enthalten. Wenn Sie nicht der beabsichtigte Empfänger sind, informieren Sie bitte sofort den Absender und löschen Sie diese E-Mail. Das unbefugte Kopieren dieser E-Mail oder die unbefugte Weitergabe der enthaltenen Informationen ist nicht gestattet.
The information contained in this message is confidential or protected by law. If you are not the intended recipient, please contact the sender and delete this message. Any unauthorised copying of this message or unauthorised distribution of the information contained herein is prohibited.
Controlware GmbH Kommunikationssysteme
Telefon: (0 60 74) 8 58-0
E-Mail: info at controlware.de
http://www.controlware.de
Sitz: 63128 Dietzenbach, Registergericht: Offenbach a.M., HRB Nr. 6431, USt.-Id.-Nr. DE 113539225
Geschäftsführung: Helmut E. Wörner (Vorsitzender), Bernd Schwefing, Hubert Potthoff Beirat: Dr. Gert Sieger (Vorsitzender), Dr. Peter Pagé, Kurt Sibold
More information about the U-Boot
mailing list