]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ata/ata_generic.c
ahci: request all PCI BARs
[linux-2.6-omap-h63xx.git] / drivers / ata / ata_generic.c
index 9454669547244e5960e05c5bd9741d6a3efc90fb..20534202fc79b28c5e93f944fe3224a460016318 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME "ata_generic"
-#define DRV_VERSION "0.2.13"
+#define DRV_VERSION "0.2.15"
 
 /*
  *     A generic parallel ATA driver using libata
@@ -34,7 +34,7 @@
 
 /**
  *     generic_set_mode        -       mode setting
- *     @ap: interface to set up
+ *     @link: link to set up
  *     @unused: returned device on error
  *
  *     Use a non standard set_mode function. We don't want to be tuned.
  *     and respect them.
  */
 
-static int generic_set_mode(struct ata_port *ap, struct ata_device **unused)
+static int generic_set_mode(struct ata_link *link, struct ata_device **unused)
 {
+       struct ata_port *ap = link->ap;
        int dma_enabled = 0;
-       int i;
+       struct ata_device *dev;
+       struct pci_dev *pdev = to_pci_dev(ap->host->dev);
 
        /* Bits 5 and 6 indicate if DMA is active on master/slave */
        if (ap->ioaddr.bmdma_addr)
                dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
 
-       for (i = 0; i < ATA_MAX_DEVICES; i++) {
-               struct ata_device *dev = &ap->device[i];
-               if (ata_dev_enabled(dev)) {
-                       /* We don't really care */
-                       dev->pio_mode = XFER_PIO_0;
-                       dev->dma_mode = XFER_MW_DMA_0;
-                       /* We do need the right mode information for DMA or PIO
-                          and this comes from the current configuration flags */
-                       if (dma_enabled & (1 << (5 + i))) {
-                               ata_id_to_dma_mode(dev, XFER_MW_DMA_0);
-                               dev->flags &= ~ATA_DFLAG_PIO;
-                       } else {
-                               ata_dev_printk(dev, KERN_INFO, "configured for PIO\n");
-                               dev->xfer_mode = XFER_PIO_0;
-                               dev->xfer_shift = ATA_SHIFT_PIO;
-                               dev->flags |= ATA_DFLAG_PIO;
+       if (pdev->vendor == PCI_VENDOR_ID_CENATEK)
+               dma_enabled = 0xFF;
+
+       ata_link_for_each_dev(dev, link) {
+               if (!ata_dev_enabled(dev))
+                       continue;
+
+               /* We don't really care */
+               dev->pio_mode = XFER_PIO_0;
+               dev->dma_mode = XFER_MW_DMA_0;
+               /* We do need the right mode information for DMA or PIO
+                  and this comes from the current configuration flags */
+               if (dma_enabled & (1 << (5 + dev->devno))) {
+                       unsigned int xfer_mask = ata_id_xfermask(dev->id);
+                       const char *name;
+
+                       if (xfer_mask & (ATA_MASK_MWDMA | ATA_MASK_UDMA))
+                               name = ata_mode_string(xfer_mask);
+                       else {
+                               /* SWDMA perhaps? */
+                               name = "DMA";
+                               xfer_mask |= ata_xfer_mode2mask(XFER_MW_DMA_0);
                        }
+
+                       ata_dev_printk(dev, KERN_INFO, "configured for %s\n",
+                                      name);
+
+                       dev->xfer_mode = ata_xfer_mask2mode(xfer_mask);
+                       dev->xfer_shift = ata_xfer_mode2shift(dev->xfer_mode);
+                       dev->flags &= ~ATA_DFLAG_PIO;
+               } else {
+                       ata_dev_printk(dev, KERN_INFO, "configured for PIO\n");
+                       dev->xfer_mode = XFER_PIO_0;
+                       dev->xfer_shift = ATA_SHIFT_PIO;
+                       dev->flags |= ATA_DFLAG_PIO;
                }
        }
        return 0;
@@ -95,7 +115,6 @@ static struct scsi_host_template generic_sht = {
 static struct ata_port_operations generic_port_ops = {
        .set_mode       = generic_set_mode,
 
-       .port_disable   = ata_port_disable,
        .tf_load        = ata_tf_load,
        .tf_read        = ata_tf_read,
        .check_status   = ata_check_status,
@@ -121,9 +140,8 @@ static struct ata_port_operations generic_port_ops = {
        .irq_handler    = ata_interrupt,
        .irq_clear      = ata_bmdma_irq_clear,
        .irq_on         = ata_irq_on,
-       .irq_ack        = ata_irq_ack,
 
-       .port_start     = ata_port_start,
+       .port_start     = ata_sff_port_start,
 };
 
 static int all_generic_ide;            /* Set to claim all devices */
@@ -187,6 +205,7 @@ static struct pci_device_id ata_generic[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_HINT,   PCI_DEVICE_ID_HINT_VXPROII_IDE), },
        { PCI_DEVICE(PCI_VENDOR_ID_VIA,    PCI_DEVICE_ID_VIA_82C561), },
        { PCI_DEVICE(PCI_VENDOR_ID_OPTI,   PCI_DEVICE_ID_OPTI_82C558), },
+       { PCI_DEVICE(PCI_VENDOR_ID_CENATEK,PCI_DEVICE_ID_CENATEK_IDE), },
        { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO), },
        { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), },
        { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2),  },