From patchwork Tue May 7 10:52:40 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: 163490 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:81:0:0:0:0 with SMTP id l1csp1183950ilm; Tue, 7 May 2019 03:54:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQVJWA7w8B3oaXFiBN7ncOAS3+gv0BSnQdGSI8saT7W9E52EVupnAlcgRD1DqmBpH0P9DR X-Received: by 2002:a62:5ec2:: with SMTP id s185mr41458863pfb.16.1557226443021; Tue, 07 May 2019 03:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557226443; cv=none; d=google.com; s=arc-20160816; b=EgFkYQ6QioefnnyVXXs9i0HXZG6eDMGuz4f56yFE14Du5T/MUmKHm64d3Qw6ZufAzX h9pYx1CJcieIHRNyAigfNphjcdmGy0O0maI/b+yxI9rt2Fzw5IHHFlfZ0EBIimKeXw2r IvybHdHfDM3jHLJMdQYGaz+GTy0GWt8Ur97bH3uj9eYYMqIU/8DO1hxItAqHlrld9sVf kQ+UMeEp8L2J/96Sf6N/8kq1tI5X6KfkvPxpJmi3AIp9fpSM5GjGCEBG63miaaQqgbdP StabRaPwfvWE/u6jBZncNBhph6wDXVQDFby/A7y7I3W1UQXXHubEB0jvTRClBHhT0y2E YCyg== 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=5yLMiJ6Htp0svVoYjbWUGEi4NOLAK90fjo7/ZHOaSo0=; b=FGL1s4H99GRm/x5y8o8MfEZlstUSEhsaa3oEScxYwuZETQSGiX7LS59ax6iejpNUgv 7yAHqprjy+DJyq6sdcmtVvFEBGSYGtIFTb1LLNr4iLYrugE2QgQ1o/j26OG0ovC9pkmF XtvgUKOL6L0vSa9FcVdn6FcSIjom7TIVIf9vka2tmZSf5sIqaBky5skGwGGP9HZzYsCZ FaptK4QySXyUjTBCYLpYwKgyTdI8cKISk6rVB6HXxAZBlJ5WyU/ZZ1IUdtSQFYlDEavg VyKl3Nz71CW8KLUWYsEHHPKvZYzg28wNqHQKwmuPX2qSGwGsGiHcAwboNxm3BrpepNz2 lz0A== 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 b1si460197pgg.392.2019.05.07.03.54.02; Tue, 07 May 2019 03:54:03 -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 S1727078AbfEGKyB (ORCPT + 30 others); Tue, 7 May 2019 06:54:01 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50192 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726976AbfEGKyA (ORCPT ); Tue, 7 May 2019 06:54:00 -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 C4361169E; Tue, 7 May 2019 03:53:59 -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 913713F5AF; Tue, 7 May 2019 03:53:58 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, coresight@lists.linaro.org, rjw@rjwysocki.net, mathieu.poirier@linaro.org, Suzuki K Poulose Subject: [PATCH v3 13/30] coresight: tmc-etr: Rearrange probing default buffer size Date: Tue, 7 May 2019 11:52:40 +0100 Message-Id: <1557226378-10131-14-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557226378-10131-1-git-send-email-suzuki.poulose@arm.com> References: <1557226378-10131-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. Reviewed-by: 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 3b39f43..9c5e615 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -378,6 +378,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; @@ -423,16 +432,10 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) /* This device is not associated with a session */ drvdata->pid = -1; - 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; - } desc.pdata = pdata; desc.dev = dev;