diff mbox

[RESEND,v4,6/7] remoteproc: qcom: Modify stop routine to limit MX current for v56 1.5

Message ID 1479981638-32069-7-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. 24, 2016, 10 a.m. UTC
For v56 1.5.0 Mx current need to be limited during restart.

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

Comments

Bjorn Andersson Dec. 9, 2016, 4:42 a.m. UTC | #1
On Thu 24 Nov 02:00 PST 2016, Avaneesh Kumar Dwivedi wrote:

> For v56 1.5.0 Mx current need to be limited during restart.
> 
> Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
> ---
>  drivers/remoteproc/qcom_q6v5_pil.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c
> index 7ea2f53..3e3ed09 100644
> --- a/drivers/remoteproc/qcom_q6v5_pil.c
> +++ b/drivers/remoteproc/qcom_q6v5_pil.c
> @@ -785,7 +785,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;

One variable per line, please.

>  
>  	qproc->running = false;
>  
> @@ -803,6 +803,22 @@ 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->hexagon_ver & 0x2) {

Compare with == and use the enum.

> +		/*
> +		 * 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.
> +		 */

I'm not sure if you answered this (or if I forgot to ask), is this
something we only want to do on the latest version?

> +		ret = clk_prepare_enable(devm_clk_get(qproc->dev, "iface"));

"iface" is part of your active set, so it should still be enabled.

> +		if (!ret) {
> +			val = readl_relaxed(
> +				qproc->reg_base + QDSP6SS_PWR_CTL_REG);

Please use non-_relaxed versions.

> +			val |= (Q6SS_CLAMP_IO | QDSP6v56_CLAMP_WL |
> +				QDSP6v56_CLAMP_QMC_MEM);

No need for the parenthesis around this expression.

> +			writel_relaxed(val,
> +				qproc->reg_base + QDSP6SS_PWR_CTL_REG);
> +		}
> +	}

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dwivedi, Avaneesh Kumar (avani) Dec. 12, 2016, 1:04 p.m. UTC | #2
On 12/9/2016 10:12 AM, Bjorn Andersson wrote:
> On Thu 24 Nov 02:00 PST 2016, Avaneesh Kumar Dwivedi wrote:
>
>> For v56 1.5.0 Mx current need to be limited during restart.
>>
>> Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
>> ---
>>   drivers/remoteproc/qcom_q6v5_pil.c | 18 +++++++++++++++++-
>>   1 file changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c
>> index 7ea2f53..3e3ed09 100644
>> --- a/drivers/remoteproc/qcom_q6v5_pil.c
>> +++ b/drivers/remoteproc/qcom_q6v5_pil.c
>> @@ -785,7 +785,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;
> One variable per line, please.
OK,
>
>>   
>>   	qproc->running = false;
>>   
>> @@ -803,6 +803,22 @@ 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->hexagon_ver & 0x2) {
> Compare with == and use the enum.
Ok,
>
>> +		/*
>> +		 * 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.
>> +		 */
> I'm not sure if you answered this (or if I forgot to ask), is this
> something we only want to do on the latest version?
Yes applicable only to hexagon on msm8996.
>
>> +		ret = clk_prepare_enable(devm_clk_get(qproc->dev, "iface"));
> "iface" is part of your active set, so it should still be enabled.
Right, thanks for pointing this out.
>
>> +		if (!ret) {
>> +			val = readl_relaxed(
>> +				qproc->reg_base + QDSP6SS_PWR_CTL_REG);
> Please use non-_relaxed versions.
OK.
>
>> +			val |= (Q6SS_CLAMP_IO | QDSP6v56_CLAMP_WL |
>> +				QDSP6v56_CLAMP_QMC_MEM);
> No need for the parenthesis around this expression.
OK.
>
>> +			writel_relaxed(val,
>> +				qproc->reg_base + QDSP6SS_PWR_CTL_REG);
>> +		}
>> +	}
> Regards,
> Bjorn
diff mbox

Patch

diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c
index 7ea2f53..3e3ed09 100644
--- a/drivers/remoteproc/qcom_q6v5_pil.c
+++ b/drivers/remoteproc/qcom_q6v5_pil.c
@@ -785,7 +785,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;
 
@@ -803,6 +803,22 @@  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->hexagon_ver & 0x2) {
+		/*
+		 * 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);
+		}
+	}
 	reset_control_assert(qproc->mss_restart);
 	q6v5_clk_disable(qproc);
 	q6v5_regulator_disable(qproc);