Skip to content

Commit 5483624

Browse files
Leo-YanSuzuki K Poulose
authored andcommitted
coresight: catu: Support atclk
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: fcacb5c ("coresight: Introduce support for Coresight Address Translation Unit") Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com> Tested-by: James Clark <james.clark@linaro.org> Signed-off-by: Leo Yan <leo.yan@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20250731-arm_cs_fix_clock_v4-v6-2-1dfe10bb3f6f@arm.com
1 parent 8a79026 commit 5483624

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

drivers/hwtracing/coresight/coresight-catu.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,10 @@ static int __catu_probe(struct device *dev, struct resource *res)
520520
struct coresight_platform_data *pdata = NULL;
521521
void __iomem *base;
522522

523+
drvdata->atclk = devm_clk_get_optional_enabled(dev, "atclk");
524+
if (IS_ERR(drvdata->atclk))
525+
return PTR_ERR(drvdata->atclk);
526+
523527
catu_desc.name = coresight_alloc_device_name(&catu_devs, dev);
524528
if (!catu_desc.name)
525529
return -ENOMEM;
@@ -668,18 +672,26 @@ static int catu_runtime_suspend(struct device *dev)
668672
{
669673
struct catu_drvdata *drvdata = dev_get_drvdata(dev);
670674

671-
if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk))
672-
clk_disable_unprepare(drvdata->pclk);
675+
clk_disable_unprepare(drvdata->atclk);
676+
clk_disable_unprepare(drvdata->pclk);
677+
673678
return 0;
674679
}
675680

676681
static int catu_runtime_resume(struct device *dev)
677682
{
678683
struct catu_drvdata *drvdata = dev_get_drvdata(dev);
684+
int ret;
679685

680-
if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk))
681-
clk_prepare_enable(drvdata->pclk);
682-
return 0;
686+
ret = clk_prepare_enable(drvdata->pclk);
687+
if (ret)
688+
return ret;
689+
690+
ret = clk_prepare_enable(drvdata->atclk);
691+
if (ret)
692+
clk_disable_unprepare(drvdata->pclk);
693+
694+
return ret;
683695
}
684696
#endif
685697

drivers/hwtracing/coresight/coresight-catu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262

6363
struct catu_drvdata {
6464
struct clk *pclk;
65+
struct clk *atclk;
6566
void __iomem *base;
6667
struct coresight_device *csdev;
6768
int irq;

0 commit comments

Comments
 (0)