]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/pci/cy82c693.c
cy82c693: convert to use ide_timing_find_mode()
[linux-2.6-omap-h63xx.git] / drivers / ide / pci / cy82c693.c
index 08eab7e7f051958da14fd53cc5ddf300d1579f4b..e14ad5530fa4b0c1e1369387d43e4e73d8ac8b7b 100644 (file)
@@ -18,8 +18,6 @@
  *   hdparm -t reports 8.17 MB/sec at about 6% CPU usage for the DTTA
  * - this is my first linux driver, so there's probably a lot  of room
  *   for optimizations and bug fixing, so feel free to do it.
- * - use idebus=xx parameter to set PCI bus speed - needed to calc
- *   timings for PIO modes (default will be 40)
  * - if using PIO mode it's a good idea to set the PIO mode and
  *   32-bit I/O support (if possible), e.g. hdparm -p2 -c1 /dev/hda
  * - I had some problems with my IBM DHEA with PIO modes < 2
@@ -135,23 +133,22 @@ static int calc_clk(int time, int bus_speed)
  */
 static void compute_clocks(u8 pio, pio_clocks_t *p_pclk)
 {
+       struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);
        int clk1, clk2;
-       int bus_speed = system_bus_clock();     /* get speed of PCI bus */
+       int bus_speed = ide_pci_clk ? ide_pci_clk : 33;
 
        /* we don't check against CY82C693's min and max speed,
         * so you can play with the idebus=xx parameter
         */
 
        /* let's calc the address setup time clocks */
-       p_pclk->address_time = (u8)calc_clk(ide_pio_timings[pio].setup_time, bus_speed);
+       p_pclk->address_time = (u8)calc_clk(t->setup, bus_speed);
 
        /* let's calc the active and recovery time clocks */
-       clk1 = calc_clk(ide_pio_timings[pio].active_time, bus_speed);
+       clk1 = calc_clk(t->active, bus_speed);
 
        /* calc recovery timing */
-       clk2 =  ide_pio_timings[pio].cycle_time -
-               ide_pio_timings[pio].active_time -
-               ide_pio_timings[pio].setup_time;
+       clk2 = t->cycle - t->active - t->setup;
 
        clk2 = calc_clk(clk2, bus_speed);
 
@@ -382,15 +379,6 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c
        return 0;
 }
 
-/*
- * the init function - called for each ide channel once
- */
-static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif)
-{
-       hwif->set_pio_mode = &cy82c693_set_pio_mode;
-       hwif->set_dma_mode = &cy82c693_set_dma_mode;
-}
-
 static void __devinit init_iops_cy82c693(ide_hwif_t *hwif)
 {
        static ide_hwif_t *primary;
@@ -404,11 +392,16 @@ static void __devinit init_iops_cy82c693(ide_hwif_t *hwif)
        }
 }
 
+static const struct ide_port_ops cy82c693_port_ops = {
+       .set_pio_mode           = cy82c693_set_pio_mode,
+       .set_dma_mode           = cy82c693_set_dma_mode,
+};
+
 static const struct ide_port_info cy82c693_chipset __devinitdata = {
        .name           = "CY82C693",
        .init_chipset   = init_chipset_cy82c693,
        .init_iops      = init_iops_cy82c693,
-       .init_hwif      = init_hwif_cy82c693,
+       .port_ops       = &cy82c693_port_ops,
        .chipset        = ide_cy82c693,
        .host_flags     = IDE_HFLAG_SINGLE,
        .pio_mask       = ATA_PIO4,