remoteproc: qcom: q6v5-pil: Add PDC reset for modem on SDM845 SoCs
authorSibi Sankar <sibis@codeaurora.org>
Wed, 29 Aug 2018 19:12:15 +0000 (00:42 +0530)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Fri, 5 Oct 2018 18:46:04 +0000 (11:46 -0700)
In the presence of a PDC block working with subsystem RSC, assert/deassert
PDC reset in modem start/stop path.

Signed-off-by: Sibi Sankar <sibis@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/remoteproc/qcom_q6v5_mss.c

index 325a3f2..a839b07 100644 (file)
@@ -149,6 +149,7 @@ struct q6v5 {
        u32 halt_nc;
 
        struct reset_control *mss_restart;
+       struct reset_control *pdc_reset;
 
        struct qcom_q6v5 q6v5;
 
@@ -347,10 +348,17 @@ static int q6v5_load(struct rproc *rproc, const struct firmware *fw)
 
 static int q6v5_reset_assert(struct q6v5 *qproc)
 {
-       if (qproc->has_alt_reset)
-               return reset_control_reset(qproc->mss_restart);
-       else
-               return reset_control_assert(qproc->mss_restart);
+       int ret;
+
+       if (qproc->has_alt_reset) {
+               reset_control_assert(qproc->pdc_reset);
+               ret = reset_control_reset(qproc->mss_restart);
+               reset_control_deassert(qproc->pdc_reset);
+       } else {
+               ret = reset_control_assert(qproc->mss_restart);
+       }
+
+       return ret;
 }
 
 static int q6v5_reset_deassert(struct q6v5 *qproc)
@@ -358,9 +366,11 @@ static int q6v5_reset_deassert(struct q6v5 *qproc)
        int ret;
 
        if (qproc->has_alt_reset) {
+               reset_control_assert(qproc->pdc_reset);
                writel(1, qproc->rmb_base + RMB_MBA_ALT_RESET);
                ret = reset_control_reset(qproc->mss_restart);
                writel(0, qproc->rmb_base + RMB_MBA_ALT_RESET);
+               reset_control_deassert(qproc->pdc_reset);
        } else {
                ret = reset_control_deassert(qproc->mss_restart);
        }
@@ -1072,6 +1082,15 @@ static int q6v5_init_reset(struct q6v5 *qproc)
                return PTR_ERR(qproc->mss_restart);
        }
 
+       if (qproc->has_alt_reset) {
+               qproc->pdc_reset = devm_reset_control_get_exclusive(qproc->dev,
+                                                                   "pdc_reset");
+               if (IS_ERR(qproc->pdc_reset)) {
+                       dev_err(qproc->dev, "failed to acquire pdc reset\n");
+                       return PTR_ERR(qproc->pdc_reset);
+               }
+       }
+
        return 0;
 }
 
@@ -1192,12 +1211,12 @@ static int q6v5_probe(struct platform_device *pdev)
        }
        qproc->active_reg_count = ret;
 
+       qproc->has_alt_reset = desc->has_alt_reset;
        ret = q6v5_init_reset(qproc);
        if (ret)
                goto free_rproc;
 
        qproc->version = desc->version;
-       qproc->has_alt_reset = desc->has_alt_reset;
        qproc->need_mem_protection = desc->need_mem_protection;
 
        ret = qcom_q6v5_init(&qproc->q6v5, pdev, rproc, MPSS_CRASH_REASON_SMEM,