aboutsummaryrefslogtreecommitdiff
path: root/drivers/timer
diff options
context:
space:
mode:
authorBin Meng2021-07-28 12:00:22 +0800
committerBin Meng2021-08-02 15:11:40 +0800
commit5824bc6d6fe5f63aa1fb9acbe5ad5aa28d77380f (patch)
tree6487147d95901121d9caa2391759fc654cf0061a /drivers/timer
parentffaa7abfc5e930448a3aadb17e5eb00cabb37b9d (diff)
x86: tsc: Rename X86_TSC_TIMER_EARLY_FREQ to X86_TSC_TIMER_FREQ
Currently there are two places to specify the x86 TSC timer frequency with one in Kconfig used for early timer and the other one in device tree used when the frequency cannot be determined from hardware. This may potentially create an inconsistent config where the 2 values do not match. Let's use the one specified in Kconfig in the device tree as well. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/timer')
-rw-r--r--drivers/timer/Kconfig8
-rw-r--r--drivers/timer/tsc_timer.c5
2 files changed, 7 insertions, 6 deletions
diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
index ee81dfa7768..89131426542 100644
--- a/drivers/timer/Kconfig
+++ b/drivers/timer/Kconfig
@@ -124,12 +124,12 @@ config RENESAS_OSTM_TIMER
Enables support for the Renesas OSTM Timer driver.
This timer is present on Renesas RZ/A1 R7S72100 SoCs.
-config X86_TSC_TIMER_EARLY_FREQ
- int "x86 TSC timer frequency in MHz when used as the early timer"
+config X86_TSC_TIMER_FREQ
+ int "x86 TSC timer frequency in Hz"
depends on X86_TSC_TIMER
- default 1000
+ default 1000000000
help
- Sets the estimated CPU frequency in MHz when TSC is used as the
+ Sets the estimated CPU frequency in Hz when TSC is used as the
early timer and the frequency can neither be calibrated via some
hardware ways, nor got from device tree at the time when device
tree is not available yet.
diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
index 7d19a99622b..adef50c3744 100644
--- a/drivers/timer/tsc_timer.c
+++ b/drivers/timer/tsc_timer.c
@@ -425,12 +425,13 @@ static void tsc_timer_ensure_setup(bool early)
goto done;
if (early)
- fast_calibrate = CONFIG_X86_TSC_TIMER_EARLY_FREQ;
+ gd->arch.clock_rate = CONFIG_X86_TSC_TIMER_FREQ;
else
return;
done:
- gd->arch.clock_rate = fast_calibrate * 1000000;
+ if (!gd->arch.clock_rate)
+ gd->arch.clock_rate = fast_calibrate * 1000000;
}
gd->arch.tsc_inited = true;
}