Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
[pandora-kernel.git] / drivers / ata / pata_opti.c
index 57fe21f..3fd3a35 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME "pata_opti"
-#define DRV_VERSION "0.2.5"
+#define DRV_VERSION "0.2.8"
 
 enum {
        READ_REG        = 0,    /* index of Read cycle timing register */
@@ -95,44 +95,20 @@ static void opti_error_handler(struct ata_port *ap)
 
 static void opti_write_reg(struct ata_port *ap, u8 val, int reg)
 {
-       unsigned long regio = ap->ioaddr.cmd_addr;
+       void __iomem *regio = ap->ioaddr.cmd_addr;
 
        /* These 3 unlock the control register access */
-       inw(regio + 1);
-       inw(regio + 1);
-       outb(3, regio + 2);
+       ioread16(regio + 1);
+       ioread16(regio + 1);
+       iowrite8(3, regio + 2);
 
        /* Do the I/O */
-       outb(val, regio + reg);
+       iowrite8(val, regio + reg);
 
        /* Relock */
-       outb(0x83, regio + 2);
+       iowrite8(0x83, regio + 2);
 }
 
-#if 0
-/**
- *     opti_read_reg           -       control register read
- *     @ap: ATA port
- *     @reg: control register number
- *
- *     The Opti uses magic 'trapdoor' register accesses to do configuration
- *     rather than using PCI space as other controllers do. The double inw
- *     on the error register activates configuration mode. We can then read
- *     the control register
- */
-
-static u8 opti_read_reg(struct ata_port *ap, int reg)
-{
-       unsigned long regio = ap->ioaddr.cmd_addr;
-       u8 ret;
-       inw(regio + 1);
-       inw(regio + 1);
-       outb(3, regio + 2);
-       ret = inb(regio + reg);
-       outb(0x83, regio + 2);
-}
-#endif
-
 /**
  *     opti_set_piomode        -       set initial PIO mode data
  *     @ap: ATA interface
@@ -148,7 +124,7 @@ static void opti_set_piomode(struct ata_port *ap, struct ata_device *adev)
        struct ata_device *pair = ata_dev_pair(adev);
        int clock;
        int pio = adev->pio_mode - XFER_PIO_0;
-       unsigned long regio = ap->ioaddr.cmd_addr;
+       void __iomem *regio = ap->ioaddr.cmd_addr;
        u8 addr;
 
        /* Address table precomputed with prefetch off and a DCLK of 2 */
@@ -161,8 +137,8 @@ static void opti_set_piomode(struct ata_port *ap, struct ata_device *adev)
                { 0x58, 0x44, 0x32, 0x22, 0x21 }
        };
 
-       outb(0xff, regio + 5);
-       clock = inw(regio + 5) & 1;
+       iowrite8(0xff, regio + 5);
+       clock = ioread16(regio + 5) & 1;
 
        /*
         *      As with many controllers the address setup time is shared
@@ -195,20 +171,23 @@ static struct scsi_host_template opti_sht = {
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
-       .max_sectors            = ATA_MAX_SECTORS,
        .cmd_per_lun            = ATA_SHT_CMD_PER_LUN,
        .emulated               = ATA_SHT_EMULATED,
        .use_clustering         = ATA_SHT_USE_CLUSTERING,
        .proc_name              = DRV_NAME,
        .dma_boundary           = ATA_DMA_BOUNDARY,
        .slave_configure        = ata_scsi_slave_config,
+       .slave_destroy          = ata_scsi_slave_destroy,
        .bios_param             = ata_std_bios_param,
+#ifdef CONFIG_PM
+       .resume                 = ata_scsi_device_resume,
+       .suspend                = ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations opti_port_ops = {
        .port_disable   = ata_port_disable,
        .set_piomode    = opti_set_piomode,
-/*     .set_dmamode    = opti_set_dmamode, */
        .tf_load        = ata_tf_load,
        .tf_read        = ata_tf_read,
        .check_status   = ata_check_status,
@@ -228,14 +207,14 @@ static struct ata_port_operations opti_port_ops = {
        .qc_prep        = ata_qc_prep,
        .qc_issue       = ata_qc_issue_prot,
 
-       .data_xfer      = ata_pio_data_xfer,
+       .data_xfer      = ata_data_xfer,
 
        .irq_handler    = ata_interrupt,
        .irq_clear      = ata_bmdma_irq_clear,
+       .irq_on         = ata_irq_on,
+       .irq_ack        = ata_irq_ack,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id)
@@ -256,16 +235,21 @@ static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 }
 
 static const struct pci_device_id opti[] = {
-       { PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-       { PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
-       { 0, },
+       { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C621), 0 },
+       { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C825), 1 },
+
+       { },
 };
 
 static struct pci_driver opti_pci_driver = {
-        .name          = DRV_NAME,
+       .name           = DRV_NAME,
        .id_table       = opti,
        .probe          = opti_init_one,
-       .remove         = ata_pci_remove_one
+       .remove         = ata_pci_remove_one,
+#ifdef CONFIG_PM
+       .suspend        = ata_pci_device_suspend,
+       .resume         = ata_pci_device_resume,
+#endif
 };
 
 static int __init opti_init(void)
@@ -273,7 +257,6 @@ static int __init opti_init(void)
        return pci_register_driver(&opti_pci_driver);
 }
 
-
 static void __exit opti_exit(void)
 {
        pci_unregister_driver(&opti_pci_driver);