Merge remote-tracking branch 'remotes/aosp/android-3.0' into develop-3.0
[firefly-linux-kernel-4.4.55.git] / drivers / ata / pata_pdc202xx_old.c
index 29111205185a155727b7f4a3a8f996cb928df8b0..c2ed5868dda6086ded4335539eb7fddfd37135a9 100644 (file)
@@ -44,6 +44,27 @@ static void pdc202xx_exec_command(struct ata_port *ap,
        ndelay(400);
 }
 
+static bool pdc202xx_irq_check(struct ata_port *ap)
+{
+       struct pci_dev *pdev    = to_pci_dev(ap->host->dev);
+       unsigned long master    = pci_resource_start(pdev, 4);
+       u8 sc1d                 = inb(master + 0x1d);
+
+       if (ap->port_no) {
+               /*
+                * bit 7: error, bit 6: interrupting,
+                * bit 5: FIFO full, bit 4: FIFO empty
+                */
+               return sc1d & 0x40;
+       } else  {
+               /*
+                * bit 3: error, bit 2: interrupting,
+                * bit 1: FIFO full, bit 0: FIFO empty
+                */
+               return sc1d & 0x04;
+       }
+}
+
 /**
  *     pdc202xx_configure_piomode      -       set chip PIO timing
  *     @ap: ATA interface
@@ -249,7 +270,7 @@ static int pdc2026x_port_start(struct ata_port *ap)
                u8 burst = ioread8(bmdma + 0x1f);
                iowrite8(burst | 0x01, bmdma + 0x1f);
        }
-       return ata_sff_port_start(ap);
+       return ata_bmdma_port_start(ap);
 }
 
 /**
@@ -282,6 +303,7 @@ static struct ata_port_operations pdc2024x_port_ops = {
        .set_dmamode            = pdc202xx_set_dmamode,
 
        .sff_exec_command       = pdc202xx_exec_command,
+       .sff_irq_check          = pdc202xx_irq_check,
 };
 
 static struct ata_port_operations pdc2026x_port_ops = {
@@ -297,6 +319,7 @@ static struct ata_port_operations pdc2026x_port_ops = {
        .port_start             = pdc2026x_port_start,
 
        .sff_exec_command       = pdc202xx_exec_command,
+       .sff_irq_check          = pdc202xx_irq_check,
 };
 
 static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
@@ -337,7 +360,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id
                                return -ENODEV;
                }
        }
-       return ata_pci_sff_init_one(dev, ppi, &pdc202xx_sht, NULL);
+       return ata_pci_bmdma_init_one(dev, ppi, &pdc202xx_sht, NULL, 0);
 }
 
 static const struct pci_device_id pdc202xx[] = {