Skip to content

Commit d091c63

Browse files
Leo-YanSuzuki K Poulose
authored andcommitted
coresight: Avoid enable programming clock duplicately
The programming clock is enabled by AMBA bus driver before a dynamic probe. As a result, a CoreSight driver may redundantly enable the same clock. To avoid this, add a check for device type and skip enabling the programming clock for AMBA devices. The returned NULL pointer will be tolerated by the drivers. Fixes: 73d779a ("coresight: etm4x: Change etm4_platform_driver driver for MMIO devices") 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-6-1dfe10bb3f6f@arm.com
1 parent a8f2d48 commit d091c63

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

include/linux/coresight.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,20 +481,23 @@ static inline bool is_coresight_device(void __iomem *base)
481481
* Returns:
482482
*
483483
* clk - Clock is found and enabled
484-
* NULL - Clock is controlled by firmware (ACPI device only)
484+
* NULL - Clock is controlled by firmware (ACPI device only) or when managed
485+
* by the AMBA bus driver instead
485486
* ERROR - Clock is found but failed to enable
486487
*/
487488
static inline struct clk *coresight_get_enable_apb_pclk(struct device *dev)
488489
{
489-
struct clk *pclk;
490+
struct clk *pclk = NULL;
490491

491492
/* Firmware controls clocks for an ACPI device. */
492493
if (has_acpi_companion(dev))
493494
return NULL;
494495

495-
pclk = devm_clk_get_optional_enabled(dev, "apb_pclk");
496-
if (!pclk)
497-
pclk = devm_clk_get_optional_enabled(dev, "apb");
496+
if (!dev_is_amba(dev)) {
497+
pclk = devm_clk_get_optional_enabled(dev, "apb_pclk");
498+
if (!pclk)
499+
pclk = devm_clk_get_optional_enabled(dev, "apb");
500+
}
498501

499502
return pclk;
500503
}

0 commit comments

Comments
 (0)