From nobody Thu Dec 18 15:07:11 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAD822135D5 for ; Thu, 27 Mar 2025 11:38:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743075508; cv=none; b=dB+8NkH0mN8Akwgvvca/3Ahwo9zZL609OWNwNtK2fHVddUB8dsr8VNt40dGE6YBBJW9xTUcxcUyDw78jh8FT2440UCiVU/c61itjs7huC6G/fyRCwHHz1F+yXo/f++GBX2kjgq7BvLqPrrcOlMQsY4gbWdNkPC8erYF5Ex3YzzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743075508; c=relaxed/simple; bh=itkkaJhyszhA1DIkIuNqSodlLH84RYccKaVwNe4k7DQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Aa8gAEr5ruCfyX/cJKbgDrHH8s36Q1i7eM0eTnolN0RgTlw5pLWDublZVl/tYu+TeJ1MjZzEFHK7S40qUdoSU+HXEqgEWguCuSETFKl0yBWYZR2hmSI98PT3NQByxgeFmHeVnhRgPIVj2kIupr6nu22+uFN1Fn4zQlqo2l9cbnw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 49E1A1063; Thu, 27 Mar 2025 04:38:31 -0700 (PDT) Received: from e132581.cambridge.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2EE163F58B; Thu, 27 Mar 2025 04:38:24 -0700 (PDT) From: Leo Yan To: Suzuki K Poulose , Mike Leach , James Clark , Anshuman Khandual , Alexander Shishkin , Maxime Coquelin , Alexandre Torgue , Greg Kroah-Hartman , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Cc: Leo Yan Subject: [PATCH v1 2/9] coresight: catu: Support atclk Date: Thu, 27 Mar 2025 11:37:56 +0000 Message-Id: <20250327113803.1452108-3-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250327113803.1452108-1-leo.yan@arm.com> References: <20250327113803.1452108-1-leo.yan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The atclk is an optional clock for the CoreSight CATU, but the driver misses to initialize it. This change enables atclk in probe of the CATU driver, and dynamically control the clock during suspend and resume. The checks for driver data and clocks in suspend and resume are not needed, remove them. Add error handling in the resume function. Fixes: fcacb5c154ba ("coresight: Introduce support for Coresight Address Tr= anslation Unit") Signed-off-by: Leo Yan Reviewed-by: Anshuman Khandual --- drivers/hwtracing/coresight/coresight-catu.c | 22 +++++++++++++++++----- drivers/hwtracing/coresight/coresight-catu.h | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtraci= ng/coresight/coresight-catu.c index fa170c966bc3..9fcda5e49253 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -513,6 +513,10 @@ static int __catu_probe(struct device *dev, struct res= ource *res) struct coresight_platform_data *pdata =3D NULL; void __iomem *base; =20 + drvdata->atclk =3D devm_clk_get_optional_enabled(dev, "atclk"); + if (IS_ERR(drvdata->atclk)) + return PTR_ERR(drvdata->atclk); + catu_desc.name =3D coresight_alloc_device_name(&catu_devs, dev); if (!catu_desc.name) return -ENOMEM; @@ -659,18 +663,26 @@ static int catu_runtime_suspend(struct device *dev) { struct catu_drvdata *drvdata =3D dev_get_drvdata(dev); =20 - if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk)) - clk_disable_unprepare(drvdata->pclk); + clk_disable_unprepare(drvdata->atclk); + clk_disable_unprepare(drvdata->pclk); + return 0; } =20 static int catu_runtime_resume(struct device *dev) { struct catu_drvdata *drvdata =3D dev_get_drvdata(dev); + int ret; =20 - if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk)) - clk_prepare_enable(drvdata->pclk); - return 0; + ret =3D clk_prepare_enable(drvdata->pclk); + if (ret) + return ret; + + ret =3D clk_prepare_enable(drvdata->atclk); + if (ret) + clk_disable_unprepare(drvdata->pclk); + + return ret; } #endif =20 diff --git a/drivers/hwtracing/coresight/coresight-catu.h b/drivers/hwtraci= ng/coresight/coresight-catu.h index 141feac1c14b..2fe31fed6cf1 100644 --- a/drivers/hwtracing/coresight/coresight-catu.h +++ b/drivers/hwtracing/coresight/coresight-catu.h @@ -62,6 +62,7 @@ =20 struct catu_drvdata { struct clk *pclk; + struct clk *atclk; void __iomem *base; struct coresight_device *csdev; int irq; --=20 2.34.1