[PATCH v13 5/5] clocksource: dw_apb_timer: Use reset array API to handle all resets

[email protected] Fri, 24 Jul 2026 16:44:37 +0800
Newsgroups org.kernel.vger.linux-pwm,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
From: Xuyang Dong <[email protected]>

timer_get_base_and_rate() only ever fetched a single, index-0 reset
control via of_reset_control_get(np, NULL), which does not consult
reset-names and always resolves to the first entry. With the binding
now allowing a second entry, a device tree that lists both lines would
leave the second entry permanently unasserted, since the driver never
touches it.

Replace it with devm_reset_control_array_get_optional_exclusive() to
fetch and control all reset lines listed in the device tree, ensuring
every line is properly asserted and deasserted rather than only the first.

Signed-off-by: Xuyang Dong <[email protected]>
---
 drivers/clocksource/dw_apb_timer_of.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index 3245eb0c602d..ffe495a8416a 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -29,9 +29,11 @@ static int __init timer_get_base_and_rate(struct device_node *np,

 	/*
 	 * Reset the timer if the reset control is available, wiping
-	 * out the state the firmware may have left it
+	 * out the state the firmware may have left it.
+	 * Use array variant to handle multiple resets (e.g., timer
+	 * and APB interface resets) if specified in the device tree.
 	 */
-	rstc = of_reset_control_get(np, NULL);
+	rstc = of_reset_control_array_get_optional_exclusive(np);
 	if (!IS_ERR(rstc)) {
 		reset_control_assert(rstc);
 		reset_control_deassert(rstc);
--
2.34.1