diff mbox series

[U-Boot,060/126] x86: timer: Set up the timer in timer_early_get_count()

Message ID 20190925145750.200592-61-sjg@chromium.org
State Superseded
Delegated to: Bin Meng
Headers show
Series x86: Add initial support for apollolake | expand

Commit Message

Simon Glass Sept. 25, 2019, 2:56 p.m. UTC
This function can be called before the timer is set up. Make sure that the
init function is called so that it works correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/timer/tsc_timer.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Bin Meng Oct. 7, 2019, 12:32 a.m. UTC | #1
Hi Simon,

On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote:
>
> This function can be called before the timer is set up. Make sure that the
> init function is called so that it works correctly.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/timer/tsc_timer.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
> index 9630036bc7f..85bdd95a819 100644
> --- a/drivers/timer/tsc_timer.c
> +++ b/drivers/timer/tsc_timer.c
> @@ -464,6 +464,8 @@ unsigned long notrace timer_early_get_rate(void)
>
>  u64 notrace timer_early_get_count(void)
>  {
> +       tsc_timer_ensure_setup(true);

Could you please specify why this is needed? I remember we had done
quite some fixes to the tsc_timer to support the early timer.

> +
>         return rdtsc() - gd->arch.tsc_base;
>  }
>

Regards,
Bin
Simon Glass Oct. 12, 2019, 3:37 a.m. UTC | #2
Hi Bin,

On Sun, 6 Oct 2019 at 18:32, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Simon,
>
> On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote:
> >
> > This function can be called before the timer is set up. Make sure that the
> > init function is called so that it works correctly.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  drivers/timer/tsc_timer.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
> > index 9630036bc7f..85bdd95a819 100644
> > --- a/drivers/timer/tsc_timer.c
> > +++ b/drivers/timer/tsc_timer.c
> > @@ -464,6 +464,8 @@ unsigned long notrace timer_early_get_rate(void)
> >
> >  u64 notrace timer_early_get_count(void)
> >  {
> > +       tsc_timer_ensure_setup(true);
>
> Could you please specify why this is needed? I remember we had done
> quite some fixes to the tsc_timer to support the early timer.

It doesn't seem to be needed actually. Will drop.

Regards,
Simon
diff mbox series

Patch

diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
index 9630036bc7f..85bdd95a819 100644
--- a/drivers/timer/tsc_timer.c
+++ b/drivers/timer/tsc_timer.c
@@ -464,6 +464,8 @@  unsigned long notrace timer_early_get_rate(void)
 
 u64 notrace timer_early_get_count(void)
 {
+	tsc_timer_ensure_setup(true);
+
 	return rdtsc() - gd->arch.tsc_base;
 }