summaryrefslogtreecommitdiffstats
path: root/drivers/clocksource
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-04-25 11:48:57 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-04-25 12:34:48 +0200
commiteec09d7b9edc8f740c78d545d918ecd8f6efba4f (patch)
treeb4d91cf974500ccec63abeea59c995b5a881a44b /drivers/clocksource
parent8194c6a8aab370fe38a9b9ca41a9965ad9de4c57 (diff)
downloadbarebox-eec09d7b9edc8f740c78d545d918ecd8f6efba4f.tar.gz
barebox-eec09d7b9edc8f740c78d545d918ecd8f6efba4f.tar.xz
clocksource: assign non-zero priorities to all clocksources
Most barebox clocksources have a zero priority and if multiple of them exist, but no higher priority ones, the first to call init_clock wins. Some supported boards like the Raspberry Pi additionally depended on initcall ordering to favor one zero-priority clocksource over another. With the move to deep probe and with Commit b641580deb8c ("of: platform: Ensure timers are probed early"), device tree blob iteration order could now dictate which clocksource is ultimately used. This led to a 20 times slower clock source being chosen on the Raspberry Pi, because the ARM architected timer was taken instead of the bcm2835 timer. Fix the root cause by assigning priorities to all clocksource drivers. Priorities chosen are: 50: device_initcall 60: coredevice_initcall 70: postcore_initcall 80: core_initcall These priorities are all below 100, which was previously the lowest positive priority and as they are positive, they win against the dummy clocksource. This should ensure no priority inversion happens. Fixes: b641580deb8c ("of: platform: Ensure timers are probed early") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220425094857.674044-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/amba-sp804.c1
-rw-r--r--drivers/clocksource/arm_architected_timer.c1
-rw-r--r--drivers/clocksource/arm_global_timer.c1
-rw-r--r--drivers/clocksource/arm_smp_twd.c1
-rw-r--r--drivers/clocksource/armv7m_systick.c1
-rw-r--r--drivers/clocksource/bcm2835.c1
-rw-r--r--drivers/clocksource/clps711x.c1
-rw-r--r--drivers/clocksource/digic.c1
-rw-r--r--drivers/clocksource/dw_apb_timer.c1
-rw-r--r--drivers/clocksource/efi.c1
-rw-r--r--drivers/clocksource/kvx_timer.c1
-rw-r--r--drivers/clocksource/mvebu.c1
-rw-r--r--drivers/clocksource/nomadik.c1
-rw-r--r--drivers/clocksource/orion.c1
-rw-r--r--drivers/clocksource/rk_timer.c1
-rw-r--r--drivers/clocksource/timer-atmel-pit.c1
-rw-r--r--drivers/clocksource/timer-imx-gpt.c1
-rw-r--r--drivers/clocksource/timer-ti-32k.c1
-rw-r--r--drivers/clocksource/timer-ti-dm.c1
-rw-r--r--drivers/clocksource/uemd.c1
20 files changed, 20 insertions, 0 deletions
diff --git a/drivers/clocksource/amba-sp804.c b/drivers/clocksource/amba-sp804.c
index a22e567301..fcb2b0254b 100644
--- a/drivers/clocksource/amba-sp804.c
+++ b/drivers/clocksource/amba-sp804.c
@@ -26,6 +26,7 @@ static struct clocksource sp804_clksrc = {
.read = sp804_read,
.shift = 20,
.mask = CLOCKSOURCE_MASK(32),
+ .priority = 60,
};
static int sp804_probe(struct amba_device *dev, const struct amba_id *id)
diff --git a/drivers/clocksource/arm_architected_timer.c b/drivers/clocksource/arm_architected_timer.c
index 16e40a1a0b..d5948fe948 100644
--- a/drivers/clocksource/arm_architected_timer.c
+++ b/drivers/clocksource/arm_architected_timer.c
@@ -19,6 +19,7 @@ static struct clocksource cs = {
.read = arm_arch_clocksource_read,
.mask = CLOCKSOURCE_MASK(64),
.shift = 0,
+ .priority = 70,
};
static int arm_arch_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/arm_global_timer.c b/drivers/clocksource/arm_global_timer.c
index f18c6e4152..65bfca3558 100644
--- a/drivers/clocksource/arm_global_timer.c
+++ b/drivers/clocksource/arm_global_timer.c
@@ -60,6 +60,7 @@ static struct clocksource cs = {
.read = arm_global_clocksource_read,
.mask = CLOCKSOURCE_MASK(64),
.shift = 0,
+ .priority = 70,
};
static int arm_global_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/arm_smp_twd.c b/drivers/clocksource/arm_smp_twd.c
index bc0c4a00b2..1ad754bb2b 100644
--- a/drivers/clocksource/arm_smp_twd.c
+++ b/drivers/clocksource/arm_smp_twd.c
@@ -35,6 +35,7 @@ static struct clocksource smp_twd_clksrc = {
.read = smp_twd_read,
.shift = 20,
.mask = CLOCKSOURCE_MASK(32),
+ .priority = 60,
};
#define SMP_TWD_MAX_FREQ (25 *1000 * 1000)
diff --git a/drivers/clocksource/armv7m_systick.c b/drivers/clocksource/armv7m_systick.c
index 5f9222c50b..16d89c23bd 100644
--- a/drivers/clocksource/armv7m_systick.c
+++ b/drivers/clocksource/armv7m_systick.c
@@ -34,6 +34,7 @@ static struct clocksource cs = {
.read = armv7m_systick_clocksource_read,
.mask = CLOCKSOURCE_MASK(24),
.shift = 0,
+ .priority = 70,
};
static int armv7m_systick_probe(struct device_d *dev)
diff --git a/drivers/clocksource/bcm2835.c b/drivers/clocksource/bcm2835.c
index 5134b34915..d84341fc40 100644
--- a/drivers/clocksource/bcm2835.c
+++ b/drivers/clocksource/bcm2835.c
@@ -28,6 +28,7 @@ static uint64_t stc_read_cycles(void)
static struct clocksource bcm2835_stc = {
.read = stc_read_cycles,
.mask = CLOCKSOURCE_MASK(32),
+ .priority = 80,
};
static int bcm2835_cs_probe(struct device_d *dev)
diff --git a/drivers/clocksource/clps711x.c b/drivers/clocksource/clps711x.c
index cd09960478..1fe7f6c891 100644
--- a/drivers/clocksource/clps711x.c
+++ b/drivers/clocksource/clps711x.c
@@ -19,6 +19,7 @@ static uint64_t clps711x_cs_read(void)
static struct clocksource clps711x_cs = {
.read = clps711x_cs_read,
.mask = CLOCKSOURCE_MASK(16),
+ .priority = 60,
};
static int clps711x_cs_probe(struct device_d *dev)
diff --git a/drivers/clocksource/digic.c b/drivers/clocksource/digic.c
index 1a335582b7..234985aece 100644
--- a/drivers/clocksource/digic.c
+++ b/drivers/clocksource/digic.c
@@ -26,6 +26,7 @@ static uint64_t digic_cs_read(void)
static struct clocksource digic_cs = {
.read = digic_cs_read,
.mask = CLOCKSOURCE_MASK(16),
+ .priority = 60,
};
static int digic_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/dw_apb_timer.c b/drivers/clocksource/dw_apb_timer.c
index aef4f16d14..251089cf7e 100644
--- a/drivers/clocksource/dw_apb_timer.c
+++ b/drivers/clocksource/dw_apb_timer.c
@@ -94,6 +94,7 @@ static struct clocksource dw_apb_clksrc = {
.read = dw_apb_clocksource_read,
.mask = CLOCKSOURCE_MASK(32),
.shift = 0,
+ .priority = 50,
};
static int dw_apb_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/efi.c b/drivers/clocksource/efi.c
index 5c8c5fd46b..9df5226573 100644
--- a/drivers/clocksource/efi.c
+++ b/drivers/clocksource/efi.c
@@ -93,6 +93,7 @@ static struct clocksource efi_cs = {
.mask = CLOCKSOURCE_MASK(64),
.shift = 0,
.init = efi_cs_init,
+ .priority = 80,
};
static int efi_cs_probe(struct device_d *dev)
diff --git a/drivers/clocksource/kvx_timer.c b/drivers/clocksource/kvx_timer.c
index 2a05d8deed..259755eacd 100644
--- a/drivers/clocksource/kvx_timer.c
+++ b/drivers/clocksource/kvx_timer.c
@@ -21,6 +21,7 @@ static struct clocksource kvx_clksrc = {
.read = kvx_pm_read,
.mask = CLOCKSOURCE_MASK(64),
.shift = 0,
+ .priority = 70,
};
static int kvx_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/mvebu.c b/drivers/clocksource/mvebu.c
index eb5246e4e7..d3214955dc 100644
--- a/drivers/clocksource/mvebu.c
+++ b/drivers/clocksource/mvebu.c
@@ -42,6 +42,7 @@ static struct clocksource cs = {
.read = mvebu_clocksource_read,
.mask = CLOCKSOURCE_MASK(32),
.shift = 10,
+ .priority = 70,
};
static int mvebu_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/nomadik.c b/drivers/clocksource/nomadik.c
index d71d9da6b8..7cf10352ea 100644
--- a/drivers/clocksource/nomadik.c
+++ b/drivers/clocksource/nomadik.c
@@ -71,6 +71,7 @@ static struct clocksource nmdk_clksrc = {
.read = nmdk_read_timer,
.shift = 20,
.mask = CLOCKSOURCE_MASK(32),
+ .priority = 60,
};
static void nmdk_timer_reset(void)
diff --git a/drivers/clocksource/orion.c b/drivers/clocksource/orion.c
index d40b09e5de..4a56849800 100644
--- a/drivers/clocksource/orion.c
+++ b/drivers/clocksource/orion.c
@@ -31,6 +31,7 @@ static struct clocksource clksrc = {
.read = orion_clocksource_read,
.mask = CLOCKSOURCE_MASK(32),
.shift = 10,
+ .priority = 70,
};
static int orion_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/rk_timer.c b/drivers/clocksource/rk_timer.c
index 5cc8d32b60..e941030771 100644
--- a/drivers/clocksource/rk_timer.c
+++ b/drivers/clocksource/rk_timer.c
@@ -32,6 +32,7 @@ static struct clocksource rkcs = {
.read = rockchip_get_ticks,
.mask = CLOCKSOURCE_MASK(32),
.shift = 10,
+ .priority = 80,
};
static int rockchip_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index bbbc81788c..a133e384d7 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -36,6 +36,7 @@ static struct clocksource cs = {
.read = at91sam9_clocksource_read,
.mask = CLOCKSOURCE_MASK(32),
.shift = 10,
+ .priority = 70,
};
static void at91_pit_stop(void)
diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c
index 28f90d967d..7ca879f4f0 100644
--- a/drivers/clocksource/timer-imx-gpt.c
+++ b/drivers/clocksource/timer-imx-gpt.c
@@ -64,6 +64,7 @@ static struct clocksource cs = {
.read = imx_clocksource_read,
.mask = CLOCKSOURCE_MASK(32),
.shift = 10,
+ .priority = 70,
};
static int imx_clocksource_clock_change(struct notifier_block *nb, unsigned long event, void *data)
diff --git a/drivers/clocksource/timer-ti-32k.c b/drivers/clocksource/timer-ti-32k.c
index 1f3f15561e..21cb686369 100644
--- a/drivers/clocksource/timer-ti-32k.c
+++ b/drivers/clocksource/timer-ti-32k.c
@@ -47,6 +47,7 @@ static struct clocksource s32k_cs = {
.read = s32k_clocksource_read,
.mask = CLOCKSOURCE_MASK(32),
.shift = 10,
+ .priority = 70,
};
/**
diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index d43609ad19..cdd297f10c 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -62,6 +62,7 @@ static struct clocksource dmtimer_cs = {
.read = dmtimer_read,
.mask = CLOCKSOURCE_MASK(32),
.shift = 10,
+ .priority = 70,
};
static int omap_dmtimer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/uemd.c b/drivers/clocksource/uemd.c
index 342260c564..a763eadc0c 100644
--- a/drivers/clocksource/uemd.c
+++ b/drivers/clocksource/uemd.c
@@ -52,6 +52,7 @@ static uint64_t uemd_timer_cs_read(void)
static struct clocksource uemd_cs = {
.read = uemd_timer_cs_read,
.mask = CLOCKSOURCE_MASK(32),
+ .priority = 60,
};
static int uemd_timer_probe(struct device_d *dev)