Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: fcacb5c154ba ("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

authored by

Leo Yan and committed by
Suzuki K Poulose
5483624e 8a790269

+18 -5
+17 -5
drivers/hwtracing/coresight/coresight-catu.c
··· 520 520 struct coresight_platform_data *pdata = NULL; 521 521 void __iomem *base; 522 522 523 + drvdata->atclk = devm_clk_get_optional_enabled(dev, "atclk"); 524 + if (IS_ERR(drvdata->atclk)) 525 + return PTR_ERR(drvdata->atclk); 526 + 523 527 catu_desc.name = coresight_alloc_device_name(&catu_devs, dev); 524 528 if (!catu_desc.name) 525 529 return -ENOMEM; ··· 672 668 { 673 669 struct catu_drvdata *drvdata = dev_get_drvdata(dev); 674 670 675 - if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk)) 676 - clk_disable_unprepare(drvdata->pclk); 671 + clk_disable_unprepare(drvdata->atclk); 672 + clk_disable_unprepare(drvdata->pclk); 673 + 677 674 return 0; 678 675 } 679 676 680 677 static int catu_runtime_resume(struct device *dev) 681 678 { 682 679 struct catu_drvdata *drvdata = dev_get_drvdata(dev); 680 + int ret; 683 681 684 - if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk)) 685 - clk_prepare_enable(drvdata->pclk); 686 - return 0; 682 + ret = clk_prepare_enable(drvdata->pclk); 683 + if (ret) 684 + return ret; 685 + 686 + ret = clk_prepare_enable(drvdata->atclk); 687 + if (ret) 688 + clk_disable_unprepare(drvdata->pclk); 689 + 690 + return ret; 687 691 } 688 692 #endif 689 693
+1
drivers/hwtracing/coresight/coresight-catu.h
··· 62 62 63 63 struct catu_drvdata { 64 64 struct clk *pclk; 65 + struct clk *atclk; 65 66 void __iomem *base; 66 67 struct coresight_device *csdev; 67 68 int irq;