Merge tag 'mmc-v4.8' of git://git.linaro.org/people/ulf.hansson/mmc
[cascardo/linux.git] / drivers / ata / libahci.c
index 71b0719..7461a58 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)