AHCI: Clear GHC.IS to prevent unexpectly asserting INTx
[deliverable/linux.git] / drivers / ata / libahci.c
index a5d7c1c2a05ee26dc80a41d440357c4a7be96a20..7461a587b39b4e9d953e3a0063b9f1fb8cad0319 100644 (file)
@@ -1975,7 +1975,7 @@ unsigned int ahci_qc_issue(struct ata_queued_cmd *qc)
         */
        pp->active_link = qc->dev->link;
 
-       if (qc->tf.protocol == ATA_PROT_NCQ)
+       if (ata_is_ncq(qc->tf.protocol))
                writel(1 << qc->tag, port_mmio + PORT_SCR_ACT);
 
        if (pp->fbs_enabled && pp->fbs_last_dev != qc->dev->link->pmp) {
@@ -2392,12 +2392,20 @@ static int ahci_port_start(struct ata_port *ap)
 static void ahci_port_stop(struct ata_port *ap)
 {
        const char *emsg = NULL;
+       struct ahci_host_priv *hpriv = ap->host->private_data;
+       void __iomem *host_mmio = hpriv->mmio;
        int rc;
 
        /* de-initialize port */
        rc = ahci_deinit_port(ap, &emsg);
        if (rc)
                ata_port_warn(ap, "%s (%d)\n", emsg, rc);
+
+       /*
+        * Clear GHC.IS to prevent stuck INTx after disabling MSI and
+        * re-enabling INTx.
+        */
+       writel(1 << ap->port_no, host_mmio + HOST_IRQ_STAT);
 }
 
 void ahci_print_info(struct ata_host *host, const char *scc_s)
@@ -2550,8 +2558,8 @@ int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht)
 
        if (hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX)) {
                if (hpriv->irq_handler)
-                       dev_warn(host->dev, "both AHCI_HFLAG_MULTI_MSI flag set \
-                                and custom irq handler implemented\n");
+                       dev_warn(host->dev,
+                                "both AHCI_HFLAG_MULTI_MSI flag set and custom irq handler implemented\n");
 
                rc = ahci_host_activate_multi_irqs(host, sht);
        } else {
This page took 0.024582 seconds and 5 git commands to generate.