Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[cascardo/linux.git] / drivers / ide / pci / aec62xx.c
index be0d077..7f4d185 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/pci/aec62xx.c             Version 0.26    Sep 1, 2007
+ * linux/drivers/ide/pci/aec62xx.c             Version 0.27    Sep 16, 2007
  *
  * Copyright (C) 1999-2002     Andre Hedrick <andre@linux-ide.org>
  * Copyright (C) 2007          MontaVista Software, Inc. <source@mvista.com>
@@ -141,19 +141,6 @@ static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio)
        drive->hwif->set_dma_mode(drive, pio + XFER_PIO_0);
 }
 
-static void aec62xx_dma_lost_irq (ide_drive_t *drive)
-{
-       switch (HWIF(drive)->pci_dev->device) {
-               case PCI_DEVICE_ID_ARTOP_ATP860:
-               case PCI_DEVICE_ID_ARTOP_ATP860R:
-               case PCI_DEVICE_ID_ARTOP_ATP865:
-               case PCI_DEVICE_ID_ARTOP_ATP865R:
-                       printk(" AEC62XX time out ");
-               default:
-                       break;
-       }
-}
-
 static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name)
 {
        int bus_speed = system_bus_clock();
@@ -187,20 +174,14 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
 
        hwif->set_pio_mode = &aec_set_pio_mode;
 
-       if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) {
-               if(hwif->mate)
-                       hwif->mate->serialized = hwif->serialized = 1;
+       if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF)
                hwif->set_dma_mode = &aec6210_set_mode;
-       else
+       else
                hwif->set_dma_mode = &aec6260_set_mode;
 
-       hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
-
        if (hwif->dma_base == 0)
                return;
 
-       hwif->dma_lost_irq      = &aec62xx_dma_lost_irq;
-
        if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF)
                return;
 
@@ -213,13 +194,16 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
        }
 }
 
-static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
+static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
        {       /* 0 */
                .name           = "AEC6210",
                .init_chipset   = init_chipset_aec62xx,
                .init_hwif      = init_hwif_aec62xx,
                .enablebits     = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
-               .host_flags     = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD,
+               .host_flags     = IDE_HFLAG_SERIALIZE |
+                                 IDE_HFLAG_NO_ATAPI_DMA |
+                                 IDE_HFLAG_ABUSE_SET_DMA_MODE |
+                                 IDE_HFLAG_OFF_BOARD,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = ATA_UDMA2,
@@ -228,6 +212,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
                .init_chipset   = init_chipset_aec62xx,
                .init_hwif      = init_hwif_aec62xx,
                .host_flags     = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_AUTODMA |
+                                 IDE_HFLAG_ABUSE_SET_DMA_MODE |
                                  IDE_HFLAG_OFF_BOARD,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
@@ -237,7 +222,8 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
                .init_chipset   = init_chipset_aec62xx,
                .init_hwif      = init_hwif_aec62xx,
                .enablebits     = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
-               .host_flags     = IDE_HFLAG_NO_ATAPI_DMA,
+               .host_flags     = IDE_HFLAG_NO_ATAPI_DMA |
+                                 IDE_HFLAG_ABUSE_SET_DMA_MODE,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = ATA_UDMA4,
@@ -245,7 +231,9 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
                .name           = "AEC6280",
                .init_chipset   = init_chipset_aec62xx,
                .init_hwif      = init_hwif_aec62xx,
-               .host_flags     = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD,
+               .host_flags     = IDE_HFLAG_NO_ATAPI_DMA |
+                                 IDE_HFLAG_ABUSE_SET_DMA_MODE |
+                                 IDE_HFLAG_OFF_BOARD,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = ATA_UDMA5,
@@ -254,7 +242,9 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
                .init_chipset   = init_chipset_aec62xx,
                .init_hwif      = init_hwif_aec62xx,
                .enablebits     = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
-               .host_flags     = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD,
+               .host_flags     = IDE_HFLAG_NO_ATAPI_DMA |
+                                 IDE_HFLAG_ABUSE_SET_DMA_MODE |
+                                 IDE_HFLAG_OFF_BOARD,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = ATA_UDMA5,
@@ -270,13 +260,18 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
  *     finds a device matching our IDE device tables.
  *
  *     NOTE: since we're going to modify the 'name' field for AEC-6[26]80[R]
- *     chips, pass a local copy of 'struct pci_device_id' down the call chain.
+ *     chips, pass a local copy of 'struct ide_port_info' down the call chain.
  */
+
 static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-       ide_pci_device_t d;
+       struct ide_port_info d;
        u8 idx = id->driver_data;
+       int err;
+
+       err = pci_enable_device(dev);
+       if (err)
+               return err;
 
        d = aec62xx_chipsets[idx];
 
@@ -289,7 +284,11 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi
                }
        }
 
-       return ide_setup_pci_device(dev, &d);
+       err = ide_setup_pci_device(dev, &d);
+       if (err)
+               pci_disable_device(dev);
+
+       return err;
 }
 
 static const struct pci_device_id aec62xx_pci_tbl[] = {