[U-Boot] [PATCH v2 3/6] dm: x86: Update timer_get_boot_us to work before DM is ready

Bin Meng bmeng.cn at gmail.com
Tue Sep 12 13:47:10 UTC 2017


Hi Simon,

On Wed, Sep 6, 2017 at 9:39 AM, Simon Glass <sjg at chromium.org> wrote:
> Hi Bin,
>
> On 27 August 2017 at 23:18, Bin Meng <bmeng.cn at gmail.com> wrote:
>> Hi Simon,
>>
>> On Sun, Aug 27, 2017 at 11:23 PM, Simon Glass <sjg at chromium.org> wrote:
>>> Use the new separate init function so that we can make use of the timer
>>> before driver model is started up.
>>>
>>> At some point we should consider adding the microsecond timer to the timer
>>> uclass interface since it would reduce the amount of plumbing here
>>> slightly.
>>>
>>> Signed-off-by: Simon Glass <sjg at chromium.org>
>>> ---
>>>
>>> Changes in v2:
>>> - Rebase on top of early timer code and simplify slightly
>>>
>>>  drivers/timer/tsc_timer.c | 19 ++++++++++++++-----
>>>  1 file changed, 14 insertions(+), 5 deletions(-)
>>>
>>
>> I don't think this patch is needed. The early timer support was
>> already provided in the patch [2/6] in this series.
>
> The current version of timer_get_boot_us() does not init the timer if
> it is not set up, so will return incorrect values at the start.
>

timer_get_boot_us() in tsc_timer.c calls timer_get_us():

ulong notrace timer_get_us(void)
{
return get_ticks() / get_tbclk_mhz();
}

get_ticks() will call timer_early_get_count() if CONFIG_TIMER_EARLY is on.

Am I missing anything? Isn't it still broken when CONFIG_TIMER_EARLY is on?

> So I think this patch is needed.
>

Regards,
Bin


More information about the U-Boot mailing list