From patchwork Tue Apr 11 09:10:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 97228 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1717212qgd; Tue, 11 Apr 2017 02:12:07 -0700 (PDT) X-Received: by 10.98.40.5 with SMTP id o5mr59458609pfo.262.1491901927485; Tue, 11 Apr 2017 02:12:07 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si16262383pln.75.2017.04.11.02.12.07; Tue, 11 Apr 2017 02:12:07 -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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754492AbdDKJMD (ORCPT + 23 others); Tue, 11 Apr 2017 05:12:03 -0400 Received: from mail-pg0-f43.google.com ([74.125.83.43]:36457 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754288AbdDKJKu (ORCPT ); Tue, 11 Apr 2017 05:10:50 -0400 Received: by mail-pg0-f43.google.com with SMTP id g2so118028223pge.3 for ; Tue, 11 Apr 2017 02:10:49 -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=Jde2CHX1g0uypd3aO1ltF5+KCcj4RdLtjA1RaqMyqso=; b=jZ2SV/snEIu0Sw4mqIL+7aguQsPuMVNnNFPRv7Dm/m5ipOXSV4Ai/M9LjMCQ5N2nRO yBP5MyEMekN+rlK5swV0GkXz8oSEVHp7rkCxZGh1jzPTUnqq8S2Ty+OGHuhOb4kj8j/m KRofJrgSPXNdajm5WzmoDDjIKUYzkFLTbPGBo= 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; bh=Jde2CHX1g0uypd3aO1ltF5+KCcj4RdLtjA1RaqMyqso=; b=rCF7xa5VqmjFtT11jMYG4bDTO4QB/aTMROl6iNs8GUMaiqB2NYFt8RwnlZfIsWVtDs oC2J9OhSbqwO4wZqaMUcddP4np3CLhyNKyVvdKNHTz2Aqj5QiSr0qLRZgxRrPdlmkrq6 C6uKOnLo9+mUroag/5yFN2kZ2jJpq1+CN22BIRQeYlzwylltROMzRn5jue69nVEVLveD NN+6aNTwdmO4G1N6E+NOlDPjlqSSznaeXC0c3RcVUfye5SJE1pfzr90QIyKzjXtUkXTx LKsAuMf90mTNXpSxDRLY2eCXngLPHTBYQUtzpB4cq3Uy5gHOf0qOsMXT7E4Kb5dlDJfS iQyA== X-Gm-Message-State: AFeK/H0t0IKZZxMHCy1VAzjyst7IgNMwgGLhZD1ao6s6ezRKGrX1XrPBjv7+utBM9g087+2l X-Received: by 10.98.137.68 with SMTP id v65mr45366291pfd.125.1491901849455; Tue, 11 Apr 2017 02:10:49 -0700 (PDT) Received: from localhost.localdomain (li1563-109.members.linode.com. [139.162.83.109]) by smtp.gmail.com with ESMTPSA id r77sm8196394pfe.105.2017.04.11.02.10.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Apr 2017 02:10:48 -0700 (PDT) From: Leo Yan To: Mathieu Poirier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan , Mike Leach , Suzuki K Poulose Subject: [PATCH RFC 2/4] coresight: tmc: set read pointer before dump RAM Date: Tue, 11 Apr 2017 17:10:27 +0800 Message-Id: <1491901829-18477-3-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491901829-18477-1-git-send-email-leo.yan@linaro.org> References: <1491901829-18477-1-git-send-email-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When dump RAM, we need set read pointer so can make sure every time read the consistent content. If the RAM is full by checking status register (STS), so set the read pointer to same value with write pointer, otherwise set read point to 0 so can read from the start of RAM. Cc: Mathieu Poirier Cc: Mike Leach Cc: Suzuki K Poulose Signed-off-by: Leo Yan --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index 6150dac..43cfeaa 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -43,10 +43,28 @@ static void tmc_etb_enable_hw(struct tmc_drvdata *drvdata) static void tmc_etb_dump_hw(struct tmc_drvdata *drvdata) { + u32 write_ptr, status; char *bufp; u32 read_data; int i; + write_ptr = readl_relaxed(drvdata->base + TMC_RWP); + + /* + * Get a hold of the status register and see if a wrap around + * has occurred. If so adjust things accordingly. + */ + status = readl_relaxed(drvdata->base + TMC_STS); + if (status & TMC_STS_FULL) + /* Tell the HW the reading start point */ + writel_relaxed(write_ptr, drvdata->base + TMC_RRP); + else + /* + * In case this is not first time to read ETB RAM, + * always write 0 for reading pointer. + */ + writel_relaxed(0x0, drvdata->base + TMC_RRP); + bufp = drvdata->buf; drvdata->len = 0; while (1) {