From patchwork Thu Jul 16 17:57:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11668227 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 E9B676C1 for ; Thu, 16 Jul 2020 17:59:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B931B2070E for ; Thu, 16 Jul 2020 17:59:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2VPd8hvZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yjwxZ6UU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B931B2070E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bcZRSq6RN9+Df9IjlxgMzU9eAAJl1/swY8Puvk9yuk4=; b=2VPd8hvZMkl4D4U0BNjPeko3J JPDN3Jslf9kro2KeWwF60bVUs6yLWMCO0BXO9BUdM+e6o0Fp+C5gyoCEgHwC9Q2VvXDo+bCJvy20Q +2DBAPgD35dBDNdnbo9g7Wg7uBv0bkQlnXooQdHmKJsXBeeUfAsFc5COtIGUYTyOLTAVS1CpNTiR0 KpqV6WF8XqY/2qKOv9pfmzDwM4lepwaWALnrI23eHkO/cFld+3Z3IMIRXHe1sCRpM1l9klajr6m6O SRkbkb6R1aZ72KibQa+4BQGU2uMI30EBREu3RdRQ0Q61TKaXSH7uFtupZYp3z8cpv5vf4wLbCJegG YLPKH59yw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw89A-0003LL-QQ; Thu, 16 Jul 2020 17:58:16 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw88n-0003Bk-OF for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2020 17:57:55 +0000 Received: by mail-pl1-x642.google.com with SMTP id b9so4196002plx.6 for ; Thu, 16 Jul 2020 10:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3Ql0KmK96dvPiqRbLM5Bw9OLrn39h71WcEuMmlwtztU=; b=yjwxZ6UUH0o8ssNX/8M1k6CPkS0ZBKcUmlvsLEkFzAewJoHpGilYnKNeJIZcX/Lb8u jdk25rxMRyzeG4jBtBGeElz0c7pEuiXKmigpey2tNOPshQ1uqe8Qmx3i9LHyQYz+RH9s PkC9rNs+XMR199+VwQpRxA3F8GbTcsMlA/4FQm8PGM3iIiER7H70GaB9f930sl11Uz72 yPYshKCggeZ/rAZ+O39bpzQzA+4xrFFznyDojJEPqwWr2CyRlEgRm1I901Z7iLymcAof jr4xA0n/zY5cXq/CU54mSUMGuB3KXAMINsadAGHgBQUQOba2hAydLT3vhluMUYomGuq3 gyIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3Ql0KmK96dvPiqRbLM5Bw9OLrn39h71WcEuMmlwtztU=; b=nWvh7MvfcbBGN/SGB1pGZICK9Oy/GeEUsnLTwlfuq10wYFfGcC6fpCjUeYRjzR46aQ d2LhdqjVHb+PSFGZFaFFpczFUnrmJuNIj8HinSoh5V9MdY7IKZPuALH/XWxwFzZbVNdG ih27GVqkWeRJCHUQEUuLIooop27hspKLF0MXI2mwm0TEXsvklI+qLqtwnnAcDfKpUS2E 9GR/j7nmQzuchooSL4KHOFhJJVbnLI1B7/1gF87eRhRkCX9lhYH/gH/vPxF7NH4L35gX AYJUy6b+AvmmA6DOj+vuv60GndW9p7VZsM9SYFQlsvfmfVZ3o93+emT9t3Anv7it8rlB B8kQ== X-Gm-Message-State: AOAM533z0H3OGMedhYQFy8qd+igdFz6Kb2riwQR5HXP9UmBFaiR6eow6 DSj7ilsIq+gsfUQepg5wXud9XA== X-Google-Smtp-Source: ABdhPJzhol99fFgQHIrdGDLqAS089tJU2cdWbM++HQO2pS/fVCHTHPisB6US1icqGaBffIPndYwUgg== X-Received: by 2002:a17:90a:304d:: with SMTP id q13mr6009872pjl.73.1594922271706; Thu, 16 Jul 2020 10:57:51 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id 83sm5473253pfu.60.2020.07.16.10.57.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 10:57:51 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 03/17] coresight: etm4x: Add support to skip trace unit power up Date: Thu, 16 Jul 2020 11:57:32 -0600 Message-Id: <20200716175746.3338735-4-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200716175746.3338735-1-mathieu.poirier@linaro.org> References: <20200716175746.3338735-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200716_135753_858258_4311856A X-CRM114-Status: GOOD ( 14.65 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saiprakash.ranjan@codeaurora.org, suzuki.poulose@arm.com, vulab@iscas.ac.cn, tingwei@codeaurora.org, andriy.shevchenko@linux.intel.com, linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Tingwei Zhang On some Qualcomm Technologies Inc. SoCs like SC7180, there exists a hardware errata where the APSS (Application Processor SubSystem)/CPU watchdog counter is stopped when the trace unit power up ETM register is set (TRCPDCR.PU = 1). Since the ETMs share the same power domain as that of respective CPU cores, they are powered on when the CPU core is powered on. So we can skip powering up of trace unit after checking for this errata via new property called "qcom,skip-power-up". Signed-off-by: Tingwei Zhang Co-developed-by: Sai Prakash Ranjan Signed-off-by: Sai Prakash Ranjan Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 27 ++++++++++++------- drivers/hwtracing/coresight/coresight-etm4x.h | 3 +++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 0c35cd5e0d1d..2290f41f0074 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -196,12 +196,14 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) writel_relaxed(config->vmid_mask0, drvdata->base + TRCVMIDCCTLR0); writel_relaxed(config->vmid_mask1, drvdata->base + TRCVMIDCCTLR1); - /* - * Request to keep the trace unit powered and also - * emulation of powerdown - */ - writel_relaxed(readl_relaxed(drvdata->base + TRCPDCR) | TRCPDCR_PU, - drvdata->base + TRCPDCR); + if (!drvdata->skip_power_up) { + /* + * Request to keep the trace unit powered and also + * emulation of powerdown + */ + writel_relaxed(readl_relaxed(drvdata->base + TRCPDCR) | + TRCPDCR_PU, drvdata->base + TRCPDCR); + } /* Enable the trace unit */ writel_relaxed(1, drvdata->base + TRCPRGCTLR); @@ -476,10 +478,12 @@ static void etm4_disable_hw(void *info) CS_UNLOCK(drvdata->base); - /* power can be removed from the trace unit now */ - control = readl_relaxed(drvdata->base + TRCPDCR); - control &= ~TRCPDCR_PU; - writel_relaxed(control, drvdata->base + TRCPDCR); + if (!drvdata->skip_power_up) { + /* power can be removed from the trace unit now */ + control = readl_relaxed(drvdata->base + TRCPDCR); + control &= ~TRCPDCR_PU; + writel_relaxed(control, drvdata->base + TRCPDCR); + } control = readl_relaxed(drvdata->base + TRCPRGCTLR); @@ -1468,6 +1472,9 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) return -ENOMEM; } + if (fwnode_property_present(dev_fwnode(dev), "qcom,skip-power-up")) + drvdata->skip_power_up = true; + /* Validity for the resource is already checked by the AMBA core */ base = devm_ioremap_resource(dev, res); if (IS_ERR(base)) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index 4a695bf90582..72c9a55e67df 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -407,6 +407,8 @@ struct etmv4_save_state { * @config: structure holding configuration parameters. * @save_state: State to be preserved across power loss * @state_needs_restore: True when there is context to restore after PM exit + * @skip_power_up: Indicates if an implementation can skip powering up + * the trace unit. */ struct etmv4_drvdata { void __iomem *base; @@ -454,6 +456,7 @@ struct etmv4_drvdata { struct etmv4_config config; struct etmv4_save_state *save_state; bool state_needs_restore; + bool skip_power_up; }; /* Address comparator access types */