]> err.no Git - linux-2.6/blobdiff - drivers/ata/libata-sff.c
sata_mv HighPoint 2310 support (88SX7042)
[linux-2.6] / drivers / ata / libata-sff.c
index 95ff186f0ccd713d337ec5eadb9ee062f7255984..623cec914c9bfcc7d330ab50bf634d196d37142b 100644 (file)
@@ -700,6 +700,14 @@ void ata_bmdma_freeze(struct ata_port *ap)
                writeb(ap->ctl, (void __iomem *)ioaddr->ctl_addr);
        else
                outb(ap->ctl, ioaddr->ctl_addr);
+
+       /* Under certain circumstances, some controllers raise IRQ on
+        * ATA_NIEN manipulation.  Also, many controllers fail to mask
+        * previously pending IRQ on ATA_NIEN assertion.  Clear it.
+        */
+       ata_chk_status(ap);
+
+       ap->ops->irq_clear(ap);
 }
 
 /**
@@ -1019,13 +1027,15 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
 #endif
        }
 
-       rc = pci_request_regions(pdev, DRV_NAME);
-       if (rc) {
-               disable_dev_on_err = 0;
-               goto err_out;
-       }
-
-       if (legacy_mode) {
+       if (!legacy_mode) {
+               rc = pci_request_regions(pdev, DRV_NAME);
+               if (rc) {
+                       disable_dev_on_err = 0;
+                       goto err_out;
+               }
+       } else {
+               /* Deal with combined mode hack. This side of the logic all
+                  goes away once the combined mode hack is killed in 2.6.21 */
                if (!request_region(ATA_PRIMARY_CMD, 8, "libata")) {
                        struct resource *conflict, res;
                        res.start = ATA_PRIMARY_CMD;
@@ -1063,6 +1073,13 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
                        }
                } else
                        legacy_mode |= ATA_PORT_SECONDARY;
+
+               if (legacy_mode & ATA_PORT_PRIMARY)
+                       pci_request_region(pdev, 1, DRV_NAME);
+               if (legacy_mode & ATA_PORT_SECONDARY)
+                       pci_request_region(pdev, 3, DRV_NAME);
+               /* If there is a DMA resource, allocate it */
+               pci_request_region(pdev, 4, DRV_NAME);
        }
 
        /* we have legacy mode, but all ports are unavailable */
@@ -1106,11 +1123,20 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
 err_out_ent:
        kfree(probe_ent);
 err_out_regions:
-       if (legacy_mode & ATA_PORT_PRIMARY)
-               release_region(ATA_PRIMARY_CMD, 8);
-       if (legacy_mode & ATA_PORT_SECONDARY)
-               release_region(ATA_SECONDARY_CMD, 8);
-       pci_release_regions(pdev);
+       /* All this conditional stuff is needed for the combined mode hack
+          until 2.6.21 when it can go */
+       if (legacy_mode) {
+               pci_release_region(pdev, 4);
+               if (legacy_mode & ATA_PORT_PRIMARY) {
+                       release_region(ATA_PRIMARY_CMD, 8);
+                       pci_release_region(pdev, 1);
+               }
+               if (legacy_mode & ATA_PORT_SECONDARY) {
+                       release_region(ATA_SECONDARY_CMD, 8);
+                       pci_release_region(pdev, 3);
+               }
+       } else
+               pci_release_regions(pdev);
 err_out:
        if (disable_dev_on_err)
                pci_disable_device(pdev);