From patchwork Tue Apr 12 17:54:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 65644 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2059633qge; Tue, 12 Apr 2016 10:55:48 -0700 (PDT) X-Received: by 10.98.31.79 with SMTP id f76mr6468109pff.92.1460483747379; Tue, 12 Apr 2016 10:55:47 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f13si11424375pap.154.2016.04.12.10.55.46; Tue, 12 Apr 2016 10:55:47 -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 S966227AbcDLRz1 (ORCPT + 29 others); Tue, 12 Apr 2016 13:55:27 -0400 Received: from mail-pf0-f180.google.com ([209.85.192.180]:34649 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966211AbcDLRzX (ORCPT ); Tue, 12 Apr 2016 13:55:23 -0400 Received: by mail-pf0-f180.google.com with SMTP id c20so17813559pfc.1 for ; Tue, 12 Apr 2016 10:55: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=Ov+0Q6zJLWdpziRbGTE9rfoZuezIceCWzjF3DnP8tHE=; b=VFj+2CzcVNNDLzftbzCUKHeI+fpLMsUXrdQYZVW4216V9SoF4z5aFu6OvcexolOa9Z Ln7ed/5DBFdCsLa7I6f+bxh6jCPx+8Xqzi6jcsXgFXTRFhgOSDrSevAwKVMDHgWF2GTd kfYRL0INFLaN5djSnDkm0MyOJdWcewqwAfp9s= 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=Ov+0Q6zJLWdpziRbGTE9rfoZuezIceCWzjF3DnP8tHE=; b=PKhx3Pr9Wu7rnoMKV4zVFEsYCiN4J+eQx/1VzwNNFbGG7ipoKL+6Wwt/z6FPKJMNMX TDSxH4zMJERLyQZ9sNTHG5GbhU/+2P/wfhAF05ZY5MSU06+xG17+Cz/oWiiKTFky8rcW tXwp/cP7ZFnuIjrtQB8uz7DPv527HMHY9jqmvpHxYF6KAj0nqN7PSGbolpYhEOWIJc/Y b/J1MAPiWBOYo8Pq4s3GdaiF9kKlIoJqs/iaSqlIKtCx3nH2LL6p5VOPDPtGHYPl+XXd XQh37fNG6joisM0a0m2dB73PEWcoXgiZ1rxCu8wWm4dmFj8g/U4qpLaCEUXxTHcBLmN0 q1hg== X-Gm-Message-State: AOPr4FWs+4TJ4lHHNRXlDqDbG4yjkyAqPhr04zw0DcGBcMeRxyRxMuGjgZEKe499Q+6W92vK X-Received: by 10.98.72.83 with SMTP id v80mr6426349pfa.113.1460483721943; Tue, 12 Apr 2016 10:55:21 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id p189sm24633204pfb.51.2016.04.12.10.55.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Apr 2016 10:55: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 V2 15/15] coresight: configuring ETF in FIFO mode when acting as link Date: Tue, 12 Apr 2016 11:54:52 -0600 Message-Id: <1460483692-25061-16-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460483692-25061-1-git-send-email-mathieu.poirier@linaro.org> References: <1460483692-25061-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 When part of a path but not identified as a sink, the EFT has to be configured as a link and placed in HW FIFO mode. As such when enabling a path, call the right configuration function based on the role the ETF if playing in this trace run. Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) -- 2.5.0 diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 2ea5961092c1..bba9f3d653c9 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -257,15 +257,27 @@ static void coresight_disable_source(struct coresight_device *csdev) void coresight_disable_path(struct list_head *path) { + u32 type; struct coresight_node *nd; struct coresight_device *csdev, *parent, *child; list_for_each_entry(nd, path, link) { csdev = nd->csdev; + type = csdev->type; - switch (csdev->type) { + /* + * ETF devices are tricky... They can be a link or a sink, + * depending on how they are configured. If an ETF has been + * "activated" it will be configured as a sink, otherwise + * go ahead with the link configuration. + */ + if (type == CORESIGHT_DEV_TYPE_LINKSINK) + type = (csdev == coresight_get_sink(path)) ? + CORESIGHT_DEV_TYPE_SINK : + CORESIGHT_DEV_TYPE_LINK; + + switch (type) { case CORESIGHT_DEV_TYPE_SINK: - case CORESIGHT_DEV_TYPE_LINKSINK: coresight_disable_sink(csdev); break; case CORESIGHT_DEV_TYPE_SOURCE: @@ -286,15 +298,27 @@ int coresight_enable_path(struct list_head *path, u32 mode) { int ret = 0; + u32 type; struct coresight_node *nd; struct coresight_device *csdev, *parent, *child; list_for_each_entry_reverse(nd, path, link) { csdev = nd->csdev; + type = csdev->type; + + /* + * ETF devices are tricky... They can be a link or a sink, + * depending on how they are configured. If an ETF has been + * "activated" it will be configured as a sink, otherwise + * go ahead with the link configuration. + */ + if (type == CORESIGHT_DEV_TYPE_LINKSINK) + type = (csdev == coresight_get_sink(path)) ? + CORESIGHT_DEV_TYPE_SINK : + CORESIGHT_DEV_TYPE_LINK; - switch (csdev->type) { + switch (type) { case CORESIGHT_DEV_TYPE_SINK: - case CORESIGHT_DEV_TYPE_LINKSINK: ret = coresight_enable_sink(csdev, mode); if (ret) goto err;