linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Mike Leach <mike.leach@linaro.org>,
	James Clark <james.clark@arm.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	coresight@lists.linaro.org,
	linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH 5/7] coresight: tmc: Move ACPI support from AMBA driver to platform driver
Date: Wed, 22 Nov 2023 17:04:10 +0000	[thread overview]
Message-ID: <ZV40itsgT5OSJmdC@bogus> (raw)
In-Reply-To: <20231027072943.3418997-6-anshuman.khandual@arm.com>

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 <lpieralisi@kernel.org>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: James Clark <james.clark@arm.com>
> 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 <anshuman.khandual@arm.com>
> ---
>  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.

-- 
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-11-22 17:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-27  7:29 [PATCH 0/7] Subject: coresight: Move remaining AMBA ACPI devices into platform driver Anshuman Khandual
2023-10-27  7:29 ` [PATCH 1/7] coresight: replicator: Move ACPI support from AMBA driver to " Anshuman Khandual
2023-10-28 14:03   ` kernel test robot
2023-10-27  7:29 ` [PATCH 2/7] coresight: funnel: " Anshuman Khandual
2023-10-27  7:29 ` [PATCH 3/7] coresight: catu: " Anshuman Khandual
2023-10-27  7:29 ` [PATCH 4/7] coresight: tpiu: " Anshuman Khandual
2023-11-15 13:53   ` James Clark
2023-11-22  7:02     ` Anshuman Khandual
2023-11-22 11:21       ` Sudeep Holla
2023-11-22 12:10         ` Sudeep Holla
2023-10-27  7:29 ` [PATCH 5/7] coresight: tmc: " Anshuman Khandual
2023-11-22 17:04   ` Sudeep Holla [this message]
2023-11-22 17:15     ` Suzuki K Poulose
2023-11-28  7:09     ` Anshuman Khandual
2023-10-27  7:29 ` [PATCH 6/7] coresight: stm: " Anshuman Khandual
2023-10-28 13:22   ` kernel test robot
2023-10-27  7:29 ` [PATCH 7/7] coresight: debug: " Anshuman Khandual
2023-10-28 13:42   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZV40itsgT5OSJmdC@bogus \
    --to=sudeep.holla@arm.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=anshuman.khandual@arm.com \
    --cc=coresight@lists.linaro.org \
    --cc=james.clark@arm.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=lpieralisi@kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mike.leach@linaro.org \
    --cc=suzuki.poulose@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).