@@ -1388,6 +1388,17 @@
}
}
+static int mv_check_for_edma_empty_idle(struct ata_port *ap)
+{
+ void __iomem *port_mmio = mv_ap_base(ap);
+ const u32 empty_idle = (EDMA_STATUS_CACHE_EMPTY | EDMA_STATUS_IDLE);
+
+ u32 edma_stat = readl(port_mmio + EDMA_STATUS);
+ if ((edma_stat & empty_idle) == empty_idle)
+ return 0;
+ return ATA_DEFER_PORT;
+}
+
static int mv_qc_defer(struct ata_queued_cmd *qc)
{
struct ata_link *link = qc->dev->link;
@@ -1423,7 +1434,7 @@
* If the port is completely idle, then allow the new qc.
*/
if (ap->nr_active_links == 0)
- return 0;
+ return mv_check_for_edma_empty_idle(ap);
/*
* The port is operating in host queuing mode (EDMA) with NCQ