--- ecos-2.0/packages/devs/eth/rdc/r6040/v2_0/src/if_r6040.c	2008-02-16 15:51:46.000000000 +0100
+++ ecos-2.0-mgb100/packages/devs/eth/rdc/r6040/v2_0/src/if_r6040.c	2008-02-16 23:26:28.000000000 +0100
@@ -65,6 +65,8 @@
 //
 // 03-17-2005 17:17	Sten, Swap MAC0/1 finding sequence for AMIT board
 //			modify pci_init_find_6040s(), first is MAC1, then MAC0
+// 02-16-2008 21:45     Volker Weiss, set MAC1 address from flash (0x3f8000)
+//                      this is useful for MGB100 only
 //==========================================================================
 
 #include <pkgconf/system.h>
@@ -82,6 +84,7 @@
 #include <cyg/hal/drv_api.h>
 #include <cyg/io/eth/netdev.h>
 #include <cyg/io/eth/eth_drv.h>
+#include <string.h>
 #include <pkgconf/r8610.h>
 
 #ifdef CYGPKG_NET
@@ -240,6 +243,7 @@
 
 static int pci_init_find_6040s(void);
 
+static int mgb100_get_mac_address(char *mac_address);
 static void r6040_set_mac_address(struct r6040* p_r6040);
 
 static void InitRxRing(struct r6040* p_r6040);
@@ -379,14 +383,17 @@
 
 
     if (!p_r6040->hardwired_esa) {
-        // Set Hardwire the address by default.
-        p_r6040->mac_address[0] = 0x00;
-        p_r6040->mac_address[1] = 0x00;
-        p_r6040->mac_address[2] = 0x01;
-        p_r6040->mac_address[3] = 0x02;
-        p_r6040->mac_address[4] = 0x03;
-        p_r6040->mac_address[5] = 0x04;
-    	p_r6040->mac_addr_ok = 1;
+        if (!mgb100_get_mac_address(&p_r6040->mac_address[0]))
+        {
+            // Set Hardwire the address by default.
+            p_r6040->mac_address[0] = 0x00;
+            p_r6040->mac_address[1] = 0x00;
+            p_r6040->mac_address[2] = 0x01;
+            p_r6040->mac_address[3] = 0x02;
+            p_r6040->mac_address[4] = 0x03;
+            p_r6040->mac_address[5] = 0x04;
+        }
+        p_r6040->mac_addr_ok = 1;
     }
 
 #ifdef DEBUG
@@ -1366,6 +1373,18 @@
     return 1;
 }
 
+static int mgb100_get_mac_address(char *mac_address)
+{
+    const char *src = (const char *)0xffff8000;
+    if (src[14] == 'L' && src[15] == 'i')
+    {
+        memcpy(mac_address, src + 16, 6);
+        mac_address[5]++;
+        return 1;
+    }
+    return 0;
+}
+
 // ------------------------------------------------------------------------
 //
 //  Function : r6040_set_mac_address
