Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / net / tulip / tulip_core.c
index e0ae3ed..c67c912 100644 (file)
@@ -199,9 +199,6 @@ struct tulip_chip_table tulip_tbl[] = {
   { "Conexant LANfinity", 256, 0x0001ebef,
        HAS_MII | HAS_ACPI, tulip_timer },
 
-   /* ULi526X */
-   { "ULi M5261/M5263", 128, 0x0001ebef,
-        HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_ACPI, tulip_timer },
 };
 
 
@@ -239,9 +236,9 @@ static struct pci_device_id tulip_pci_tbl[] = {
        { 0x1737, 0xAB09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
        { 0x1737, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
        { 0x17B3, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
-       { 0x10b9, 0x5261, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ULI526X },      /* ALi 1563 integrated ethernet */
-       { 0x10b9, 0x5263, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ULI526X },      /* ALi 1563 integrated ethernet */
        { 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */
+       { 0x14ea, 0xab08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* Planex FNW-3602-TX */
+       { 0x1414, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
        { } /* terminate list */
 };
 MODULE_DEVICE_TABLE(pci, tulip_pci_tbl);
@@ -521,7 +518,7 @@ static void tulip_tx_timeout(struct net_device *dev)
                                   dev->name);
        } else if (tp->chip_id == DC21140 || tp->chip_id == DC21142
                           || tp->chip_id == MX98713 || tp->chip_id == COMPEX9881
-                          || tp->chip_id == DM910X || tp->chip_id == ULI526X) {
+                          || tp->chip_id == DM910X) {
                printk(KERN_WARNING "%s: 21140 transmit timed out, status %8.8x, "
                           "SIA %8.8x %8.8x %8.8x %8.8x, resetting...\n",
                           dev->name, ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR12),
@@ -624,7 +621,7 @@ static void tulip_init_ring(struct net_device *dev)
                tp->rx_buffers[i].skb = skb;
                if (skb == NULL)
                        break;
-               mapping = pci_map_single(tp->pdev, skb->tail,
+               mapping = pci_map_single(tp->pdev, skb->data,
                                         PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
                tp->rx_buffers[i].mapping = mapping;
                skb->dev = dev;                 /* Mark as being used by this device. */
@@ -1102,18 +1099,16 @@ static void set_rx_mode(struct net_device *dev)
                        entry = tp->cur_tx++ % TX_RING_SIZE;
 
                        if (entry != 0) {
-                               /* Avoid a chip errata by prefixing a dummy entry. Don't do
-                                  this on the ULI526X as it triggers a different problem */
-                               if (!(tp->chip_id == ULI526X && (tp->revision == 0x40 || tp->revision == 0x50))) {
-                                       tp->tx_buffers[entry].skb = NULL;
-                                       tp->tx_buffers[entry].mapping = 0;
-                                       tp->tx_ring[entry].length =
-                                               (entry == TX_RING_SIZE-1) ? cpu_to_le32(DESC_RING_WRAP) : 0;
-                                       tp->tx_ring[entry].buffer1 = 0;
-                                       /* Must set DescOwned later to avoid race with chip */
-                                       dummy = entry;
-                                       entry = tp->cur_tx++ % TX_RING_SIZE;
-                               }
+                               /* Avoid a chip errata by prefixing a dummy entry. */
+                               tp->tx_buffers[entry].skb = NULL;
+                               tp->tx_buffers[entry].mapping = 0;
+                               tp->tx_ring[entry].length =
+                                       (entry == TX_RING_SIZE-1) ? cpu_to_le32(DESC_RING_WRAP) : 0;
+                               tp->tx_ring[entry].buffer1 = 0;
+                               /* Must set DescOwned later to avoid race with chip */
+                               dummy = entry;
+                               entry = tp->cur_tx++ % TX_RING_SIZE;
+
                        }
 
                        tp->tx_buffers[entry].skb = NULL;
@@ -1234,10 +1229,6 @@ static int tulip_uli_dm_quirk(struct pci_dev *pdev)
 {
        if (pdev->vendor == 0x1282 && pdev->device == 0x9102)
                return 1;
-       if (pdev->vendor == 0x10b9 && pdev->device == 0x5261)
-               return 1;
-       if (pdev->vendor == 0x10b9 && pdev->device == 0x5263)
-               return 1;
        return 0;
 }
 
@@ -1514,8 +1505,8 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
                     (PCI_SLOT(pdev->devfn) == 12))) {
                        /* Cobalt MAC address in first EEPROM locations. */
                        sa_offset = 0;
-                       /* No media table either */
-                       tp->flags &= ~HAS_MEDIA_TABLE;
+                      /* Ensure our media table fixup get's applied */
+                      memcpy(ee_data + 16, ee_data, 8);
                }
 #endif
 #ifdef CONFIG_GSC
@@ -1573,7 +1564,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
                            dev->dev_addr, 6);
                }
 #endif
-#if defined(__i386__)          /* Patch up x86 BIOS bug. */
+#if defined(__i386__) || defined(__x86_64__)   /* Patch up x86 BIOS bug. */
                if (last_irq)
                        irq = last_irq;
 #endif
@@ -1679,7 +1670,6 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
        switch (chip_idx) {
        case DC21140:
        case DM910X:
-       case ULI526X:
        default:
                if (tp->mtable)
                        iowrite32(tp->mtable->csr12dir | 0x100, ioaddr + CSR12);
@@ -1737,8 +1727,7 @@ err_out_free_ring:
                             tp->rx_ring, tp->rx_ring_dma);
 
 err_out_mtable:
-       if (tp->mtable)
-               kfree (tp->mtable);
+       kfree (tp->mtable);
        pci_iounmap(pdev, ioaddr);
 
 err_out_free_res:
@@ -1756,11 +1745,19 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
 
-       if (dev && netif_running (dev) && netif_device_present (dev)) {
-               netif_device_detach (dev);
-               tulip_down (dev);
-               /* pci_power_off(pdev, -1); */
-       }
+       if (!dev)
+               return -EINVAL;
+
+       if (netif_running(dev))
+               tulip_down(dev);
+
+       netif_device_detach(dev);
+       free_irq(dev->irq, dev);
+
+       pci_save_state(pdev);
+       pci_disable_device(pdev);
+       pci_set_power_state(pdev, pci_choose_state(pdev, state));
+
        return 0;
 }
 
@@ -1768,15 +1765,26 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state)
 static int tulip_resume(struct pci_dev *pdev)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
+       int retval;
 
-       if (dev && netif_running (dev) && !netif_device_present (dev)) {
-#if 1
-               pci_enable_device (pdev);
-#endif
-               /* pci_power_on(pdev); */
-               tulip_up (dev);
-               netif_device_attach (dev);
+       if (!dev)
+               return -EINVAL;
+
+       pci_set_power_state(pdev, PCI_D0);
+       pci_restore_state(pdev);
+
+       pci_enable_device(pdev);
+
+       if ((retval = request_irq(dev->irq, &tulip_interrupt, SA_SHIRQ, dev->name, dev))) {
+               printk (KERN_ERR "tulip: request_irq failed in resume\n");
+               return retval;
        }
+
+       netif_device_attach(dev);
+
+       if (netif_running(dev))
+               tulip_up(dev);
+
        return 0;
 }
 
@@ -1797,8 +1805,7 @@ static void __devexit tulip_remove_one (struct pci_dev *pdev)
                             sizeof (struct tulip_rx_desc) * RX_RING_SIZE +
                             sizeof (struct tulip_tx_desc) * TX_RING_SIZE,
                             tp->rx_ring, tp->rx_ring_dma);
-       if (tp->mtable)
-               kfree (tp->mtable);
+       kfree (tp->mtable);
        pci_iounmap(pdev, tp->base_addr);
        free_netdev (dev);
        pci_release_regions (pdev);