@@ -255,6 +255,7 @@ config CLKSRC_PISTACHIO
bool "Clocksource for Pistachio SoC" if COMPILE_TEST
depends on HAS_IOMEM
select TIMER_OF
+ select PERSISTENT_CLOCK
help
Enables the clocksource for the Pistachio SoC.
@@ -20,6 +20,7 @@
#include <linux/mfd/syscon.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/persistent_clock.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/sched_clock.h>
@@ -212,6 +213,8 @@ static int __init pistachio_clksrc_of_init(struct device_node *node)
raw_spin_lock_init(&pcs_gpt.lock);
sched_clock_register(pistachio_read_sched_clock, 32, rate);
+ persistent_clock_init_and_register(pistachio_read_sched_clock,
+ CLOCKSOURCE_MASK(32), rate, 0);
return clocksource_register_hz(&pcs_gpt.cs, rate);
}
TIMER_OF_DECLARE(pistachio_gptimer, "img,pistachio-gptimer",
Since the timer on pistachio platform is always available, we can register it as one persistent clock to compensate the suspend time for the OS time. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> --- drivers/clocksource/Kconfig | 1 + drivers/clocksource/time-pistachio.c | 3 +++ 2 files changed, 4 insertions(+)