瀏覽代碼

Merge branch 'clockevents/4.20' of https://git.linaro.org/people/daniel.lezcano/linux into timers/core

Pull clockevent updates from Daniel Lezcano:

 - Prefix file names with timer-* (Daniel Lezcano)

 - Remove old CLOCKSOURCE_OF_DECLARE which was replaced by TIMER_OF_DECLARE
   (Daniel Lezcano)

 - Add reset control for dw_apb (Dinh Nguyen)

 - Add the SPDX identifiers for the renesas and sh timers (Kuninori
   Morimoto)

 - Use %pOFn instead of device_node.name (Rob Herring)

 - Fixup 64bits and clocksource width to 32b for sh_cmt (Sergei Shtylyov)

 - Add the R-Car gen3 support (Sergei Shtylyov)
Thomas Gleixner 6 年之前
父節點
當前提交
2f6affe35c
共有 1 個文件被更改,包括 12 次插入0 次删除
  1. 12 0
      drivers/clocksource/dw_apb_timer_of.c

+ 12 - 0
drivers/clocksource/dw_apb_timer_of.c

@@ -22,6 +22,7 @@
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 #include <linux/clk.h>
+#include <linux/reset.h>
 #include <linux/sched_clock.h>
 
 static void __init timer_get_base_and_rate(struct device_node *np,
@@ -29,12 +30,23 @@ static void __init timer_get_base_and_rate(struct device_node *np,
 {
 	struct clk *timer_clk;
 	struct clk *pclk;
+	struct reset_control *rstc;
 
 	*base = of_iomap(np, 0);
 
 	if (!*base)
 		panic("Unable to map regs for %pOFn", np);
 
+	/*
+	 * Reset the timer if the reset control is available, wiping
+	 * out the state the firmware may have left it
+	 */
+	rstc = of_reset_control_get(np, NULL);
+	if (!IS_ERR(rstc)) {
+		reset_control_assert(rstc);
+		reset_control_deassert(rstc);
+	}
+
 	/*
 	 * Not all implementations use a periphal clock, so don't panic
 	 * if it's not present