Commit 85b6fcad authored by Linus Walleij's avatar Linus Walleij Committed by Daniel Lezcano

clocksource/drivers/ux500: Drop Ux500 custom SCHED_CLOCK

The two drivers used for Ux500 sched_clock use two Kconfig
symbols to select which of the two gets used as sched_clock.

This isn't right: the workaround is trying to make sure that
the NONSTOP timer is used for sched_clock in order to keep
that clock ticking consistently over a suspend/resume
cycle. (Otherwise sched_clock simply stops during suspend
and continues after resume).

This will notably affect any timetstamped debug prints,
so that they show the absolute number of seconds since the
system was booted and does not loose wall-clock time during
suspend and resume as if time stood still.

The real way to fix this problem is to make sched_clock
take advantage of any NONSTOP clock source on the system
and adjust accordingly, not to try to work around this by
using a different sched_clock depending on what system
we are compiling for. This can solve the problem for
everyone instead of providing a local solution.

Cc: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent bc0750e4
...@@ -163,12 +163,6 @@ config CLKSRC_NOMADIK_MTU ...@@ -163,12 +163,6 @@ config CLKSRC_NOMADIK_MTU
to multiple interrupt generating programmable to multiple interrupt generating programmable
32-bit free running decrementing counters. 32-bit free running decrementing counters.
config CLKSRC_NOMADIK_MTU_SCHED_CLOCK
bool
depends on CLKSRC_NOMADIK_MTU
help
Use the Multi Timer Unit as the sched_clock.
config CLKSRC_DBX500_PRCMU config CLKSRC_DBX500_PRCMU
bool "Clocksource PRCMU Timer" if COMPILE_TEST bool "Clocksource PRCMU Timer" if COMPILE_TEST
depends on HAS_IOMEM depends on HAS_IOMEM
...@@ -226,13 +220,6 @@ config INTEGRATOR_AP_TIMER ...@@ -226,13 +220,6 @@ config INTEGRATOR_AP_TIMER
help help
Enables support for the Integrator-ap timer. Enables support for the Integrator-ap timer.
config CLKSRC_DBX500_PRCMU_SCHED_CLOCK
bool "Clocksource PRCMU Timer sched_clock"
depends on (CLKSRC_DBX500_PRCMU && !CLKSRC_NOMADIK_MTU_SCHED_CLOCK)
default y
help
Use the always on PRCMU Timer as sched_clock
config CLKSRC_EFM32 config CLKSRC_EFM32
bool "Clocksource for Energy Micro's EFM32 SoCs" if !ARCH_EFM32 bool "Clocksource for Energy Micro's EFM32 SoCs" if !ARCH_EFM32
depends on OF && ARM && (ARCH_EFM32 || COMPILE_TEST) depends on OF && ARM && (ARCH_EFM32 || COMPILE_TEST)
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/clockchips.h> #include <linux/clockchips.h>
#include <linux/sched_clock.h>
#define RATE_32K 32768 #define RATE_32K 32768
...@@ -26,8 +25,6 @@ ...@@ -26,8 +25,6 @@
#define PRCMU_TIMER_DOWNCOUNT 0x4 #define PRCMU_TIMER_DOWNCOUNT 0x4
#define PRCMU_TIMER_MODE 0x8 #define PRCMU_TIMER_MODE 0x8
#define SCHED_CLOCK_MIN_WRAP 131072 /* 2^32 / 32768 */
static void __iomem *clksrc_dbx500_timer_base; static void __iomem *clksrc_dbx500_timer_base;
static u64 notrace clksrc_dbx500_prcmu_read(struct clocksource *cs) static u64 notrace clksrc_dbx500_prcmu_read(struct clocksource *cs)
...@@ -52,18 +49,6 @@ static struct clocksource clocksource_dbx500_prcmu = { ...@@ -52,18 +49,6 @@ static struct clocksource clocksource_dbx500_prcmu = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NONSTOP, .flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NONSTOP,
}; };
#ifdef CONFIG_CLKSRC_DBX500_PRCMU_SCHED_CLOCK
static u64 notrace dbx500_prcmu_sched_clock_read(void)
{
if (unlikely(!clksrc_dbx500_timer_base))
return 0;
return clksrc_dbx500_prcmu_read(&clocksource_dbx500_prcmu);
}
#endif
static int __init clksrc_dbx500_prcmu_init(struct device_node *node) static int __init clksrc_dbx500_prcmu_init(struct device_node *node)
{ {
clksrc_dbx500_timer_base = of_iomap(node, 0); clksrc_dbx500_timer_base = of_iomap(node, 0);
...@@ -81,9 +66,6 @@ static int __init clksrc_dbx500_prcmu_init(struct device_node *node) ...@@ -81,9 +66,6 @@ static int __init clksrc_dbx500_prcmu_init(struct device_node *node)
writel(TIMER_DOWNCOUNT_VAL, writel(TIMER_DOWNCOUNT_VAL,
clksrc_dbx500_timer_base + PRCMU_TIMER_REF); clksrc_dbx500_timer_base + PRCMU_TIMER_REF);
} }
#ifdef CONFIG_CLKSRC_DBX500_PRCMU_SCHED_CLOCK
sched_clock_register(dbx500_prcmu_sched_clock_read, 32, RATE_32K);
#endif
return clocksource_register_hz(&clocksource_dbx500_prcmu, RATE_32K); return clocksource_register_hz(&clocksource_dbx500_prcmu, RATE_32K);
} }
TIMER_OF_DECLARE(dbx500_prcmu, "stericsson,db8500-prcmu-timer-4", TIMER_OF_DECLARE(dbx500_prcmu, "stericsson,db8500-prcmu-timer-4",
......
...@@ -69,7 +69,6 @@ static u32 clk_prescale; ...@@ -69,7 +69,6 @@ static u32 clk_prescale;
static u32 nmdk_cycle; /* write-once */ static u32 nmdk_cycle; /* write-once */
static struct delay_timer mtu_delay_timer; static struct delay_timer mtu_delay_timer;
#ifdef CONFIG_CLKSRC_NOMADIK_MTU_SCHED_CLOCK
/* /*
* Override the global weak sched_clock symbol with this * Override the global weak sched_clock symbol with this
* local implementation which uses the clocksource to get some * local implementation which uses the clocksource to get some
...@@ -82,7 +81,6 @@ static u64 notrace nomadik_read_sched_clock(void) ...@@ -82,7 +81,6 @@ static u64 notrace nomadik_read_sched_clock(void)
return -readl(mtu_base + MTU_VAL(0)); return -readl(mtu_base + MTU_VAL(0));
} }
#endif
static unsigned long nmdk_timer_read_current_timer(void) static unsigned long nmdk_timer_read_current_timer(void)
{ {
...@@ -234,9 +232,7 @@ static int __init nmdk_timer_init(void __iomem *base, int irq, ...@@ -234,9 +232,7 @@ static int __init nmdk_timer_init(void __iomem *base, int irq,
return ret; return ret;
} }
#ifdef CONFIG_CLKSRC_NOMADIK_MTU_SCHED_CLOCK
sched_clock_register(nomadik_read_sched_clock, 32, rate); sched_clock_register(nomadik_read_sched_clock, 32, rate);
#endif
/* Timer 1 is used for events, register irq and clockevents */ /* Timer 1 is used for events, register irq and clockevents */
setup_irq(irq, &nmdk_timer_irq); setup_irq(irq, &nmdk_timer_irq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment