ide: keep pointer to struct device instead of struct pci_dev in ide_hwif_t
[deliverable/linux.git] / drivers / ide / pci / triflex.c
index 098692a6d615ff157c97cc55030b10ea883bf06d..ca49cd7f9555652748a8f2d1f315f4ed4829b938 100644 (file)
 #include <linux/ide.h>
 #include <linux/init.h>
 
-static int triflex_tune_chipset(ide_drive_t *drive, u8 xferspeed)
+static void triflex_set_mode(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif = HWIF(drive);
-       struct pci_dev *dev = hwif->pci_dev;
+       struct pci_dev *dev = to_pci_dev(hwif->dev);
        u8 channel_offset = hwif->channel ? 0x74 : 0x70;
        u16 timing = 0;
        u32 triflex_timings = 0;
        u8 unit = (drive->select.b.unit & 0x01);
-       u8 speed = ide_rate_filter(drive, xferspeed);
        
        pci_read_config_dword(dev, channel_offset, &triflex_timings);
        
@@ -82,60 +81,33 @@ static int triflex_tune_chipset(ide_drive_t *drive, u8 xferspeed)
                case XFER_PIO_0:
                        timing = 0x0808;
                        break;
-               default:
-                       return -1;
        }
 
        triflex_timings &= ~(0xFFFF << (16 * unit));
        triflex_timings |= (timing << (16 * unit));
        
        pci_write_config_dword(dev, channel_offset, triflex_timings);
-       
-       return (ide_config_drive_speed(drive, speed));
 }
 
-static void triflex_tune_drive(ide_drive_t *drive, u8 pio)
+static void triflex_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
-       int use_pio = ide_get_best_pio_mode(drive, pio, 4);
-       (void) triflex_tune_chipset(drive, (XFER_PIO_0 + use_pio));
-}
-
-static int triflex_config_drive_xfer_rate(ide_drive_t *drive)
-{
-       if (ide_tune_dma(drive))
-               return 0;
-
-       triflex_tune_drive(drive, 255);
-
-       return -1;
+       triflex_set_mode(drive, XFER_PIO_0 + pio);
 }
 
 static void __devinit init_hwif_triflex(ide_hwif_t *hwif)
 {
-       hwif->tuneproc = &triflex_tune_drive;
-       hwif->speedproc = &triflex_tune_chipset;
-
-       if (hwif->dma_base == 0)
-               return;
-
-       hwif->atapi_dma  = 1;
-       hwif->mwdma_mask = 0x07;
-       hwif->swdma_mask = 0x07;
-       hwif->ide_dma_check = &triflex_config_drive_xfer_rate;
-       
-       if (!noautodma)
-               hwif->autodma = 1;
-       hwif->drives[0].autodma = hwif->autodma;
-       hwif->drives[1].autodma = hwif->autodma;
+       hwif->set_pio_mode = &triflex_set_pio_mode;
+       hwif->set_dma_mode = &triflex_set_mode;
 }
 
-static ide_pci_device_t triflex_device __devinitdata = {
+static const struct ide_port_info triflex_device __devinitdata = {
        .name           = "TRIFLEX",
        .init_hwif      = init_hwif_triflex,
-       .autodma        = AUTODMA,
        .enablebits     = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}},
-       .bootable       = ON_BOARD,
+       .host_flags     = IDE_HFLAG_BOOTABLE,
        .pio_mask       = ATA_PIO4,
+       .swdma_mask     = ATA_SWDMA2,
+       .mwdma_mask     = ATA_MWDMA2,
 };
 
 static int __devinit triflex_init_one(struct pci_dev *dev, 
@@ -144,9 +116,8 @@ static int __devinit triflex_init_one(struct pci_dev *dev,
        return ide_setup_pci_device(dev, &triflex_device);
 }
 
-static struct pci_device_id triflex_pci_tbl[] = {
-       { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE,
-         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+static const struct pci_device_id triflex_pci_tbl[] = {
+       { PCI_VDEVICE(COMPAQ, PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE), 0 },
        { 0, },
 };
 MODULE_DEVICE_TABLE(pci, triflex_pci_tbl);
This page took 0.040276 seconds and 5 git commands to generate.