From patchwork Wed Mar 20 18:49:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160719 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp626634jan; Wed, 20 Mar 2019 11:51:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0hJHNz170Lf2ixU1ue2IbyPYLP7FCbpGdTRED4O1oQdmbjXDbnlctZwXMCe7nJaVeGIUv X-Received: by 2002:a63:d5f:: with SMTP id 31mr8765661pgn.274.1553107892965; Wed, 20 Mar 2019 11:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107892; cv=none; d=google.com; s=arc-20160816; b=wgY7ngeP085vb7VaUp4gvCdPAfR95S5PazdO7KRVT/1oersHK1L7GOUuvG2ivINp01 3nqyI8jLHRKBxHh4Lk4JqNSYBF+oYnL8AWUI7AqV2MMGS3FSZoQ1zs9xVuUMu7uYzeZE oeTUg1vZC6hWujWV4sK39YNP5x9kFrf+Kq6RErvmVZmqedP8fHcdDh7jqk8qDt6q+6MR YIAIBGcGvlZYA0Jp9uukfLb45vZ+LS1Bs7ZISHzxRbkfHffOcdtwwqy6X3qJG1bi3qw3 vsKJ53iW5CwNSA6Uf2P+wpFRQnLZjpOpqZvnaz9OGYfQ5rjAMNrPVcIcZL+PZ5lI9aBT SP1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=shPP2bRXZP7qc6cHj18+430j0gDjnu+KdqwzoyLpcio=; b=jrpuwY5RrfLbH2JLXt6b2irbgLrfJ9LfFKVoKtg++V3Q06ZCGittL37cImFlkTj0Vj Sh0a2n7r7kHydfU819ctd0D0G8of/+TfzDzczdU6T+o6FLPvoAi5t2JSCSrFDiaUa8ry k680PAWvbMALK3fQqieIcD16CQ9eIGYc2loefQpaT1m8tOdu6tDOHf+CCFYe+Tov21Zo B49UUdPfLiMCbHNUEZ3TNWuZGh6YBGvMM/0OrIYBhV9VmifTZDHLUqdzEUvG07noL2Z5 cjpnRVDZ7z3hWjG0PE/teLMmbJv58rw0pd1ep9eVnR3OXNTPo+oVWHJqddDyc8iMm5fp 5IaQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d125si2310397pfd.206.2019.03.20.11.51.32; Wed, 20 Mar 2019 11:51:32 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727780AbfCTSvb (ORCPT + 31 others); Wed, 20 Mar 2019 14:51:31 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:44978 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727626AbfCTSuj (ORCPT ); Wed, 20 Mar 2019 14:50:39 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 026AE168F; Wed, 20 Mar 2019 11:50:39 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7D0EE3F59C; Wed, 20 Mar 2019 11:50:37 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 17/25] coresight: tmc-etr: Rearrange probing default buffer size Date: Wed, 20 Mar 2019 18:49:34 +0000 Message-Id: <1553107783-3340-18-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we are about to refactor the platform specific handling, make the default buffer size probing generic. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-tmc.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 9e7ff83..7ce3427 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -375,6 +375,15 @@ static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps) return rc; } +static u32 tmc_etr_get_default_buffer_size(struct device *dev) +{ + u32 size; + + if (fwnode_property_read_u32(dev->fwnode, "arm,buffer-size", &size)) + size = SZ_1M; + return size; +} + static int tmc_probe(struct amba_device *adev, const struct amba_id *id) { int ret = 0; @@ -418,16 +427,10 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) drvdata->config_type = BMVAL(devid, 6, 7); drvdata->memwidth = tmc_get_memwidth(devid); - if (drvdata->config_type == TMC_CONFIG_TYPE_ETR) { - if (np) - ret = of_property_read_u32(np, - "arm,buffer-size", - &drvdata->size); - if (ret) - drvdata->size = SZ_1M; - } else { + if (drvdata->config_type == TMC_CONFIG_TYPE_ETR) + drvdata->size = tmc_etr_get_default_buffer_size(dev); + else drvdata->size = readl_relaxed(drvdata->base + TMC_RSZ) * 4; - } pm_runtime_put(&adev->dev);