Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp56685rdd; Wed, 22 Nov 2023 09:16:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7TJbgXk7VtnihXcbLSIS9xaM4wg0mSH9JLQCDEurbyPCeJKfD3mP9R5tR2p+27nNv2HNH X-Received: by 2002:a17:902:6806:b0:1cf:6737:5e6c with SMTP id h6-20020a170902680600b001cf67375e6cmr2538905plk.29.1700673361765; Wed, 22 Nov 2023 09:16:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700673361; cv=none; d=google.com; s=arc-20160816; b=pae93MSOj6GY1tEP6vcrmjYn4Cjnd80GjM6ww47MDH3/rJNoSO0Q1ifAbwygIp/ReK 8Rs/DayqpKwkyBKictIosEANKubtVnJQomn0YH6GqlgFNN2x2k5WevWexH6jK6gOJSpC TN+yZGYAhRxP35ULoh9088nWiRafV26m7UKgcQt+Z3iFUANxGnfT047jRxOcrO3KrkJg E2Wk5LLX+DUKwylVyjWDfUIcrMJgQtDToWJbqQMB5CdrrjsCvP04/0Zlb3x1AR+8I1pd YEtXbwJWx5jBUSmZFBDeMGWCg+Zzh3bwJ5HqO2Brg5CEVkH2Zp/PpJnL6YEXovMVTlDu hlzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=K43G7Uot1Qd4vjaZPaf61MsP5yyiI7UflAMre5I/6+Q=; fh=Sv23i1Z/IpoMyGDx/3hB3WEMPrB6x7hrpjQAlfv0e8Q=; b=yyavgMfrhMajcX6QRC7Bh16lLuGVF8fWgg3yXFzBu144bdFjJia5iuw7cB0pwIiw68 999iGnSm3/KPsiExls4J8KPmZ4ZshG4T/jdqSFuZLAczNrTsHi1wrPndKGoUXKLMVwuN KPJf1yWzdVkOAkMKCEudc/UCpC5eBDyyY6NxtEX8KksuIwZvC3hh+EVev3JiY6L3w9qI wJ4U2PuVfMM4943kOT/V3gX2iEHYFyRZQrmmJ4fVoKcaFwTGFJu7189C4fm7rHC7vKj+ /YobLqSIdAavGpWYO+KysniHtY1cEvrO680wFdY7qXbGqgkBhlBLAzy/DwUofMydmSRQ bgAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id g2-20020a170902868200b001cf50ef35besi9876190plo.51.2023.11.22.09.16.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 09:16:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0F44E82663E0; Wed, 22 Nov 2023 09:15:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343980AbjKVRPT (ORCPT + 99 others); Wed, 22 Nov 2023 12:15:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234695AbjKVRPS (ORCPT ); Wed, 22 Nov 2023 12:15:18 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8EB901A5; Wed, 22 Nov 2023 09:15:14 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 230001FB; Wed, 22 Nov 2023 09:16:01 -0800 (PST) Received: from [10.57.42.32] (unknown [10.57.42.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ABA273F73F; Wed, 22 Nov 2023 09:15:12 -0800 (PST) Message-ID: <4de2b664-b7c8-4216-bb57-6f887bd751d2@arm.com> Date: Wed, 22 Nov 2023 17:15:11 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 5/7] coresight: tmc: Move ACPI support from AMBA driver to platform driver Content-Language: en-GB To: Sudeep Holla , Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, Lorenzo Pieralisi , Mike Leach , James Clark , Maxime Coquelin , Alexandre Torgue , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-stm32@st-md-mailman.stormreply.com References: <20231027072943.3418997-1-anshuman.khandual@arm.com> <20231027072943.3418997-6-anshuman.khandual@arm.com> From: Suzuki K Poulose In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 22 Nov 2023 09:15:47 -0800 (PST) On 22/11/2023 17:04, Sudeep Holla wrote: > On Fri, Oct 27, 2023 at 12:59:41PM +0530, Anshuman Khandual wrote: >> Add support for the tmc devices in the platform driver, which can then be >> used on ACPI based platforms. This change would now allow runtime power >> management for ACPI based systems. The driver would try to enable the APB >> clock if available. >> >> Cc: Lorenzo Pieralisi >> Cc: Sudeep Holla >> Cc: Suzuki K Poulose >> Cc: Mike Leach >> Cc: James Clark >> Cc: linux-acpi@vger.kernel.org >> Cc: linux-arm-kernel@lists.infradead.org >> Cc: linux-kernel@vger.kernel.org >> Cc: coresight@lists.linaro.org >> Signed-off-by: Anshuman Khandual >> --- >> drivers/acpi/arm64/amba.c | 2 - >> .../hwtracing/coresight/coresight-tmc-core.c | 127 +++++++++++++++--- >> drivers/hwtracing/coresight/coresight-tmc.h | 1 + >> 3 files changed, 113 insertions(+), 17 deletions(-) > > [...] > >> diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c >> index 7ec5365e2b64..618bc0b7a1a5 100644 >> --- a/drivers/hwtracing/coresight/coresight-tmc-core.c >> +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c > > [...] > >> @@ -573,9 +579,9 @@ static void tmc_shutdown(struct amba_device *adev) >> spin_unlock_irqrestore(&drvdata->spinlock, flags); >> } >> >> -static void tmc_remove(struct amba_device *adev) >> +static void __tmc_remove(struct device *dev) >> { >> - struct tmc_drvdata *drvdata = dev_get_drvdata(&adev->dev); >> + struct tmc_drvdata *drvdata = dev_get_drvdata(dev); >> >> /* >> * Since misc_open() holds a refcount on the f_ops, which is >> @@ -586,6 +592,11 @@ static void tmc_remove(struct amba_device *adev) >> coresight_unregister(drvdata->csdev); >> } >> >> +static void tmc_remove(struct amba_device *adev) >> +{ >> + __tmc_remove(&adev->dev); >> +} >> + >> static const struct amba_id tmc_ids[] = { >> CS_AMBA_ID(0x000bb961), >> /* Coresight SoC 600 TMC-ETR/ETS */ >> @@ -613,6 +624,92 @@ static struct amba_driver tmc_driver = { >> >> module_amba_driver(tmc_driver); >> >> +static int tmc_platform_probe(struct platform_device *pdev) >> +{ >> + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> + struct tmc_drvdata *drvdata; >> + int ret = 0; >> + >> + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); >> + if (!drvdata) >> + return -ENOMEM; >> + >> + drvdata->pclk = coresight_get_enable_apb_pclk(&pdev->dev); >> + if (IS_ERR(drvdata->pclk)) >> + return -ENODEV; >> + > > --->8 >> + if (res) { >> + drvdata->base = devm_ioremap_resource(&pdev->dev, res); >> + if (IS_ERR(drvdata->base)) { >> + clk_put(drvdata->pclk); >> + return PTR_ERR(drvdata->base); >> + } >> + } >> + > --- > > You need drop the above hunk as _tmc_probe() already takes care of that. > This is the root cause for the issue I reported in the other thread. Also > sorry for the confusion, I had to refer to coresight-tmc-core.c and post > the patch to unify module_init/exit but completely mixed up the file/patch > and referred coresight-tpiu-core.c instead as that patch was dealing with > it. Thank you Sudeep for getting to the bottom of the problem ! Suzuki >