On Thu, 2018-04-12 at 15:12 -0700, Ivan Gorinov wrote: > Coreboot timestamp functions and Quark memory reference code use > get_tbclk() to get TSC frequency. This will not work if another > early timer is selected. > > Add tsc_rate_mhz() function and use it in the code that specifically > needs to get TSC rate regardless of currently selected early timer.
> void delay_n(uint32_t ns) > { > /* 1000 MHz clock has 1ns period --> no conversion required > */ > - uint64_t final_tsc = rdtsc(); > + uint64_t start_tsc = rdtsc(); > + uint64_t ticks; > > - final_tsc += ((get_tbclk_mhz() * ns) / 1000); > - > - while (rdtsc() < final_tsc) > - ; > + ticks = (tsc_rate_mhz() * ns) / 1000; > + while (rdtsc() - start_tsc < ticks); I would rather preserve existing style. > } > /* Delay number of microseconds */ > -void delay_u(uint32_t ms) > +void delay_u(uint32_t us) > { > /* 64-bit math is not an option, just use loops */ > - while (ms--) > + while (us--) > delay_n(1000); > } This is a separate change. -- Andy Shevchenko <andriy.shevche...@linux.intel.com> Intel Finland Oy _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot