diff mbox

[v4,09/10] remoteproc: qcom: Modify stop routine for q6v56 specific step

Message ID 1479315696-15490-10-git-send-email-akdwived@codeaurora.org (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show

Commit Message

Dwivedi, Avaneesh Kumar (avani) Nov. 16, 2016, 5:01 p.m. UTC
for q6v56 compatible mss chip, certain version of hexagon chip
require to limit high MX current during restart, so this additional
step.

Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
---
 drivers/remoteproc/qcom_q6v5_pil.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c
index 3fccde4..3135832 100644
--- a/drivers/remoteproc/qcom_q6v5_pil.c
+++ b/drivers/remoteproc/qcom_q6v5_pil.c
@@ -811,7 +811,7 @@  static int q6v5_start(struct rproc *rproc)
 static int q6v5_stop(struct rproc *rproc)
 {
 	struct q6v5 *qproc = (struct q6v5 *)rproc->priv;
-	int ret;
+	int ret, val;
 
 	qproc->running = false;
 
@@ -829,6 +829,23 @@  static int q6v5_stop(struct rproc *rproc)
 	q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_modem);
 	q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_nc);
 
+	if (qproc->qdsp6v56_1_5) {
+		/*
+		 * Assert QDSP6 I/O clamp, memory wordline clamp, and compiler
+		 * memory clamp as a software workaround to avoid high MX
+		 * current during LPASS/MSS restart.
+		 */
+		ret = clk_prepare_enable(devm_clk_get(qproc->dev, "iface"));
+		if (!ret) {
+			val = readl_relaxed(
+				qproc->reg_base + QDSP6SS_PWR_CTL_REG);
+			val |= (Q6SS_CLAMP_IO | QDSP6v56_CLAMP_WL |
+				QDSP6v56_CLAMP_QMC_MEM);
+			writel_relaxed(val,
+				qproc->reg_base + QDSP6SS_PWR_CTL_REG);
+		}
+	}
+
 	if (qproc->qdsp6v56_1_5)
 		pil_mss_restart_reg(qproc, 1);
 	else {