Re: [U-Boot] [PATCH 1/2] use MAC from environment and add support for new NET_MULTI api in ethernet driver of KS8695

2010-11-09 Thread Mike Frysinger
On Thursday, November 04, 2010 06:13:00 Bernstein, Michael wrote:
> 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.

>  void ks8695_getmac(void)
>  {
> -   unsigned char *fp;
> -   int i;
> +   if (!eth_getenv_enetaddr("ethaddr", ð_mac[0])) {

NAK.  drivers should not be poking the environment.  please read the 
documentation in doc/README.drivers.eth.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2010-11-04 Thread Bernstein, Michael
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.0 
+0100
+++ u-boot-2009.11.new/drivers/net/ks8695eth.c  2010-01-22 19:52:39.0 
+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 |= 0x0008;
+   ks8695_rx[RXDESCS-1].ctrl |= 0x0200;
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.bernst...@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: i...@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
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot