Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DE97E70719 for ; Thu, 21 Sep 2023 11:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t5QcyiNEQ44yJ+e3W2m43gNSCmvXRMFVvQoTFLO/pxM=; b=GjbyDpCUVi6C0h tMaBOio2ZGYHzeAda7u9b/2I0fwInG/4xJJSQEI1h7H4Q1t+5hxEpIplTTRRq8zHSucmRU/FHMRLs s7l0gMGjDkV8+HRHNiBkpVqkhEwDlGmAHILvDvxPQ5WZFyEEoncEFo6ncb3elXmZUxyrRs6o2UbrY MALO+JQkI4pfC9zgF7oMovRY+M76sPvHjYdKE/py5Hixru1PPeEhrpoqmF3jwYiY4rSC82O67H/1w /mh9dWp7sP7GmHJIQd/BnNSiBR9XdTmLRWjOVbBP4VJ0I2J3rxdDiMapx1xa5kcSXiSibpKThBuEl VsaGpNpwf1Awcq7GTkFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjHaG-005t8T-1e; Thu, 21 Sep 2023 11:11:00 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjHaC-005t7w-1s for linux-arm-kernel@lists.infradead.org; Thu, 21 Sep 2023 11:10:58 +0000 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 2F2921570; Thu, 21 Sep 2023 04:11:30 -0700 (PDT) Received: from [10.1.197.1] (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 392EC3F5A1; Thu, 21 Sep 2023 04:10:52 -0700 (PDT) Message-ID: <6a72387f-2749-0e27-000f-aeec265cb789@arm.com> Date: Thu, 21 Sep 2023 12:10:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [RFC RESEND 1/7] coresight: replicator: Move ACPI support from AMBA driver to platform driver Content-Language: en-US To: Anshuman Khandual , linux-arm-kernel@lists.infradead.org Cc: James Clark , Mike Leach , coresight@lists.linaro.org, linux-kernel@vger.kernel.org References: <20230921042040.1334641-1-anshuman.khandual@arm.com> <20230921042040.1334641-2-anshuman.khandual@arm.com> From: Suzuki K Poulose In-Reply-To: <20230921042040.1334641-2-anshuman.khandual@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230921_041056_738104_3DEEE7C0 X-CRM114-Status: GOOD ( 23.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 21/09/2023 05:20, Anshuman Khandual wrote: > Add support for the dynamic replicator device in the platform driver, which > can then be used on ACPI based platforms. This change would now allow > runtime power management for repliacator devices on ACPI based systems. > > The driver would try to enable the APB clock if available. Also, rename the > code to reflect the fact that it now handles both static and dynamic > replicators. > > Signed-off-by: Anshuman Khandual > --- > drivers/acpi/arm64/amba.c | 1 - > .../coresight/coresight-replicator.c | 44 ++++++++++++------- > 2 files changed, 27 insertions(+), 18 deletions(-) > > diff --git a/drivers/acpi/arm64/amba.c b/drivers/acpi/arm64/amba.c > index 60be8ee1dbdc..ac59ce50de07 100644 > --- a/drivers/acpi/arm64/amba.c > +++ b/drivers/acpi/arm64/amba.c > @@ -27,7 +27,6 @@ static const struct acpi_device_id amba_id_list[] = { > {"ARMHC503", 0}, /* ARM CoreSight Debug */ > {"ARMHC979", 0}, /* ARM CoreSight TPIU */ > {"ARMHC97C", 0}, /* ARM CoreSight SoC-400 TMC, SoC-600 ETF/ETB */ > - {"ARMHC98D", 0}, /* ARM CoreSight Dynamic Replicator */ > {"ARMHC9CA", 0}, /* ARM CoreSight CATU */ > {"ARMHC9FF", 0}, /* ARM CoreSight Dynamic Funnel */ > {"", 0}, > diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c > index b6be73034996..a18d5e8fcba1 100644 > --- a/drivers/hwtracing/coresight/coresight-replicator.c > +++ b/drivers/hwtracing/coresight/coresight-replicator.c > @@ -38,6 +38,7 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator"); > struct replicator_drvdata { > void __iomem *base; > struct clk *atclk; > + struct clk *pclk; > struct coresight_device *csdev; > spinlock_t spinlock; > bool check_idfilter_val; > @@ -243,6 +244,10 @@ static int replicator_probe(struct device *dev, struct resource *res) > return ret; > } > > + drvdata->pclk = coresight_get_enable_apb_pclk(dev); > + if (IS_ERR(drvdata->pclk)) > + return -ENODEV; > + > /* > * Map the device base for dynamic-replicator, which has been > * validated by AMBA core > @@ -301,16 +306,16 @@ static int replicator_remove(struct device *dev) > return 0; > } > > -static int static_replicator_probe(struct platform_device *pdev) > +static int replicator_platform_probe(struct platform_device *pdev) > { > + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > int ret; > > pm_runtime_get_noresume(&pdev->dev); > pm_runtime_set_active(&pdev->dev); > pm_runtime_enable(&pdev->dev); > > - /* Static replicators do not have programming base */ > - ret = replicator_probe(&pdev->dev, NULL); > + ret = replicator_probe(&pdev->dev, res); > > if (ret) { > pm_runtime_put_noidle(&pdev->dev); > @@ -320,7 +325,7 @@ static int static_replicator_probe(struct platform_device *pdev) > return ret; > } > > -static int static_replicator_remove(struct platform_device *pdev) > +static int replicator_platform_remove(struct platform_device *pdev) > { > replicator_remove(&pdev->dev); > pm_runtime_disable(&pdev->dev); > @@ -335,6 +340,8 @@ static int replicator_runtime_suspend(struct device *dev) > if (drvdata && !IS_ERR(drvdata->atclk)) > clk_disable_unprepare(drvdata->atclk); > > + if (drvdata && !IS_ERR(drvdata->pclk)) !IS_ERR_OR_NULL() ? If we don't have pclk, drvdata->pclk is always NULL Same applies throughout the series. Suzuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel