x86: timer: Reduce timer code size in TPL on Intel CPUs
[oweals/u-boot.git] / drivers / timer / tsc_timer.c
index 813817f467265e04e750aee930c5fcab7e19c846..43cb2d820e89e1a7c2f0e55525ed4a152e39f2d2 100644 (file)
@@ -50,8 +50,7 @@ static unsigned long native_calibrate_tsc(void)
                return 0;
 
        crystal_freq = tsc_info.ecx / 1000;
-
-       if (!crystal_freq) {
+       if (!CONFIG_IS_ENABLED(X86_TSC_TIMER_NATIVE) && !crystal_freq) {
                switch (gd->arch.x86_model) {
                case INTEL_FAM6_SKYLAKE_MOBILE:
                case INTEL_FAM6_SKYLAKE_DESKTOP:
@@ -407,6 +406,10 @@ static void tsc_timer_ensure_setup(bool early)
                if (fast_calibrate)
                        goto done;
 
+               /* Reduce code size by dropping other methods */
+               if (CONFIG_IS_ENABLED(X86_TSC_TIMER_NATIVE))
+                       panic("no timer");
+
                fast_calibrate = cpu_mhz_from_cpuid();
                if (fast_calibrate)
                        goto done;