]> git.sur5r.net Git - u-boot/blobdiff - drivers/net/dc2114x.c
e1000: fix PCI memory addressing
[u-boot] / drivers / net / dc2114x.c
index 723892261466d60c364b8362ea00121b0bd3c82a..5ae53e816b1b0d9629105e94fd599d60f26bf999 100644 (file)
  */
 
 #include <common.h>
-
-#if defined(CONFIG_CMD_NET) \
-       && defined(CONFIG_NET_MULTI) && defined(CONFIG_TULIP)
-
 #include <malloc.h>
 #include <net.h>
+#include <netdev.h>
 #include <pci.h>
 
 #undef DEBUG_SROM
@@ -212,14 +209,14 @@ static struct pci_device_id supported[] = {
 
 int dc21x4x_initialize(bd_t *bis)
 {
-       int                     idx=0;
-       int                     card_number = 0;
-       unsigned int            cfrv;
-       unsigned char           timer;
+       int                     idx=0;
+       int                     card_number = 0;
+       unsigned int            cfrv;
+       unsigned char           timer;
        pci_dev_t               devbusfn;
        unsigned int            iobase;
        unsigned short          status;
-       struct eth_device*      dev;
+       struct eth_device*      dev;
 
        while(1) {
                devbusfn =  pci_find_devices(supported, idx++);
@@ -490,7 +487,7 @@ static void send_setup_frame(struct eth_device* dev, bd_t *bis)
 {
        int             i;
        char    setup_frame[SETUP_FRAME_LEN];
-       char    *pa = &setup_frame[0];
+       char    *pa = &setup_frame[0];
 
        memset(pa, 0xff, SETUP_FRAME_LEN);
 
@@ -738,34 +735,34 @@ static void update_srom(struct eth_device *dev, bd_t *bis)
 {
        int i;
        static unsigned short eeprom[0x40] = {
-               0x140b, 0x6610, 0x0000, 0x0000,         /* 00 */
-               0x0000, 0x0000, 0x0000, 0x0000,         /* 04 */
-               0x00a3, 0x0103, 0x0000, 0x0000,         /* 08 */
-               0x0000, 0x1f00, 0x0000, 0x0000,         /* 0c */
-               0x0108, 0x038d, 0x0000, 0x0000,         /* 10 */
-               0xe078, 0x0001, 0x0040, 0x0018,         /* 14 */
-               0x0000, 0x0000, 0x0000, 0x0000,         /* 18 */
-               0x0000, 0x0000, 0x0000, 0x0000,         /* 1c */
-               0x0000, 0x0000, 0x0000, 0x0000,         /* 20 */
-               0x0000, 0x0000, 0x0000, 0x0000,         /* 24 */
-               0x0000, 0x0000, 0x0000, 0x0000,         /* 28 */
-               0x0000, 0x0000, 0x0000, 0x0000,         /* 2c */
-               0x0000, 0x0000, 0x0000, 0x0000,         /* 30 */
-               0x0000, 0x0000, 0x0000, 0x0000,         /* 34 */
-               0x0000, 0x0000, 0x0000, 0x0000,         /* 38 */
-               0x0000, 0x0000, 0x0000, 0x4e07,         /* 3c */
+               0x140b, 0x6610, 0x0000, 0x0000, /* 00 */
+               0x0000, 0x0000, 0x0000, 0x0000, /* 04 */
+               0x00a3, 0x0103, 0x0000, 0x0000, /* 08 */
+               0x0000, 0x1f00, 0x0000, 0x0000, /* 0c */
+               0x0108, 0x038d, 0x0000, 0x0000, /* 10 */
+               0xe078, 0x0001, 0x0040, 0x0018, /* 14 */
+               0x0000, 0x0000, 0x0000, 0x0000, /* 18 */
+               0x0000, 0x0000, 0x0000, 0x0000, /* 1c */
+               0x0000, 0x0000, 0x0000, 0x0000, /* 20 */
+               0x0000, 0x0000, 0x0000, 0x0000, /* 24 */
+               0x0000, 0x0000, 0x0000, 0x0000, /* 28 */
+               0x0000, 0x0000, 0x0000, 0x0000, /* 2c */
+               0x0000, 0x0000, 0x0000, 0x0000, /* 30 */
+               0x0000, 0x0000, 0x0000, 0x0000, /* 34 */
+               0x0000, 0x0000, 0x0000, 0x0000, /* 38 */
+               0x0000, 0x0000, 0x0000, 0x4e07, /* 3c */
        };
+       uchar enetaddr[6];
 
        /* Ethernet Addr... */
-       eeprom[0x0a] = ((bis->bi_enetaddr[1] & 0xff) << 8) | (bis->bi_enetaddr[0] & 0xff);
-       eeprom[0x0b] = ((bis->bi_enetaddr[3] & 0xff) << 8) | (bis->bi_enetaddr[2] & 0xff);
-       eeprom[0x0c] = ((bis->bi_enetaddr[5] & 0xff) << 8) | (bis->bi_enetaddr[4] & 0xff);
+       if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+               return;
+       eeprom[0x0a] = (enetaddr[1] << 8) | enetaddr[0];
+       eeprom[0x0b] = (enetaddr[3] << 8) | enetaddr[2];
+       eeprom[0x0c] = (enetaddr[5] << 8) | enetaddr[4];
 
-       for (i=0; i<0x40; i++)
-       {
+       for (i=0; i<0x40; i++) {
                write_srom(dev, DE4X5_APROM, i, eeprom[i]);
        }
 }
 #endif /* UPDATE_SROM */
-
-#endif