Skip to contentSkip to conversation

use MAC from environment and add support for new NET_MULTI api in ethernet driver of KS8695

PATCH New Bernstein 2 participants 2 messages Nov 4, 2010 – Nov 9, 2010 Network drivers

lore
Share & tools
lore

Bernstein

#0 lore raw

PATCH 1/2 use MAC from environment and add support for new NET_MULTI api in ethernet driver of KS8695

Hello,

Use MAC from the environment instead of read a hard coded address in the ethernet driver of the KS8695.

---

drivers/net/ks8695eth.c 2010-01-22 19:52:39.000000000 +0100 renamed from drivers/net/ks8695eth.c 2009-12-15 23:20:54.000000000 +0100 +16 -12
diff --unified --recursive --new-file u-boot-2009.11/drivers/net/ks8695eth.c u-boot-2009.11,new/drivers/net/ks8695eth.c
@@ -82,19 +82,23 @@
 
 void ks8695_getmac(void)
 {
-       unsigned char *fp;
-       int i;
+       if (!eth_getenv_enetaddr("ethaddr", &eth_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(&eth_mac[0], fp, 6);
        }
-
-       /* If we found a valid looking MAC address then use it */
-       if (i < 6)
-               memcpy(&eth_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 [email protected] 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

#1 lore raw

PATCH 1/2 use MAC from environment and add support for new NET_MULTI api in ethernet driver of KS8695

Quoted 4 lines · Michael

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

this is a pretty old tree. you should be using latest mainline tree.

drivers/net/ks8695eth.c 2010-01-22 19:52:39.000000000 +0100 line 85

Quoted 5 lines

void ks8695_getmac(void)
{

drivers/net/ks8695eth.c 2010-01-22 19:52:39.000000000 +0100 renamed from drivers/net/ks8695eth.c 2009-12-15 23:20:54.000000000 +0100 +1 -2
-       unsigned char *fp;
-       int i;
+       if (!eth_getenv_enetaddr("ethaddr", &eth_mac[0])) {

NAK. drivers should not be poking the environment. please read the documentation in doc/README.drivers.eth.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101109/1c617b25/attachment.pgp