Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66e57a2c authored by Mark Lord's avatar Mark Lord Committed by Jeff Garzik
Browse files

sata_mv: optimize use of mv_edma_cfg



Try and avoid unnecessary reconfiguration of the EDMA config register
on every single non-EDMA I/O operation, by moving the call to
mv_edma_cfg() into mv_stop_edma().  It must then also be invoked
from mv_hardreset() and from mv_port_start().

Signed-off-by: default avatarMark Lord <mlord@pobox.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent da14265e
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -979,6 +979,7 @@ static int mv_stop_edma(struct ata_port *ap)
{
{
	void __iomem *port_mmio = mv_ap_base(ap);
	void __iomem *port_mmio = mv_ap_base(ap);
	struct mv_port_priv *pp = ap->private_data;
	struct mv_port_priv *pp = ap->private_data;
	int err = 0;


	if (!(pp->pp_flags & MV_PP_FLAG_EDMA_EN))
	if (!(pp->pp_flags & MV_PP_FLAG_EDMA_EN))
		return 0;
		return 0;
@@ -986,9 +987,10 @@ static int mv_stop_edma(struct ata_port *ap)
	mv_wait_for_edma_empty_idle(ap);
	mv_wait_for_edma_empty_idle(ap);
	if (mv_stop_edma_engine(port_mmio)) {
	if (mv_stop_edma_engine(port_mmio)) {
		ata_port_printk(ap, KERN_ERR, "Unable to stop eDMA\n");
		ata_port_printk(ap, KERN_ERR, "Unable to stop eDMA\n");
		return -EIO;
		err = -EIO;
	}
	}
	return 0;
	mv_edma_cfg(ap, 0, 0);
	return err;
}
}


#ifdef ATA_DEBUG
#ifdef ATA_DEBUG
@@ -1337,6 +1339,7 @@ static int mv_port_start(struct ata_port *ap)
			pp->sg_tbl_dma[tag] = pp->sg_tbl_dma[0];
			pp->sg_tbl_dma[tag] = pp->sg_tbl_dma[0];
		}
		}
	}
	}
	mv_edma_cfg(ap, 0, 0);
	return 0;
	return 0;


out_port_free_dma_mem:
out_port_free_dma_mem:
@@ -1797,7 +1800,6 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
		 * shadow block, etc registers.
		 * shadow block, etc registers.
		 */
		 */
		mv_stop_edma(ap);
		mv_stop_edma(ap);
		mv_edma_cfg(ap, 0, 0);
		mv_clear_and_enable_port_irqs(ap, mv_ap_base(ap), port_irqs);
		mv_clear_and_enable_port_irqs(ap, mv_ap_base(ap), port_irqs);
		mv_pmp_select(ap, qc->dev->link->pmp);
		mv_pmp_select(ap, qc->dev->link->pmp);
		return ata_sff_qc_issue(qc);
		return ata_sff_qc_issue(qc);
@@ -2997,6 +2999,7 @@ static int mv_hardreset(struct ata_link *link, unsigned int *class,
				extra = HZ; /* only extend it once, max */
				extra = HZ; /* only extend it once, max */
		}
		}
	} while (sstatus != 0x0 && sstatus != 0x113 && sstatus != 0x123);
	} while (sstatus != 0x0 && sstatus != 0x113 && sstatus != 0x123);
	mv_edma_cfg(ap, 0, 0);


	return rc;
	return rc;
}
}