]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ata/sata_sil.c
Merge branch 'suspend' into test
[linux-2.6-omap-h63xx.git] / drivers / ata / sata_sil.c
index 4e6e381279cc657556924c136fca91ac5ebd7284..88bf4212590f06f9f3f762894b226e012e9f2b18 100644 (file)
@@ -60,7 +60,6 @@ enum {
 
        SIL_DFL_PORT_FLAGS      = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
                                  ATA_FLAG_MMIO,
-       SIL_DFL_LINK_FLAGS      = ATA_LFLAG_HRST_TO_RESUME,
 
        /*
         * Controller IDs
@@ -168,54 +167,23 @@ static struct pci_driver sil_pci_driver = {
 };
 
 static struct scsi_host_template sil_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,
-       .sg_tablesize           = LIBATA_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,
+       ATA_BMDMA_SHT(DRV_NAME),
 };
 
-static const struct ata_port_operations sil_ops = {
+static struct ata_port_operations sil_ops = {
+       .inherits               = &ata_bmdma_port_ops,
        .dev_config             = sil_dev_config,
-       .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,
        .set_mode               = sil_set_mode,
-       .bmdma_setup            = ata_bmdma_setup,
-       .bmdma_start            = ata_bmdma_start,
-       .bmdma_stop             = ata_bmdma_stop,
-       .bmdma_status           = ata_bmdma_status,
-       .qc_prep                = ata_qc_prep,
-       .qc_issue               = ata_qc_issue_prot,
-       .data_xfer              = ata_data_xfer,
        .freeze                 = sil_freeze,
        .thaw                   = sil_thaw,
-       .error_handler          = ata_bmdma_error_handler,
-       .post_internal_cmd      = ata_bmdma_post_internal_cmd,
-       .irq_clear              = ata_bmdma_irq_clear,
-       .irq_on                 = ata_irq_on,
        .scr_read               = sil_scr_read,
        .scr_write              = sil_scr_write,
-       .port_start             = ata_port_start,
 };
 
 static const struct ata_port_info sil_port_info[] = {
        /* sil_3112 */
        {
                .flags          = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE,
-               .link_flags     = SIL_DFL_LINK_FLAGS,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = ATA_UDMA5,
@@ -225,7 +193,6 @@ static const struct ata_port_info sil_port_info[] = {
        {
                .flags          = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE |
                                  SIL_FLAG_NO_SATA_IRQ,
-               .link_flags     = SIL_DFL_LINK_FLAGS,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = ATA_UDMA5,
@@ -234,7 +201,6 @@ static const struct ata_port_info sil_port_info[] = {
        /* sil_3512 */
        {
                .flags          = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT,
-               .link_flags     = SIL_DFL_LINK_FLAGS,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = ATA_UDMA5,
@@ -243,7 +209,6 @@ static const struct ata_port_info sil_port_info[] = {
        /* sil_3114 */
        {
                .flags          = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT,
-               .link_flags     = SIL_DFL_LINK_FLAGS,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = ATA_UDMA5,
@@ -390,25 +355,21 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
                sil_scr_read(ap, SCR_ERROR, &serror);
                sil_scr_write(ap, SCR_ERROR, serror);
 
-               /* Trigger hotplug and accumulate SError only if the
-                * port isn't already frozen.  Otherwise, PHY events
-                * during hardreset makes controllers with broken SIEN
-                * repeat probing needlessly.
+               /* Sometimes spurious interrupts occur, double check
+                * it's PHYRDY CHG.
                 */
-               if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
-                       ata_ehi_hotplugged(&ap->link.eh_info);
+               if (serror & SERR_PHYRDY_CHG) {
                        ap->link.eh_info.serror |= serror;
+                       goto freeze;
                }
 
-               goto freeze;
+               if (!(bmdma2 & SIL_DMA_COMPLETE))
+                       return;
        }
 
-       if (unlikely(!qc))
-               goto freeze;
-
-       if (unlikely(qc->tf.flags & ATA_TFLAG_POLLING)) {
+       if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) {
                /* this sometimes happens, just clear IRQ */
-               ata_chk_status(ap);
+               ap->ops->sff_check_status(ap);
                return;
        }
 
@@ -420,15 +381,14 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
                 */
 
                /* Check the ATA_DFLAG_CDB_INTR flag is enough here.
-                * The flag was turned on only for atapi devices.
-                * No need to check is_atapi_taskfile(&qc->tf) again.
+                * The flag was turned on only for atapi devices.  No
+                * need to check ata_is_atapi(qc->tf.protocol) again.
                 */
                if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
                        goto err_hsm;
                break;
        case HSM_ST_LAST:
-               if (qc->tf.protocol == ATA_PROT_DMA ||
-                   qc->tf.protocol == ATA_PROT_ATAPI_DMA) {
+               if (ata_is_dma(qc->tf.protocol)) {
                        /* clear DMA-Start bit */
                        ap->ops->bmdma_stop(qc);
 
@@ -445,18 +405,17 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
        }
 
        /* check main status, clearing INTRQ */
-       status = ata_chk_status(ap);
+       status = ap->ops->sff_check_status(ap);
        if (unlikely(status & ATA_BUSY))
                goto err_hsm;
 
        /* ack bmdma irq events */
-       ata_bmdma_irq_clear(ap);
+       ata_sff_irq_clear(ap);
 
        /* kick HSM in the ass */
-       ata_hsm_move(ap, qc, status, 0);
+       ata_sff_hsm_move(ap, qc, status, 0);
 
-       if (unlikely(qc->err_mask) && (qc->tf.protocol == ATA_PROT_DMA ||
-                                      qc->tf.protocol == ATA_PROT_ATAPI_DMA))
+       if (unlikely(qc->err_mask) && ata_is_dma(qc->tf.protocol))
                ata_ehi_push_desc(ehi, "BMDMA2 stat 0x%x", bmdma2);
 
        return;
@@ -521,8 +480,8 @@ static void sil_thaw(struct ata_port *ap)
        u32 tmp;
 
        /* clear IRQ */
-       ata_chk_status(ap);
-       ata_bmdma_irq_clear(ap);
+       ap->ops->sff_check_status(ap);
+       ata_sff_irq_clear(ap);
 
        /* turn on SATA IRQ if supported */
        if (!(ap->flags & SIL_FLAG_NO_SATA_IRQ))
@@ -696,7 +655,7 @@ static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                ioaddr->ctl_addr = mmio_base + sil_port[i].ctl;
                ioaddr->bmdma_addr = mmio_base + sil_port[i].bmdma;
                ioaddr->scr_addr = mmio_base + sil_port[i].scr;
-               ata_std_ports(ioaddr);
+               ata_sff_std_ports(ioaddr);
 
                ata_port_pbar_desc(ap, SIL_MMIO_BAR, -1, "mmio");
                ata_port_pbar_desc(ap, SIL_MMIO_BAR, sil_port[i].tf, "tf");