From patchwork Tue Apr 26 22:10:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 66739 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1858032qge; Tue, 26 Apr 2016 15:11:26 -0700 (PDT) X-Received: by 10.98.93.67 with SMTP id r64mr7011214pfb.133.1461708682740; Tue, 26 Apr 2016 15:11:22 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q81si964808pfa.134.2016.04.26.15.11.22; Tue, 26 Apr 2016 15:11:22 -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 S1753299AbcDZWLP (ORCPT + 29 others); Tue, 26 Apr 2016 18:11:15 -0400 Received: from mail-ig0-f181.google.com ([209.85.213.181]:37717 "EHLO mail-ig0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753243AbcDZWLL (ORCPT ); Tue, 26 Apr 2016 18:11:11 -0400 Received: by mail-ig0-f181.google.com with SMTP id g8so29089877igr.0 for ; Tue, 26 Apr 2016 15:11:10 -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=ovJAdUrXscCn7BmTk596jUfWxO6c9Zndr5J6cApx99o=; b=UENwyVbp7++jGj7fLyMqP3VOoUkYTrXR3G2OP+fmocQTiFot3Gx73rm/7Ukda8VZdu FXPJM0fMq/K6Pr6rFcDEBtrXkpwTtd1ZoAIr/VPfxIMT/btbuUkajHw6p6FXE3FbCSll miTrs3XGOHsZIllc+Od10sZ/zMgMpOv1BCoi4= 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=ovJAdUrXscCn7BmTk596jUfWxO6c9Zndr5J6cApx99o=; b=MkRqMxhL2j2rlXWug9gmuQqNlean7ZPPaiYlOyVX5LMqAixyNmp4A2H+3uqO8QsQVT j0aCiSO0jIIPTUTqOddaqZtM68kX/IfXOjx+1WDMB4g3rskgeumIZL1ap45F4RpwgFZ0 C2zLykFxX+S6YBrmMneHauLHupeXygtzm+yffxCvL9iZ1hRWR+Qc1h/AWuZbOkYBHAWm tRl1TpY8NH35CU3rNPBAuJcyKZ5oXzsd8Rr9ON3jFjtV1BejpzcfbnKxS14JD8goqHHb CfLjoHoAON99f0DXLRj/erIDB2jIadjuDjSIS3LEZe1W880nVNypKqoY5Ld+CvWSzZnh 5TvA== X-Gm-Message-State: AOPr4FW+H+d2mBnT1SC1YlN7tQ8PI4y5+P2AcTpajrJZwSako3R2W7r0EniVsnXBqHqa4we4 X-Received: by 10.50.150.68 with SMTP id ug4mr22878807igb.14.1461708670261; Tue, 26 Apr 2016 15:11:10 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id zd17sm2684818igc.8.2016.04.26.15.11.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Apr 2016 15:11:09 -0700 (PDT) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org, Suzuki.Poulose@arm.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH V4 18/18] coresight: configuring ETF in FIFO mode when acting as link Date: Tue, 26 Apr 2016 16:10:34 -0600 Message-Id: <1461708634-6327-19-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1461708634-6327-1-git-send-email-mathieu.poirier@linaro.org> References: <1461708634-6327-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 Reviewed-by: Suzuki K Poulose --- 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;