libata-sff: ap->[last_]ctl are SFF specific
[safe/jmp/linux-2.6] / drivers / ata / pata_cs5520.c
index dd6b235..95ebdac 100644 (file)
@@ -90,48 +90,12 @@ static void cs5520_set_timings(struct ata_port *ap, struct ata_device *adev, int
 }
 
 /**
- *     cs5520_enable_dma       -       turn on DMA bits
- *
- *     Turn on the DMA bits for this disk. Needed because the BIOS probably
- *     has not done the work for us. Belongs in the core SATA code.
- */
-
-static void cs5520_enable_dma(struct ata_port *ap, struct ata_device *adev)
-{
-       /* Set the DMA enable/disable flag */
-       u8 reg = ioread8(ap->ioaddr.bmdma_addr + 0x02);
-       reg |= 1<<(adev->devno + 5);
-       iowrite8(reg, ap->ioaddr.bmdma_addr + 0x02);
-}
-
-/**
- *     cs5520_set_dmamode      -       program DMA timings
- *     @ap: ATA port
- *     @adev: ATA device
- *
- *     Program the DMA mode timings for the controller according to the pio
- *     clocking table. Note that this device sets the DMA timings to PIO
- *     mode values. This may seem bizarre but the 5520 architecture talks
- *     PIO mode to the disk and DMA mode to the controller so the underlying
- *     transfers are PIO timed.
- */
-
-static void cs5520_set_dmamode(struct ata_port *ap, struct ata_device *adev)
-{
-       static const int dma_xlate[3] = { XFER_PIO_0, XFER_PIO_3, XFER_PIO_4 };
-       cs5520_set_timings(ap, adev, dma_xlate[adev->dma_mode]);
-       cs5520_enable_dma(ap, adev);
-}
-
-/**
  *     cs5520_set_piomode      -       program PIO timings
  *     @ap: ATA port
  *     @adev: ATA device
  *
  *     Program the PIO mode timings for the controller according to the pio
- *     clocking table. We know pio_mode will equal dma_mode because of the
- *     CS5520 architecture. At least once we turned DMA on and wrote a
- *     mode setter.
+ *     clocking table.
  */
 
 static void cs5520_set_piomode(struct ata_port *ap, struct ata_device *adev)
@@ -140,51 +104,15 @@ static void cs5520_set_piomode(struct ata_port *ap, struct ata_device *adev)
 }
 
 static struct scsi_host_template cs5520_sht = {
-       .module                 = THIS_MODULE,
-       .name                   = DRV_NAME,
-       .ioctl                  = ata_scsi_ioctl,
-       .queuecommand           = ata_scsi_queuecmd,
-       .can_queue              = ATA_DEF_QUEUE,
-       .this_id                = ATA_SHT_THIS_ID,
+       ATA_BMDMA_SHT(DRV_NAME),
        .sg_tablesize           = LIBATA_DUMB_MAX_PRD,
-       .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,
 };
 
 static struct ata_port_operations cs5520_port_ops = {
-       .set_piomode            = cs5520_set_piomode,
-       .set_dmamode            = cs5520_set_dmamode,
-
-       .tf_load                = ata_tf_load,
-       .tf_read                = ata_tf_read,
-       .check_status           = ata_check_status,
-       .exec_command           = ata_exec_command,
-       .dev_select             = ata_std_dev_select,
-
-       .freeze                 = ata_bmdma_freeze,
-       .thaw                   = ata_bmdma_thaw,
-       .error_handler          = ata_bmdma_error_handler,
-       .post_internal_cmd      = ata_bmdma_post_internal_cmd,
+       .inherits               = &ata_bmdma_port_ops,
+       .qc_prep                = ata_sff_dumb_qc_prep,
        .cable_detect           = ata_cable_40wire,
-
-       .bmdma_setup            = ata_bmdma_setup,
-       .bmdma_start            = ata_bmdma_start,
-       .bmdma_stop             = ata_bmdma_stop,
-       .bmdma_status           = ata_bmdma_status,
-       .qc_prep                = ata_dumb_qc_prep,
-       .qc_issue               = ata_qc_issue_prot,
-       .data_xfer              = ata_data_xfer,
-
-       .irq_clear              = ata_bmdma_irq_clear,
-       .irq_on                 = ata_irq_on,
-
-       .port_start             = ata_sff_port_start,
+       .set_piomode            = cs5520_set_piomode,
 };
 
 static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
@@ -193,7 +121,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
        static const unsigned int ctl_port[] = { 0x3F6, 0x376 };
        struct ata_port_info pi = {
                .flags          = ATA_FLAG_SLAVE_POSS,
-               .pio_mask       = 0x1f,
+               .pio_mask       = ATA_PIO4,
                .port_ops       = &cs5520_port_ops,
        };
        const struct ata_port_info *ppi[2];
@@ -238,11 +166,11 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
                return -ENODEV;
        }
 
-       if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
+       if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
                printk(KERN_ERR DRV_NAME ": unable to configure DMA mask.\n");
                return -ENODEV;
        }
-       if (pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) {
+       if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
                printk(KERN_ERR DRV_NAME ": unable to configure consistent DMA mask.\n");
                return -ENODEV;
        }
@@ -262,7 +190,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
        ioaddr->ctl_addr = iomap[1];
        ioaddr->altstatus_addr = iomap[1];
        ioaddr->bmdma_addr = iomap[4];
-       ata_std_ports(ioaddr);
+       ata_sff_std_ports(ioaddr);
 
        ata_port_desc(host->ports[0],
                      "cmd 0x%x ctl 0x%x", cmd_port[0], ctl_port[0]);
@@ -273,7 +201,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
        ioaddr->ctl_addr = iomap[3];
        ioaddr->altstatus_addr = iomap[3];
        ioaddr->bmdma_addr = iomap[4] + 8;
-       ata_std_ports(ioaddr);
+       ata_sff_std_ports(ioaddr);
 
        ata_port_desc(host->ports[1],
                      "cmd 0x%x ctl 0x%x", cmd_port[1], ctl_port[1]);
@@ -293,7 +221,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
                        continue;
 
                rc = devm_request_irq(&pdev->dev, irq[ap->port_no],
-                                     ata_interrupt, 0, DRV_NAME, host);
+                                     ata_sff_interrupt, 0, DRV_NAME, host);
                if (rc)
                        return rc;