x86: tsc prevent time going backwards
[sfrench/cifs-2.6.git] / drivers / ata / pata_pdc202xx_old.c
index 65d951618c605d1c9e908a508c528014ac4b2b6c..3ed866723e0c3c3187ca8071e28857a3672b4412 100644 (file)
@@ -168,8 +168,7 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
        pdc202xx_set_dmamode(ap, qc->dev);
 
        /* Cases the state machine will not complete correctly without help */
-       if ((tf->flags & ATA_TFLAG_LBA48) ||  tf->protocol == ATA_PROT_ATAPI_DMA)
-       {
+       if ((tf->flags & ATA_TFLAG_LBA48) ||  tf->protocol == ATAPI_PROT_DMA) {
                len = qc->nbytes / 2;
 
                if (tf->flags & ATA_TFLAG_WRITE)
@@ -208,15 +207,15 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
        void __iomem *atapi_reg = master + 0x20 + (4 * ap->port_no);
 
        /* Cases the state machine will not complete correctly */
-       if (tf->protocol == ATA_PROT_ATAPI_DMA || ( tf->flags & ATA_TFLAG_LBA48)) {
+       if (tf->protocol == ATAPI_PROT_DMA || (tf->flags & ATA_TFLAG_LBA48)) {
                iowrite32(0, atapi_reg);
                iowrite8(ioread8(clock) & ~sel66, clock);
        }
        /* Flip back to 33Mhz for PIO */
        if (adev->dma_mode >= XFER_UDMA_2)
                iowrite8(ioread8(clock) & ~sel66, clock);
-
        ata_bmdma_stop(qc);
+       pdc202xx_set_piomode(ap, adev);
 }
 
 /**
@@ -233,6 +232,35 @@ static void pdc2026x_dev_config(struct ata_device *adev)
        adev->max_sectors = 256;
 }
 
+static int pdc2026x_port_start(struct ata_port *ap)
+{
+       void __iomem *bmdma = ap->ioaddr.bmdma_addr;
+       if (bmdma) {
+               /* Enable burst mode */
+               u8 burst = ioread8(bmdma + 0x1f);
+               iowrite8(burst | 0x01, bmdma + 0x1f);
+       }
+       return ata_sff_port_start(ap);
+}
+
+/**
+ *     pdc2026x_check_atapi_dma - Check whether ATAPI DMA can be supported for this command
+ *     @qc: Metadata associated with taskfile to check
+ *
+ *     Just say no - not supported on older Promise.
+ *
+ *     LOCKING:
+ *     None (inherited from caller).
+ *
+ *     RETURNS: 0 when ATAPI DMA can be used
+ *              1 otherwise
+ */
+
+static int pdc2026x_check_atapi_dma(struct ata_queued_cmd *qc)
+{
+       return 1;
+}
+
 static struct scsi_host_template pdc202xx_sht = {
        .module                 = THIS_MODULE,
        .name                   = DRV_NAME,
@@ -300,6 +328,7 @@ static struct ata_port_operations pdc2026x_port_ops = {
        .post_internal_cmd = ata_bmdma_post_internal_cmd,
        .cable_detect   = pdc2026x_cable_detect,
 
+       .check_atapi_dma= pdc2026x_check_atapi_dma,
        .bmdma_setup    = ata_bmdma_setup,
        .bmdma_start    = pdc2026x_bmdma_start,
        .bmdma_stop     = pdc2026x_bmdma_stop,
@@ -313,7 +342,7 @@ static struct ata_port_operations pdc2026x_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
        .irq_on         = ata_irq_on,
 
-       .port_start     = ata_sff_port_start,
+       .port_start     = pdc2026x_port_start,
 };
 
 static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
@@ -351,9 +380,9 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id
                struct pci_dev *bridge = dev->bus->self;
                /* Don't grab anything behind a Promise I2O RAID */
                if (bridge && bridge->vendor == PCI_VENDOR_ID_INTEL) {
-                       ifbridge->device == PCI_DEVICE_ID_INTEL_I960)
+                       if (bridge->device == PCI_DEVICE_ID_INTEL_I960)
                                return -ENODEV;
-                       ifbridge->device == PCI_DEVICE_ID_INTEL_I960RM)
+                       if (bridge->device == PCI_DEVICE_ID_INTEL_I960RM)
                                return -ENODEV;
                }
        }