]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/pci/cy82c693.c
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[linux-2.6-omap-h63xx.git] / drivers / ide / pci / cy82c693.c
index 9eafcbf444f4d0cb629ae14e00f354544113444c..dc278025d318c8c6202532b38a1bf7f2ba646f2a 100644 (file)
@@ -97,9 +97,6 @@
 #define CY82_INDEX_CHANNEL1    0x31
 #define CY82_INDEX_TIMEOUT     0x32
 
-/* the max PIO mode - from datasheet */
-#define CY82C693_MAX_PIO       4
-
 /* the min and max PCI bus speed in MHz - from datasheet */
 #define CY82C963_MIN_BUS_SPEED 25
 #define CY82C963_MAX_BUS_SPEED 33
@@ -148,9 +145,6 @@ static void compute_clocks (u8 pio, pio_clocks_t *p_pclk)
         * so you can play with the idebus=xx parameter
         */
 
-       if (pio > CY82C693_MAX_PIO)
-               pio = CY82C693_MAX_PIO;
-
        /* let's calc the address setup time clocks */
        p_pclk->address_time = (u8)calc_clk(ide_pio_timings[pio].setup_time, bus_speed);
 
@@ -197,8 +191,8 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
 #if CY82C693_DEBUG_LOGS
        /* for debug let's show the previous values */
 
-       HWIF(drive)->OUTB(index, CY82_INDEX_PORT);
-       data = HWIF(drive)->INB(CY82_DATA_PORT);
+       outb(index, CY82_INDEX_PORT);
+       data = inb(CY82_DATA_PORT);
 
        printk (KERN_INFO "%s (ch=%d, dev=%d): DMA mode is %d (single=%d)\n",
                drive->name, HWIF(drive)->channel, drive->select.b.unit,
@@ -207,8 +201,8 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
 
        data = (u8)mode|(u8)(single<<2);
 
-       HWIF(drive)->OUTB(index, CY82_INDEX_PORT);
-       HWIF(drive)->OUTB(data, CY82_DATA_PORT);
+       outb(index, CY82_INDEX_PORT);
+       outb(data, CY82_DATA_PORT);
 
 #if CY82C693_DEBUG_INFO
        printk(KERN_INFO "%s (ch=%d, dev=%d): set DMA mode to %d (single=%d)\n",
@@ -227,8 +221,8 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
         */
 
        data = BUSMASTER_TIMEOUT;
-       HWIF(drive)->OUTB(CY82_INDEX_TIMEOUT, CY82_INDEX_PORT);
-       HWIF(drive)->OUTB(data, CY82_DATA_PORT);
+       outb(CY82_INDEX_TIMEOUT, CY82_INDEX_PORT);
+       outb(data, CY82_DATA_PORT);
 
 #if CY82C693_DEBUG_INFO        
        printk (KERN_INFO "%s: Set IDE Bus Master TimeOut Register to 0x%X\n",
@@ -269,10 +263,7 @@ static int cy82c693_ide_dma_on (ide_drive_t *drive)
         return __ide_dma_on(drive);
 }
 
-/*
- * tune ide drive - set PIO mode
- */
-static void cy82c693_tune_drive (ide_drive_t *drive, u8 pio)
+static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
        ide_hwif_t *hwif = HWIF(drive);
        struct pci_dev *dev = hwif->pci_dev;
@@ -329,13 +320,6 @@ static void cy82c693_tune_drive (ide_drive_t *drive, u8 pio)
                addrCtrl, pclk.time_16r, pclk.time_16w, pclk.time_8);
 #endif /* CY82C693_DEBUG_LOGS */
 
-       /* first let's calc the pio modes */
-       pio = ide_get_best_pio_mode(drive, pio, CY82C693_MAX_PIO, NULL);
-
-#if CY82C693_DEBUG_INFO
-       printk (KERN_INFO "%s: Selected PIO mode %d\n", drive->name, pio);
-#endif /* CY82C693_DEBUG_INFO */
-
        /* let's calc the values for this PIO mode */
        compute_clocks(pio, &pclk);
 
@@ -447,7 +431,7 @@ static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif)
        hwif->autodma = 0;
 
        hwif->chipset = ide_cy82c693;
-       hwif->tuneproc = &cy82c693_tune_drive;
+       hwif->set_pio_mode = &cy82c693_set_pio_mode;
 
        if (!hwif->dma_base) {
                hwif->drives[0].autotune = 1;
@@ -478,21 +462,19 @@ static void __devinit init_iops_cy82c693(ide_hwif_t *hwif)
        }
 }
 
-static ide_pci_device_t cy82c693_chipsets[] __devinitdata = {
-       {       /* 0 */
-               .name           = "CY82C693",
-               .init_chipset   = init_chipset_cy82c693,
-               .init_iops      = init_iops_cy82c693,
-               .init_hwif      = init_hwif_cy82c693,
-               .channels       = 1,
-               .autodma        = AUTODMA,
-               .bootable       = ON_BOARD,
-       }
+static ide_pci_device_t cy82c693_chipset __devinitdata = {
+       .name           = "CY82C693",
+       .init_chipset   = init_chipset_cy82c693,
+       .init_iops      = init_iops_cy82c693,
+       .init_hwif      = init_hwif_cy82c693,
+       .autodma        = AUTODMA,
+       .bootable       = ON_BOARD,
+       .host_flags     = IDE_HFLAG_SINGLE,
+       .pio_mask       = ATA_PIO4,
 };
 
 static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-       ide_pci_device_t *d = &cy82c693_chipsets[id->driver_data];
        struct pci_dev *dev2;
        int ret = -ENODEV;
 
@@ -501,7 +483,7 @@ static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_dev
         if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
            PCI_FUNC(dev->devfn) == 1) {
                dev2 = pci_get_slot(dev->bus, dev->devfn + 1);
-               ret = ide_setup_pci_devices(dev, dev2, d);
+               ret = ide_setup_pci_devices(dev, dev2, &cy82c693_chipset);
                /* We leak pci refs here but thats ok - we can't be unloaded */
        }
        return ret;