From patchwork Mon May 11 08:34:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Prakash Ranjan X-Patchwork-Id: 11540019 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 58620139F for ; Mon, 11 May 2020 08:34:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 40323208DB for ; Mon, 11 May 2020 08:34:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="PFshIi9U" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728454AbgEKIel (ORCPT ); Mon, 11 May 2020 04:34:41 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:53066 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729089AbgEKIek (ORCPT ); Mon, 11 May 2020 04:34:40 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1589186079; h=Content-Transfer-Encoding: MIME-Version: Message-Id: Date: Subject: Cc: To: From: Sender; bh=HW3utqtp4BWVdYE+diHc7x+j4fFpQqSh4h84hivsY/I=; b=PFshIi9UoCmeWxyNUM7UzovUpks8jYphi9Q1uedNasuQhfidNM3EojU20myC3JTWwXxz7lOE /jvd2aEpKTdzIK327eHv5Ytj9CJxNnbDDmi35eHPF2roe7wOncxSt/EOCD8TPc6RHEx80rn+ Pg51Y/HX6KzxMDc+lcXheWr77m4= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI1MzIzYiIsICJsaW51eC1hcm0tbXNtQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5eb90e0d.7f2e1fd9b880-smtp-out-n05; Mon, 11 May 2020 08:34:21 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id AF926C433BA; Mon, 11 May 2020 08:34:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from blr-ubuntu-311.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: saiprakash.ranjan) by smtp.codeaurora.org (Postfix) with ESMTPSA id 54B11C432C2; Mon, 11 May 2020 08:34:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 54B11C432C2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=saiprakash.ranjan@codeaurora.org From: Sai Prakash Ranjan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach Cc: Stephen Boyd , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, Sai Prakash Ranjan Subject: [PATCH] coresight: replicator: Reset replicator if context is lost Date: Mon, 11 May 2020 14:04:00 +0530 Message-Id: <20200511083400.26554-1-saiprakash.ranjan@codeaurora.org> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On some QCOM SoCs, replicators in Always-On domain loses its context as soon as the clock is disabled. Currently as a part of pm_runtime workqueue, clock is disabled after the replicator is initialized by amba_pm_runtime_suspend assuming that context is not lost which is not true for replicators with such limitations. Hence check the replicator idfilter registers in dynamic_replicator_enable() and reset again. Signed-off-by: Sai Prakash Ranjan --- More info here - https://lore.kernel.org/patchwork/patch/1231182/ --- drivers/hwtracing/coresight/coresight-replicator.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index e7dc1c31d20d..11df63f51071 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -68,6 +68,17 @@ static int dynamic_replicator_enable(struct replicator_drvdata *drvdata, int rc = 0; u32 reg; + /* + * On some QCOM SoCs with replicators in Always-On domain, disabling + * clock will result in replicator losing its context. Currently + * as a part of pm_runtime workqueue, amba_pm_runtime_suspend disables + * clock assuming the context is not lost which is not true for cases + * with hardware limitations as the above. + */ + if ((readl_relaxed(drvdata->base + REPLICATOR_IDFILTER0) == 0) && + (readl_relaxed(drvdata->base + REPLICATOR_IDFILTER1) == 0)) + dynamic_replicator_reset(drvdata); + switch (outport) { case 0: reg = REPLICATOR_IDFILTER0;