From patchwork Thu Aug 25 21:19:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 74752 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1049899qga; Thu, 25 Aug 2016 14:28:23 -0700 (PDT) X-Received: by 10.66.199.5 with SMTP id jg5mr2805882pac.137.1472160503438; Thu, 25 Aug 2016 14:28:23 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n79si17333141pfi.15.2016.08.25.14.28.22; Thu, 25 Aug 2016 14:28:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757941AbcHYV2O (ORCPT + 27 others); Thu, 25 Aug 2016 17:28:14 -0400 Received: from mail-it0-f54.google.com ([209.85.214.54]:37621 "EHLO mail-it0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756332AbcHYV1J (ORCPT ); Thu, 25 Aug 2016 17:27:09 -0400 Received: by mail-it0-f54.google.com with SMTP id f6so113179121ith.0 for ; Thu, 25 Aug 2016 14:27:08 -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; bh=FdIeCCF69q193Tg76BWf8mKRejKVLyxBh8mG7jDQndA=; b=B/DaTmk3tIW47RigPKiJGkoF6S8w/fByi6RF9iDwqWC/qpl7W9RquoO844Do32/uyW SIH0bIdEpjz5t9rg5/vznfjjN0+NbYCRwq4ak3rc//QU1XCBKJv050yu2nHPniJucCog FLvxcSNlcKNkLU61z9hoiugsaW582z+dH2eT0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FdIeCCF69q193Tg76BWf8mKRejKVLyxBh8mG7jDQndA=; b=Zn47jzSKILo+rGwQqC7sbXz1E2DIkP0v41f3KhVkxRmCL/rRHOlHHAye8/W07hd4Pu I8tOKbFWXdPYwCoI9+k+M0v5b3tJjLnpCvz3MTE/jRVLHQsuR2Eis3Vb87XTybY5vAtB wn+yQwTmm0dQji46X4Px/jCi37uRauBBYTeLVNARwLycFt4SbUqsgi98FO9p/ElNgiuy kQ1x80IekEqpbOZ5lNHcGSaitynXJlae2DvO4nJs38X2d3C+dJnkDC+mzYgj14CWFJjp /k2Wk3fMrCiKejoti3ttqMDkYvbCsE2y56mRB37An1xxeDlW3wONd16avpBWRCcyqA4c eK7Q== X-Gm-Message-State: AEkoouuSGFd3eHXNzgiZw6AhdNlawM3CDMmrtodPd54B/CFdzfbiqGNKCVJhLX2z9GMrlLrU X-Received: by 10.36.233.196 with SMTP id f187mr7776548ith.19.1472159993941; Thu, 25 Aug 2016 14:19:53 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id o5sm14506120ith.20.2016.08.25.14.19.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Aug 2016 14:19:53 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 18/28] coresight: etm4x: request to retain power to the trace unit when active Date: Thu, 25 Aug 2016 15:19:08 -0600 Message-Id: <1472159958-5981-19-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472159958-5981-1-git-send-email-mathieu.poirier@linaro.org> References: <1472159958-5981-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sudeep Holla The Coresight ETMv4 architecture provides a way to request to keep the power to the trace unit. This might help to collect the traces without the need to disable the CPU power management(entering/exiting deeper idle states). Trace PowerDown Control Register provides powerup request bit which when set requests the system to retain power to the trace unit and emulate the powerdown request. Typically, a trace unit drives a signal to the power controller to request that the trace unit core power domain is powered up. However, if the trace unit and the CPU are in the same power domain then the implementation might combine the trace unit power up status with a signal from the CPU. This patch requests to retain power to the trace unit when active and to remove when inactive. Note this change will only request but the behaviour depends on the implementation. However, it matches the exact behaviour expected when the external debugger is connected with respect to CPU power states. Cc: Mathieu Poirier Signed-off-by: Sudeep Holla Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 12 ++++++++++++ drivers/hwtracing/coresight/coresight-etm4x.h | 3 +++ 2 files changed, 15 insertions(+) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index b3bde2aec2b9..c8c7829f7046 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -164,6 +164,13 @@ static void etm4_enable_hw(void *info) 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); + /* Enable the trace unit */ writel_relaxed(1, drvdata->base + TRCPRGCTLR); @@ -294,6 +301,11 @@ 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); + control = readl_relaxed(drvdata->base + TRCPRGCTLR); /* EN, bit[0] Trace unit enable bit */ diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index 5359c5197c1d..2629954429a1 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -183,6 +183,9 @@ #define TRCSTATR_IDLE_BIT 0 #define ETM_DEFAULT_ADDR_COMP 0 +/* PowerDown Control Register bits */ +#define TRCPDCR_PU BIT(3) + /* secure state access levels */ #define ETM_EXLEVEL_S_APP BIT(8) #define ETM_EXLEVEL_S_OS BIT(9)