From patchwork Fri Apr 22 17:13:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 66470 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp838836qge; Fri, 22 Apr 2016 10:14:36 -0700 (PDT) X-Received: by 10.98.0.202 with SMTP id 193mr29726685pfa.120.1461345276446; Fri, 22 Apr 2016 10:14:36 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si8583563pat.133.2016.04.22.10.14.36; Fri, 22 Apr 2016 10:14:36 -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 S932323AbcDVROY (ORCPT + 29 others); Fri, 22 Apr 2016 13:14:24 -0400 Received: from mail-ig0-f174.google.com ([209.85.213.174]:36120 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932272AbcDVROW (ORCPT ); Fri, 22 Apr 2016 13:14:22 -0400 Received: by mail-ig0-f174.google.com with SMTP id f1so22089536igr.1 for ; Fri, 22 Apr 2016 10:14:22 -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=ySAYTMMb1aAUiu7hs485kQT/a9lcF7xo7r+sa9Fh/nA=; b=MUT4hGeiwPbZh1LSdThkwTHflIOMXBXfhFt2TPsktOIHUATaFcmjW4/qyxmoHNhKd9 BKsmQMIYRRLLXIiAt1rRbPnpp6Z8x71H6bgalyBF9XbRZjTf+uN6A3W7+XIDD5mmVk5U DoBNpmbhTu2EcbtzLqmnWkIBch9k6YSwuR0WM= 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=ySAYTMMb1aAUiu7hs485kQT/a9lcF7xo7r+sa9Fh/nA=; b=IdTbr5mDGDGagaDbguvU8HMo+wQKs4YkHjunkpnNpu5CFYyf/Lb5e5IoDLiKrNehcB DMZPMK7//SRHraMM82SGLNnZVnmGAhiorFG2AdkHZQhPzyMu46gB9z4NccrjSaSCg/1T nAgsMKN63YL5ePBkQcmwxbkDXRkMklGNScKRlIeLoUyjg7ieuT9NS1XtFs5wMwLYWMaZ gy8+WOxzLi4HEIviI7haqtp4+DuCR34HCps6Wq0Ebuc3O3yWToueILVOWWGXap7a8VEy bsV8mCwE/7PubayVGjZTmEu62YOUoYcvq87ibzIIsCczENERh1iHHxqD07ZUd+AvMLKI ULpA== X-Gm-Message-State: AOPr4FXOAOcnmL/f8gOpSZhw+cheG58b4jDnQQbloYs5/722+eL5dO6atwFx/gcYGZsyMH1k X-Received: by 10.50.13.74 with SMTP id f10mr5796485igc.55.1461345261409; Fri, 22 Apr 2016 10:14:21 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id vg8sm1975886igb.15.2016.04.22.10.14.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Apr 2016 10:14:20 -0700 (PDT) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org, Suzuki.Poulose@arm.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH V3 02/18] coresight: tmc: waiting for TMCReady bit before programming Date: Fri, 22 Apr 2016 11:13:59 -0600 Message-Id: <1461345255-11758-3-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1461345255-11758-1-git-send-email-mathieu.poirier@linaro.org> References: <1461345255-11758-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 According to the TRM before programming the TMC in circular buffer mode (and that for any configuration, ETB, ETR, ETF), the TMCReady bit in the status register has to be set. This patch adds a check to make sure the state machine is in a state where it can be configured, and complains otherwise. Signed-off-by: Mathieu Poirier Reviewed-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-tmc.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.5.0 diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 3f646e29a99b..66fa7736d12f 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -180,6 +180,9 @@ static void tmc_etb_enable_hw(struct tmc_drvdata *drvdata) CS_UNLOCK(drvdata->base); + /* Wait for TMCSReady bit to be set */ + tmc_wait_for_tmcready(drvdata); + writel_relaxed(TMC_MODE_CIRCULAR_BUFFER, drvdata->base + TMC_MODE); writel_relaxed(TMC_FFCR_EN_FMT | TMC_FFCR_EN_TI | TMC_FFCR_FON_FLIN | TMC_FFCR_FON_TRIG_EVT | @@ -201,6 +204,9 @@ static void tmc_etr_enable_hw(struct tmc_drvdata *drvdata) CS_UNLOCK(drvdata->base); + /* Wait for TMCSReady bit to be set */ + tmc_wait_for_tmcready(drvdata); + writel_relaxed(drvdata->size / 4, drvdata->base + TMC_RSZ); writel_relaxed(TMC_MODE_CIRCULAR_BUFFER, drvdata->base + TMC_MODE); @@ -230,6 +236,9 @@ static void tmc_etf_enable_hw(struct tmc_drvdata *drvdata) { CS_UNLOCK(drvdata->base); + /* Wait for TMCSReady bit to be set */ + tmc_wait_for_tmcready(drvdata); + writel_relaxed(TMC_MODE_HARDWARE_FIFO, drvdata->base + TMC_MODE); writel_relaxed(TMC_FFCR_EN_FMT | TMC_FFCR_EN_TI, drvdata->base + TMC_FFCR);