summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-10-22 13:56:10 -0400
committerTom Rini <trini@konsulko.com>2018-10-22 13:56:10 -0400
commitc95c666d0128e5ec0c161b531c568233a8d3979d (patch)
tree77b5e5f3575b67216190d9f14411f8c692f808f1 /drivers
parent88d60db01168c743b4ae4152150a43a3df43c1c0 (diff)
parent3fdfca7a782e7d84bc14cd5d316b4894ec20dcec (diff)
Merge git://git.denx.de/u-boot-x86
Diffstat (limited to 'drivers')
-rw-r--r--drivers/timer/Kconfig13
-rw-r--r--drivers/timer/tsc_timer.c6
2 files changed, 16 insertions, 3 deletions
diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
index a7d600b6e4..d012cf71a9 100644
--- a/drivers/timer/Kconfig
+++ b/drivers/timer/Kconfig
@@ -30,6 +30,9 @@ config TPL_TIMER
config TIMER_EARLY
bool "Allow timer to be used early in U-Boot"
depends on TIMER
+ # initr_bootstage() requires a timer and is called before initr_dm()
+ # so only the early timer is available
+ default y if X86 && BOOTSTAGE
help
In some cases the timer must be accessible before driver model is
active. Examples include when using CONFIG_TRACE to trace U-Boot's
@@ -79,6 +82,16 @@ config X86_TSC_TIMER
help
Select this to enable Time-Stamp Counter (TSC) timer for x86.
+config X86_TSC_TIMER_EARLY_FREQ
+ int "x86 TSC timer frequency in MHz when used as the early timer"
+ depends on X86_TSC_TIMER
+ default 1000
+ help
+ Sets the estimated CPU frequency in MHz 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.
+
config OMAP_TIMER
bool "Omap timer support"
depends on TIMER
diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
index 6473de20f1..da7c812908 100644
--- a/drivers/timer/tsc_timer.c
+++ b/drivers/timer/tsc_timer.c
@@ -341,7 +341,7 @@ static int tsc_timer_get_count(struct udevice *dev, u64 *count)
return 0;
}
-static void tsc_timer_ensure_setup(bool stop)
+static void tsc_timer_ensure_setup(bool early)
{
if (gd->arch.tsc_base)
return;
@@ -362,8 +362,8 @@ static void tsc_timer_ensure_setup(bool stop)
if (fast_calibrate)
goto done;
- if (stop)
- panic("TSC frequency is ZERO");
+ if (early)
+ fast_calibrate = CONFIG_X86_TSC_TIMER_EARLY_FREQ;
else
return;