From patchwork Mon Apr 15 16:04:00 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: 162231 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3108180jan; Mon, 15 Apr 2019 09:08:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7dCRH5W33yeWNjkKymc7eCc1RqlwcCxRw1qLGtAK2sn7jv4unYWmDHTkOnjIdRdEQlwpy X-Received: by 2002:a63:7943:: with SMTP id u64mr70240801pgc.91.1555344504753; Mon, 15 Apr 2019 09:08:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555344504; cv=none; d=google.com; s=arc-20160816; b=YOUy6PXKV/DwFCj9zFQShdvMfzmfZCUvxg1T2BgIuYVQM+6PHIQJSQIrPJ7yO4IobP plPRDp6GQwyzXveXDcbh+aNFcu1rY57unqc/UQ3I3AU53/43JMEMcrmGCsUNiypz04rl LPzv8TB2YaewI6cxQrxQLwb9GVMD5az7T4PG5x/kHJF1Roj3zsmX+zulOHnFL/2xIFfI j9IlGIaQ285g42Q893dhCLyNzUdQwlVu/mnP8VbG2+eHQon7dCCFJGe8TkaAQXkgz1D4 TErspzFDnr85yZioG2ETS0ldzuvTTxzn/ox6bUNykz1qyNKENXXwMJXYjUxFtNfJLcSk bclQ== 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=O03WAqB5753cZrcodrYNlgqDDr6nm/65cLjzBswv5C0=; b=FGZGDgjPNfwihs32ua1yWy1+Z5a/myfjE15sK2S+HhlW900QTf2iGR2QB2Cvc5PciF wdmJaMyJLWrsHPWeTt2ZujVxZDW9NWwPPJhflAnNuxQ6qwXoEs/E3odVBlFctJKt1qf5 CtfgQyCfxSd8XtfX07+UhkKJi7R86gbzjKTewobbWkR8UozP7s4kxzLUin8XUVMPnrKo Y0aOf33so7CIz53mIU3jcoln6RKhuc13FsNr0r2NahTCqbvF1w7u3lJwzS6FuucmKP/1 NdbArwXiyXwb9vFnSEUdden0RloaLXwU+5i6gk2YBD0xNwa9QLZL3UY545dCDZ6IbRx7 rIIg== 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 m16si43259655pls.150.2019.04.15.09.08.24; Mon, 15 Apr 2019 09:08:24 -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 S1728020AbfDOQIX (ORCPT + 30 others); Mon, 15 Apr 2019 12:08:23 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:37866 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727972AbfDOQGP (ORCPT ); Mon, 15 Apr 2019 12:06:15 -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 AB3CF1A25; Mon, 15 Apr 2019 09:06:14 -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 31BFD3F68F; Mon, 15 Apr 2019 09:06:13 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org, mike.leach@linaro.org, rjw@rjwysocki.net, robert.walker@arm.com, Suzuki K Poulose Subject: [PATCH v2 17/36] coresight: tmc-etr: Rearrange probing default buffer size Date: Mon, 15 Apr 2019 17:04:00 +0100 Message-Id: <1555344260-12375-18-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555344260-12375-1-git-send-email-suzuki.poulose@arm.com> References: <1555344260-12375-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 819873a..c470b81 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -376,6 +376,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; @@ -419,16 +428,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; - } desc.pdata = pdata; desc.dev = dev;