8139too: Fall back to PIO when MMIO fails.
authorDave Jones <davej@redhat.com>
Tue, 15 Jul 2008 23:54:52 +0000 (19:54 -0400)
committerJeff Garzik <jgarzik@redhat.com>
Tue, 22 Jul 2008 21:59:30 +0000 (17:59 -0400)
Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/8139too.c

index f62ac64..8a5b0d2 100644 (file)
@@ -788,6 +788,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 +837,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;