]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/tulip/uli526x.c
Merge branch 'pending' of master.kernel.org:/pub/scm/linux/kernel/git/vxy/lksctp-dev
[linux-2.6-omap-h63xx.git] / drivers / net / tulip / uli526x.c
index 2b7257d97c32bc201f937635ae50c12fdd967047..a59c1f224aa8ef230f8e42f9aa8200373417b70f 100644 (file)
@@ -34,9 +34,9 @@
 #include <linux/delay.h>
 #include <linux/spinlock.h>
 #include <linux/dma-mapping.h>
+#include <linux/bitops.h>
 
 #include <asm/processor.h>
-#include <asm/bitops.h>
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <asm/uaccess.h>
 
 /* Structure/enum declaration ------------------------------- */
 struct tx_desc {
-        u32 tdes0, tdes1, tdes2, tdes3; /* Data for the card */
+        __le32 tdes0, tdes1, tdes2, tdes3; /* Data for the card */
         char *tx_buf_ptr;               /* Data for us */
         struct tx_desc *next_tx_desc;
 } __attribute__(( aligned(32) ));
 
 struct rx_desc {
-       u32 rdes0, rdes1, rdes2, rdes3; /* Data for the card */
+       __le32 rdes0, rdes1, rdes2, rdes3; /* Data for the card */
        struct sk_buff *rx_skb_ptr;     /* Data for us */
        struct rx_desc *next_rx_desc;
 } __attribute__(( aligned(32) ));
@@ -258,6 +258,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
        struct uli526x_board_info *db;  /* board information structure */
        struct net_device *dev;
        int i, err;
+       DECLARE_MAC_BUF(mac);
 
        ULI526X_DBUG(0, "uli526x_init_one()", 0);
 
@@ -343,7 +344,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
 
        /* read 64 word srom data */
        for (i = 0; i < 64; i++)
-               ((u16 *) db->srom)[i] = cpu_to_le16(read_srom_word(db->ioaddr, i));
+               ((__le16 *) db->srom)[i] = cpu_to_le16(read_srom_word(db->ioaddr, i));
 
        /* Set Node address */
        if(((u16 *) db->srom)[0] == 0xffff || ((u16 *) db->srom)[0] == 0)               /* SROM absent, so read MAC address from ID Table */
@@ -372,11 +373,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
        if (err)
                goto err_out_res;
 
-       printk(KERN_INFO "%s: ULi M%04lx at pci%s,",dev->name,ent->driver_data >> 16,pci_name(pdev));
-
-       for (i = 0; i < 6; i++)
-               printk("%c%02x", i ? ':' : ' ', dev->dev_addr[i]);
-       printk(", irq %d.\n", dev->irq);
+       printk(KERN_INFO "%s: ULi M%04lx at pci%s, %s, irq %d.\n",
+              dev->name,ent->driver_data >> 16,pci_name(pdev),
+              print_mac(mac, dev->dev_addr), dev->irq);
 
        pci_set_master(pdev);
 
@@ -483,9 +482,11 @@ static void uli526x_init(struct net_device *dev)
        struct uli526x_board_info *db = netdev_priv(dev);
        unsigned long ioaddr = db->ioaddr;
        u8      phy_tmp;
+       u8      timeout;
        u16     phy_value;
        u16 phy_reg_reset;
 
+
        ULI526X_DBUG(0, "uli526x_init()", 0);
 
        /* Reset M526x MAC controller */
@@ -510,11 +511,19 @@ static void uli526x_init(struct net_device *dev)
        /* Parser SROM and media mode */
        db->media_mode = uli526x_media_mode;
 
-       /* Phyxcer capability setting */
+       /* phyxcer capability setting */
        phy_reg_reset = phy_read(db->ioaddr, db->phy_addr, 0, db->chip_id);
        phy_reg_reset = (phy_reg_reset | 0x8000);
        phy_write(db->ioaddr, db->phy_addr, 0, phy_reg_reset, db->chip_id);
+
+       /* See IEEE 802.3-2002.pdf (Section 2, Chapter "22.2.4 Management
+        * functions") or phy data sheet for details on phy reset
+        */
        udelay(500);
+       timeout = 10;
+       while (timeout-- &&
+               phy_read(db->ioaddr, db->phy_addr, 0, db->chip_id) & 0x8000)
+                       udelay(100);
 
        /* Process Phyxcer Media Mode */
        uli526x_set_phyxcer(db);
@@ -665,11 +674,6 @@ static irqreturn_t uli526x_interrupt(int irq, void *dev_id)
        unsigned long ioaddr = dev->base_addr;
        unsigned long flags;
 
-       if (!dev) {
-               ULI526X_DBUG(1, "uli526x_interrupt() without DEVICE arg", 0);
-               return IRQ_NONE;
-       }
-
        spin_lock_irqsave(&db->lock, flags);
        outl(0, ioaddr + DCR7);
 
@@ -1605,7 +1609,6 @@ static void uli526x_process_mode(struct uli526x_board_info *db)
                        case ULI526X_100MFD: phy_reg = 0x2100; break;
                        }
                        phy_write(db->ioaddr, db->phy_addr, 0, phy_reg, db->chip_id);
-                               phy_write(db->ioaddr, db->phy_addr, 0, phy_reg, db->chip_id);
                }
        }
 }