]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/dm9000x.c
Fix: TFTP is not working on little endian systems
[karo-tx-uboot.git] / drivers / dm9000x.c
index 687707627e5d781c88a92acfda0d3c2e06b48ce9..e0d531bd917c9a772577a07d719a7a848adf3322 100644 (file)
@@ -302,6 +302,21 @@ eth_init(bd_t * bd)
        /* Set Node address */
        for (i = 0; i < 6; i++)
                ((u16 *) bd->bi_enetaddr)[i] = read_srom_word(i);
+
+       if (is_zero_ether_addr(bd->bi_enetaddr) ||
+           is_multicast_ether_addr(bd->bi_enetaddr)) {
+               /* try reading from environment */
+               u8 i;
+               char *s, *e;
+               s = getenv ("ethaddr");
+               for (i = 0; i < 6; ++i) {
+                       bd->bi_enetaddr[i] = s ?
+                               simple_strtoul (s, &e, 16) : 0;
+                       if (s)
+                               s = (*e) ? e + 1 : e;
+               }
+       }
+
        printf("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", bd->bi_enetaddr[0],
               bd->bi_enetaddr[1], bd->bi_enetaddr[2], bd->bi_enetaddr[3],
               bd->bi_enetaddr[4], bd->bi_enetaddr[5]);
@@ -527,7 +542,7 @@ read_srom_word(int offset)
 {
        DM9000_iow(DM9000_EPAR, offset);
        DM9000_iow(DM9000_EPCR, 0x4);
-       udelay(200);
+       udelay(8000);
        DM9000_iow(DM9000_EPCR, 0x0);
        return (DM9000_ior(DM9000_EPDRL) + (DM9000_ior(DM9000_EPDRH) << 8));
 }