]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/pci/cs5520.c
ide: IDE_HFLAG_BOOTABLE -> IDE_HFLAG_NON_BOOTABLE
[linux-2.6-omap-h63xx.git] / drivers / ide / pci / cs5520.c
index 6254d7a659aae23ee254eec2e6fc20dadac90475..01b37ecb5a5a70f597e0846027c4e37897eaf3ac 100644 (file)
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/delay.h>
-#include <linux/timer.h>
-#include <linux/mm.h>
-#include <linux/ioport.h>
-#include <linux/blkdev.h>
 #include <linux/hdreg.h>
-
-#include <linux/interrupt.h>
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/ide.h>
 #include <linux/dma-mapping.h>
 
-#include <asm/io.h>
-#include <asm/irq.h>
-
 struct pio_clocks
 {
        int address;
@@ -69,9 +59,8 @@ static struct pio_clocks cs5520_pio_clocks[]={
 static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
        ide_hwif_t *hwif = HWIF(drive);
-       struct pci_dev *pdev = hwif->pci_dev;
+       struct pci_dev *pdev = to_pci_dev(hwif->dev);
        int controller = drive->dn > 1 ? 1 : 0;
-       u8 reg;
 
        /* FIXME: if DMA = 1 do we need to set the DMA bit here ? */
 
@@ -91,11 +80,6 @@ static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio)
        pci_write_config_byte(pdev, 0x66 + 4*controller + (drive->dn&1),
                (cs5520_pio_clocks[pio].recovery << 4) |
                (cs5520_pio_clocks[pio].assert));
-               
-       /* Set the DMA enable/disable flag */
-       reg = inb(hwif->dma_base + 0x02 + 8*controller);
-       reg |= 1<<((drive->dn&1)+5);
-       outb(reg, hwif->dma_base + 0x02 + 8*controller);
 }
 
 static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed)
@@ -109,13 +93,14 @@ static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed)
  *     We wrap the DMA activate to set the vdma flag. This is needed
  *     so that the IDE DMA layer issues PIO not DMA commands over the
  *     DMA channel
+ *
+ *     ATAPI is harder so disable it for now using IDE_HFLAG_NO_ATAPI_DMA
  */
-static int cs5520_dma_on(ide_drive_t *drive)
+
+static void cs5520_dma_host_set(ide_drive_t *drive, int on)
 {
-       /* ATAPI is harder so leave it for now */
-       drive->vdma = 1;
-       return 0;
+       drive->vdma = on;
+       ide_dma_host_set(drive, on);
 }
 
 static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
@@ -123,12 +108,10 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
        hwif->set_pio_mode = &cs5520_set_pio_mode;
        hwif->set_dma_mode = &cs5520_set_dma_mode;
 
-       if (hwif->dma_base == 0) {
-               hwif->drives[1].autotune = hwif->drives[0].autotune = 1;
+       if (hwif->dma_base == 0)
                return;
-       }
 
-       hwif->ide_dma_on = &cs5520_dma_on;
+       hwif->dma_host_set = &cs5520_dma_host_set;
 }
 
 #define DECLARE_CS_DEV(name_str)                               \
@@ -139,11 +122,11 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
                                  IDE_HFLAG_CS5520 |            \
                                  IDE_HFLAG_VDMA |              \
                                  IDE_HFLAG_NO_ATAPI_DMA |      \
-                                 IDE_HFLAG_BOOTABLE,           \
+                                 IDE_HFLAG_ABUSE_SET_DMA_MODE, \
                .pio_mask       = ATA_PIO4,                     \
        }
 
-static ide_pci_device_t cyrix_chipsets[] __devinitdata = {
+static const struct ide_port_info cyrix_chipsets[] __devinitdata = {
        /* 0 */ DECLARE_CS_DEV("Cyrix 5510"),
        /* 1 */ DECLARE_CS_DEV("Cyrix 5520")
 };
@@ -156,15 +139,15 @@ static ide_pci_device_t cyrix_chipsets[] __devinitdata = {
  
 static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-       ide_hwif_t *hwif = NULL, *mate = NULL;
-       ata_index_t index;
-       ide_pci_device_t *d = &cyrix_chipsets[id->driver_data];
+       const struct ide_port_info *d = &cyrix_chipsets[id->driver_data];
+       u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
        ide_setup_pci_noise(dev, d);
 
        /* We must not grab the entire device, it has 'ISA' space in its
-          BARS too and we will freak out other bits of the kernel */
-       if (pci_enable_device_bars(dev, 1<<2)) {
+        * BARS too and we will freak out other bits of the kernel
+        */
+       if (pci_enable_device_io(dev)) {
                printk(KERN_WARNING "%s: Unable to enable 55x0.\n", d->name);
                return -ENODEV;
        }
@@ -174,29 +157,14 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic
                return -ENODEV;
        }
 
-       index.all = 0xf0f0;
-
        /*
         *      Now the chipset is configured we can let the core
         *      do all the device setup for us
         */
 
-       ide_pci_setup_ports(dev, d, 14, &index);
-
-       if ((index.b.low & 0xf0) != 0xf0)
-               hwif = &ide_hwifs[index.b.low];
-       if ((index.b.high & 0xf0) != 0xf0)
-               mate = &ide_hwifs[index.b.high];
-
-       if (hwif)
-               probe_hwif_init(hwif);
-       if (mate)
-               probe_hwif_init(mate);
+       ide_pci_setup_ports(dev, d, 14, &idx[0]);
 
-       if (hwif)
-               ide_proc_register_port(hwif);
-       if (mate)
-               ide_proc_register_port(mate);
+       ide_device_add(idx, d);
 
        return 0;
 }