libata-acpi: fix _GTF command protocol for ATAPI devices
[powerpc.git] / drivers / ata / pata_opti.c
index c2988b0..0af8a2c 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME "pata_opti"
-#define DRV_VERSION "0.2.7"
+#define DRV_VERSION "0.2.9"
 
 enum {
        READ_REG        = 0,    /* index of Read cycle timing register */
@@ -47,11 +47,12 @@ enum {
 /**
  *     opti_pre_reset          -       probe begin
  *     @ap: ATA port
+ *     @deadline: deadline jiffies for the operation
  *
  *     Set up cable type and use generic probe init
  */
 
-static int opti_pre_reset(struct ata_port *ap)
+static int opti_pre_reset(struct ata_port *ap, unsigned long deadline)
 {
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);
        static const struct pci_bits opti_enable_bits[] = {
@@ -62,8 +63,7 @@ static int opti_pre_reset(struct ata_port *ap)
        if (!pci_test_config_bits(pdev, &opti_enable_bits[ap->port_no]))
                return -ENOENT;
 
-       ap->cbl = ATA_CBL_PATA40;
-       return ata_std_prereset(ap);
+       return ata_std_prereset(ap, deadline);
 }
 
 /**
@@ -95,18 +95,18 @@ 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);
 }
 
 /**
@@ -124,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 */
@@ -137,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
@@ -179,8 +179,10 @@ static struct scsi_host_template opti_sht = {
        .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 = {
@@ -196,6 +198,7 @@ static struct ata_port_operations opti_port_ops = {
        .thaw           = ata_bmdma_thaw,
        .error_handler  = opti_error_handler,
        .post_internal_cmd = ata_bmdma_post_internal_cmd,
+       .cable_detect   = ata_cable_40wire,
 
        .bmdma_setup    = ata_bmdma_setup,
        .bmdma_start    = ata_bmdma_start,
@@ -205,14 +208,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)
@@ -244,8 +247,10 @@ static struct pci_driver opti_pci_driver = {
        .id_table       = opti,
        .probe          = opti_init_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)