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: 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: 73d779a03a76 ("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

authored by

Leo Yan and committed by
Suzuki K Poulose
d091c631 a8f2d480

+8 -5
+8 -5
include/linux/coresight.h
··· 481 481 * Returns: 482 482 * 483 483 * 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 485 486 * ERROR - Clock is found but failed to enable 486 487 */ 487 488 static inline struct clk *coresight_get_enable_apb_pclk(struct device *dev) 488 489 { 489 - struct clk *pclk; 490 + struct clk *pclk = NULL; 490 491 491 492 /* Firmware controls clocks for an ACPI device. */ 492 493 if (has_acpi_companion(dev)) 493 494 return NULL; 494 495 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 + } 498 501 499 502 return pclk; 500 503 }