iwl3945: remove bogus comment
[safe/jmp/linux-2.6] / drivers / net / 8139too.c
index f62ac64..37456ad 100644 (file)
@@ -309,7 +309,7 @@ enum RTL8139_registers {
        Cfg9346         = 0x50,
        Config0         = 0x51,
        Config1         = 0x52,
-       FlashReg        = 0x54,
+       TimerInt        = 0x54,
        MediaStatus     = 0x58,
        Config3         = 0x59,
        Config4         = 0x5A,  /* absent on RTL-8139A */
@@ -325,6 +325,7 @@ enum RTL8139_registers {
        FIFOTMS         = 0x70,  /* FIFO Control and test. */
        CSCR            = 0x74,  /* Chip Status and Configuration Register. */
        PARA78          = 0x78,
+       FlashReg        = 0xD4, /* Communication with Flash ROM, four bytes. */
        PARA7c          = 0x7c,  /* Magic transceiver parameter register. */
        Config5         = 0xD8,  /* absent on RTL-8139A */
 };
@@ -788,6 +789,7 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
        DPRINTK("PIO region size == 0x%02X\n", pio_len);
        DPRINTK("MMIO region size == 0x%02lX\n", mmio_len);
 
+retry:
        if (use_io) {
                /* make sure PCI base addr 0 is PIO */
                if (!(pio_flags & IORESOURCE_IO)) {
@@ -836,9 +838,10 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
                /* ioremap MMIO region */
                ioaddr = pci_iomap(pdev, 1, 0);
                if (ioaddr == NULL) {
-                       dev_err(&pdev->dev, "cannot remap MMIO, aborting\n");
-                       rc = -EIO;
-                       goto err_out;
+                       dev_err(&pdev->dev, "cannot remap MMIO, trying PIO\n");
+                       pci_release_regions(pdev);
+                       use_io = 1;
+                       goto retry;
                }
                dev->base_addr = (long) ioaddr;
                tp->regs_len = mmio_len;
@@ -922,7 +925,6 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
        int i, addr_len, option;
        void __iomem *ioaddr;
        static int board_idx = -1;
-       DECLARE_MAC_BUF(mac);
 
        assert (pdev != NULL);
        assert (ent != NULL);
@@ -943,10 +945,9 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
        if (pdev->vendor == PCI_VENDOR_ID_REALTEK &&
            pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pdev->revision >= 0x20) {
                dev_info(&pdev->dev,
-                          "This (id %04x:%04x rev %02x) is an enhanced 8139C+ chip\n",
+                          "This (id %04x:%04x rev %02x) is an enhanced 8139C+ chip, use 8139cp\n",
                           pdev->vendor, pdev->device, pdev->revision);
-               dev_info(&pdev->dev,
-                          "Use the \"8139cp\" driver for improved performance and stability.\n");
+               return -ENODEV;
        }
 
        if (pdev->vendor == PCI_VENDOR_ID_REALTEK &&
@@ -1022,11 +1023,11 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
        pci_set_drvdata (pdev, dev);
 
        printk (KERN_INFO "%s: %s at 0x%lx, "
-               "%s, IRQ %d\n",
+               "%pM, IRQ %d\n",
                dev->name,
                board_info[ent->driver_data].name,
                dev->base_addr,
-               print_mac(mac, dev->dev_addr),
+               dev->dev_addr,
                dev->irq);
 
        printk (KERN_DEBUG "%s:  Identified 8139 chip type '%s'\n",
@@ -1720,13 +1721,18 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
        }
 
        spin_lock_irqsave(&tp->lock, flags);
+       /*
+        * Writing to TxStatus triggers a DMA transfer of the data
+        * copied to tp->tx_buf[entry] above. Use a memory barrier
+        * to make sure that the device sees the updated data.
+        */
+       wmb();
        RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),
                   tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));
 
        dev->trans_start = jiffies;
 
        tp->cur_tx++;
-       wmb();
 
        if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)
                netif_stop_queue (dev);
@@ -2007,9 +2013,9 @@ no_early_rx:
                /* Malloc up new buffer, compatible with net-2e. */
                /* Omit the four octet CRC from the length. */
 
-               skb = dev_alloc_skb (pkt_size + 2);
+               skb = netdev_alloc_skb(dev, pkt_size + NET_IP_ALIGN);
                if (likely(skb)) {
-                       skb_reserve (skb, 2);   /* 16 byte align the IP fields. */
+                       skb_reserve (skb, NET_IP_ALIGN);        /* 16 byte align the IP fields. */
 #if RX_BUF_IDX == 3
                        wrap_copy(skb, rx_ring, ring_offset+4, pkt_size);
 #else
@@ -2019,7 +2025,6 @@ no_early_rx:
 
                        skb->protocol = eth_type_trans (skb, dev);
 
-                       dev->last_rx = jiffies;
                        dev->stats.rx_bytes += pkt_size;
                        dev->stats.rx_packets++;