]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/pci/opti621.c
ide: add IDE_HFLAG_NO_ATAPI_DMA host flag
[linux-2.6-omap-h63xx.git] / drivers / ide / pci / opti621.c
index aede7eee9246fc087daa5c3c1541563a031a4e0f..2437aed73f35be1fcd2ba9a354a80582a4e8090c 100644 (file)
@@ -47,7 +47,7 @@
  * The main problem with OPTi is that some timings for master
  * and slave must be the same. For example, if you have master
  * PIO 3 and slave PIO 0, driver have to set some timings of
- * master for PIO 0. Second problem is that opti621_tune_drive
+ * master for PIO 0. Second problem is that opti621_set_pio_mode
  * got only one drive to set, but have to set both drives.
  * This is solved in compute_pios. If you don't set
  * the second drive, compute_pios use ide_get_best_pio_mode
 
 #include <asm/io.h>
 
-#define OPTI621_MAX_PIO 3
+//#define OPTI621_MAX_PIO 3
 /* In fact, I do not have any PIO 4 drive
  * (address: 25 ns, data: 70 ns, recovery: 35 ns),
  * but OPTi 82C621 is programmable and it can do (minimal values):
@@ -136,8 +136,8 @@ static int reg_base;
 #define PIO_NOT_EXIST 254
 #define PIO_DONT_KNOW 255
 
-/* there are stored pio numbers from other calls of opti621_tune_drive */
-static void compute_pios(ide_drive_t *drive, u8 pio)
+/* there are stored pio numbers from other calls of opti621_set_pio_mode */
+static void compute_pios(ide_drive_t *drive, const u8 pio)
 /* Store values into drive->drive_data
  *     second_contr - 0 for primary controller, 1 for secondary
  *     slave_drive - 0 -> pio is for master, 1 -> pio is for slave
@@ -147,12 +147,13 @@ static void compute_pios(ide_drive_t *drive, u8 pio)
        int d;
        ide_hwif_t *hwif = HWIF(drive);
 
-       drive->drive_data = ide_get_best_pio_mode(drive, pio, OPTI621_MAX_PIO, NULL);
+       drive->drive_data = pio;
+
        for (d = 0; d < 2; ++d) {
                drive = &hwif->drives[d];
                if (drive->present) {
                        if (drive->drive_data == PIO_DONT_KNOW)
-                               drive->drive_data = ide_get_best_pio_mode(drive, 255, OPTI621_MAX_PIO, NULL);
+                               drive->drive_data = ide_get_best_pio_mode(drive, 255, 3);
 #ifdef OPTI621_DEBUG
                        printk("%s: Selected PIO mode %d\n",
                                drive->name, drive->drive_data);
@@ -240,8 +241,7 @@ static void compute_clocks(int pio, pio_clocks_t *clks)
  
 }
 
-/* Main tune procedure, called from tuneproc. */
-static void opti621_tune_drive (ide_drive_t *drive, u8 pio)
+static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
        /* primary and secondary drives share some registers,
         * so we have to program both drives
@@ -328,39 +328,35 @@ static void opti621_tune_drive (ide_drive_t *drive, u8 pio)
  */
 static void __devinit init_hwif_opti621 (ide_hwif_t *hwif)
 {
-       hwif->autodma = 0;
        hwif->drives[0].drive_data = PIO_DONT_KNOW;
        hwif->drives[1].drive_data = PIO_DONT_KNOW;
-       hwif->tuneproc = &opti621_tune_drive;
+
+       hwif->set_pio_mode = &opti621_set_pio_mode;
 
        if (!(hwif->dma_base))
                return;
 
-       hwif->atapi_dma = 1;
        hwif->mwdma_mask = 0x07;
        hwif->swdma_mask = 0x07;
-
-       if (!noautodma)
-               hwif->autodma = 1;
-       hwif->drives[0].autodma = hwif->autodma;
-       hwif->drives[1].autodma = hwif->autodma;
 }
 
 static ide_pci_device_t opti621_chipsets[] __devinitdata = {
        {       /* 0 */
                .name           = "OPTI621",
                .init_hwif      = init_hwif_opti621,
-               .channels       = 2,
                .autodma        = AUTODMA,
                .enablebits     = {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
                .bootable       = ON_BOARD,
+               .pio_mask       = ATA_PIO3,
+               .host_flags     = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
        },{     /* 1 */
                .name           = "OPTI621X",
                .init_hwif      = init_hwif_opti621,
-               .channels       = 2,
                .autodma        = AUTODMA,
                .enablebits     = {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
                .bootable       = ON_BOARD,
+               .pio_mask       = ATA_PIO3,
+               .host_flags     = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
        }
 };
 
@@ -369,9 +365,9 @@ static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_devi
        return ide_setup_pci_device(dev, &opti621_chipsets[id->driver_data]);
 }
 
-static struct pci_device_id opti621_pci_tbl[] = {
-       { PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-       { PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
+static const struct pci_device_id opti621_pci_tbl[] = {
+       { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C621), 0 },
+       { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C825), 1 },
        { 0, },
 };
 MODULE_DEVICE_TABLE(pci, opti621_pci_tbl);