]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/pci/cs5535.c
pdc202xx_new: remove ->init_setup
[linux-2.6-omap-h63xx.git] / drivers / ide / pci / cs5535.c
index 082ca7da2cbcd0e2f85d5aebce929aa27fa07995..4360ba30155160e5c5b3f1b9d475033a5dc2ff83 100644 (file)
@@ -75,7 +75,7 @@ static unsigned int cs5535_udma_timings[5] =
  *
  *     cs5535_set_speed() configures the chipset to a new speed.
  */
-static void cs5535_set_speed(ide_drive_t *drive, u8 speed)
+static void cs5535_set_speed(ide_drive_t *drive, const u8 speed)
 {
 
        u32 reg = 0, dummy;
@@ -84,7 +84,7 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)
 
        /* Set the PIO timings */
        if ((speed & XFER_MODE) == XFER_PIO) {
-               ide_drive_t *pair = &drive->hwif->drives[drive->dn ^ 1];
+               ide_drive_t *pair = ide_get_paired_drive(drive);
                u8 cmd, pioa;
 
                cmd = pioa = speed - XFER_PIO_0;
@@ -131,48 +131,30 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)
        }
 }
 
-/****
- *     cs5535_set_drive         -     Configure the drive to the new speed
- *     @drive: Drive to set up
- *     @speed: desired speed
+/**
+ *     cs5535_set_dma_mode     -       set host controller for DMA mode
+ *     @drive: drive
+ *     @speed: DMA mode
  *
- *     cs5535_set_drive() configures the drive and the chipset to a
- *     new speed. It also can be called by upper layers.
+ *     Programs the chipset for DMA mode.
  */
-static int cs5535_set_drive(ide_drive_t *drive, u8 speed)
+
+static void cs5535_set_dma_mode(ide_drive_t *drive, const u8 speed)
 {
-       speed = ide_rate_filter(drive, speed);
-       ide_config_drive_speed(drive, speed);
        cs5535_set_speed(drive, speed);
-
-       return 0;
 }
 
-/****
- *     cs5535_tuneproc    -       PIO setup
- *     @drive: drive to set up
- *     @pio: mode to use (255 for 'best possible')
+/**
+ *     cs5535_set_pio_mode     -       set host controller for PIO mode
+ *     @drive: drive
+ *     @pio: PIO mode number
  *
  *     A callback from the upper layers for PIO-only tuning.
  */
-static void cs5535_tuneproc(ide_drive_t *drive, u8 pio)
-{
-       pio = ide_get_best_pio_mode(drive, pio, 4);
-       ide_config_drive_speed(drive, XFER_PIO_0 + pio);
-       cs5535_set_speed(drive, XFER_PIO_0 + pio);
-}
 
-static int cs5535_dma_check(ide_drive_t *drive)
+static void cs5535_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
-       drive->init_speed = 0;
-
-       if (ide_tune_dma(drive))
-               return 0;
-
-       if (ide_use_fast_pio(drive))
-               cs5535_tuneproc(drive, 255);
-
-       return -1;
+       cs5535_set_speed(drive, XFER_PIO_0 + pio);
 }
 
 static u8 __devinit cs5535_cable_detect(struct pci_dev *dev)
@@ -195,37 +177,25 @@ static u8 __devinit cs5535_cable_detect(struct pci_dev *dev)
  */
 static void __devinit init_hwif_cs5535(ide_hwif_t *hwif)
 {
-       int i;
-
-       hwif->autodma = 0;
+       hwif->set_pio_mode = &cs5535_set_pio_mode;
+       hwif->set_dma_mode = &cs5535_set_dma_mode;
 
-       hwif->tuneproc = &cs5535_tuneproc;
-       hwif->speedproc = &cs5535_set_drive;
-       hwif->ide_dma_check = &cs5535_dma_check;
+       hwif->drives[1].autotune = hwif->drives[0].autotune = 1;
 
-       hwif->atapi_dma = 1;
-       hwif->ultra_mask = 0x1F;
-       hwif->mwdma_mask = 0x07;
+       if (hwif->dma_base == 0)
+               return;
 
        hwif->cbl = cs5535_cable_detect(hwif->pci_dev);
-
-       if (!noautodma)
-               hwif->autodma = 1;
-
-       /* just setting autotune and not worrying about bios timings */
-       for (i = 0; i < 2; i++) {
-               hwif->drives[i].autotune = 1;
-               hwif->drives[i].autodma = hwif->autodma;
-       }
 }
 
 static ide_pci_device_t cs5535_chipset __devinitdata = {
        .name           = "CS5535",
        .init_hwif      = init_hwif_cs5535,
-       .autodma        = AUTODMA,
-       .bootable       = ON_BOARD,
-       .host_flags     = IDE_HFLAG_SINGLE,
+       .host_flags     = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE |
+                         IDE_HFLAG_BOOTABLE,
        .pio_mask       = ATA_PIO4,
+       .mwdma_mask     = ATA_MWDMA2,
+       .udma_mask      = ATA_UDMA4,
 };
 
 static int __devinit cs5535_init_one(struct pci_dev *dev,
@@ -234,10 +204,8 @@ static int __devinit cs5535_init_one(struct pci_dev *dev,
        return ide_setup_pci_device(dev, &cs5535_chipset);
 }
 
-static struct pci_device_id cs5535_pci_tbl[] =
-{
-       { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_IDE, PCI_ANY_ID,
-               PCI_ANY_ID, 0, 0, 0},
+static const struct pci_device_id cs5535_pci_tbl[] = {
+       { PCI_VDEVICE(NS, PCI_DEVICE_ID_NS_CS5535_IDE), 0 },
        { 0, },
 };