* [PATCH 04/16] mips: add an option to support customized get_tbclk()
@ 2020-01-08 3:01 Weijie Gao
2020-01-08 14:32 ` Daniel Schwierzeck
0 siblings, 1 reply; 3+ messages in thread
From: Weijie Gao @ 2020-01-08 3:01 UTC (permalink / raw)
To: u-boot
Some systems boot up at a very low CPU frequency and set up a higher CPU
frequency in lowlevel initialization.
Currently get_tbclk() uses a fixed value (CONFIG_SYS_MIPS_TIMER_FREQ)
for MIPS architercture, and CONFIG_SYS_MIPS_TIMER_FREQ is usually related
to the higher CPU frequency. If udelay() is used before setting up CPU
frequency, it will be very inaccurate.
This patch adds an option to allow a mach to define its own get_tbclk().
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
---
arch/mips/Kconfig | 8 ++++++++
arch/mips/cpu/time.c | 2 ++
2 files changed, 10 insertions(+)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 4688717593..52afbf79c5 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -502,6 +502,14 @@ config MIPS_BOOT_CONFIG_WORD1
help
Value which is inserted as boot config word 1.
+config MIPS_OVERRIDE_GET_TBCLK
+ bool
+ default n
+ help
+ Select this if you want to override the default get_tbclk() for your
+ system. This usually means the timer frequency of your system may
+ change in different boot stage.
+
endif
endmenu
diff --git a/arch/mips/cpu/time.c b/arch/mips/cpu/time.c
index af324f77ce..61d1cd9ec0 100644
--- a/arch/mips/cpu/time.c
+++ b/arch/mips/cpu/time.c
@@ -12,7 +12,9 @@ unsigned long notrace timer_read_counter(void)
return read_c0_count();
}
+#ifndef CONFIG_MIPS_OVERRIDE_GET_TBCLK
ulong notrace get_tbclk(void)
{
return CONFIG_SYS_MIPS_TIMER_FREQ;
}
+#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 04/16] mips: add an option to support customized get_tbclk()
2020-01-08 3:01 [PATCH 04/16] mips: add an option to support customized get_tbclk() Weijie Gao
@ 2020-01-08 14:32 ` Daniel Schwierzeck
2020-01-09 8:30 ` Weijie Gao
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Schwierzeck @ 2020-01-08 14:32 UTC (permalink / raw)
To: u-boot
Am 08.01.20 um 04:01 schrieb Weijie Gao:
> Some systems boot up at a very low CPU frequency and set up a higher CPU
> frequency in lowlevel initialization.
>
> Currently get_tbclk() uses a fixed value (CONFIG_SYS_MIPS_TIMER_FREQ)
> for MIPS architercture, and CONFIG_SYS_MIPS_TIMER_FREQ is usually related
> to the higher CPU frequency. If udelay() is used before setting up CPU
> frequency, it will be very inaccurate.
>
> This patch adds an option to allow a mach to define its own get_tbclk().
>
> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
> ---
> arch/mips/Kconfig | 8 ++++++++
> arch/mips/cpu/time.c | 2 ++
> 2 files changed, 10 insertions(+)
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 4688717593..52afbf79c5 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -502,6 +502,14 @@ config MIPS_BOOT_CONFIG_WORD1
> help
> Value which is inserted as boot config word 1.
>
> +config MIPS_OVERRIDE_GET_TBCLK
> + bool
> + default n
> + help
> + Select this if you want to override the default get_tbclk() for your
> + system. This usually means the timer frequency of your system may
> + change in different boot stage.
> +
> endif
>
> endmenu
> diff --git a/arch/mips/cpu/time.c b/arch/mips/cpu/time.c
> index af324f77ce..61d1cd9ec0 100644
> --- a/arch/mips/cpu/time.c
> +++ b/arch/mips/cpu/time.c
> @@ -12,7 +12,9 @@ unsigned long notrace timer_read_counter(void)
> return read_c0_count();
> }
>
> +#ifndef CONFIG_MIPS_OVERRIDE_GET_TBCLK
> ulong notrace get_tbclk(void)
> {
> return CONFIG_SYS_MIPS_TIMER_FREQ;
> }
> +#endif
>
you can drop this patch. I already applied [1] because there was another
request to make this function weak.
[1] https://patchwork.ozlabs.org/patch/1215073/
--
- Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 04/16] mips: add an option to support customized get_tbclk()
2020-01-08 14:32 ` Daniel Schwierzeck
@ 2020-01-09 8:30 ` Weijie Gao
0 siblings, 0 replies; 3+ messages in thread
From: Weijie Gao @ 2020-01-09 8:30 UTC (permalink / raw)
To: u-boot
On Wed, 2020-01-08 at 15:32 +0100, Daniel Schwierzeck wrote:
>
> Am 08.01.20 um 04:01 schrieb Weijie Gao:
> > Some systems boot up at a very low CPU frequency and set up a higher CPU
> > frequency in lowlevel initialization.
> >
> > Currently get_tbclk() uses a fixed value (CONFIG_SYS_MIPS_TIMER_FREQ)
> > for MIPS architercture, and CONFIG_SYS_MIPS_TIMER_FREQ is usually related
> > to the higher CPU frequency. If udelay() is used before setting up CPU
> > frequency, it will be very inaccurate.
> >
> > This patch adds an option to allow a mach to define its own get_tbclk().
> >
> > Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
> > ---
> > arch/mips/Kconfig | 8 ++++++++
> > arch/mips/cpu/time.c | 2 ++
> > 2 files changed, 10 insertions(+)
> >
> > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> > index 4688717593..52afbf79c5 100644
> > --- a/arch/mips/Kconfig
> > +++ b/arch/mips/Kconfig
> > @@ -502,6 +502,14 @@ config MIPS_BOOT_CONFIG_WORD1
> > help
> > Value which is inserted as boot config word 1.
> >
> > +config MIPS_OVERRIDE_GET_TBCLK
> > + bool
> > + default n
> > + help
> > + Select this if you want to override the default get_tbclk() for your
> > + system. This usually means the timer frequency of your system may
> > + change in different boot stage.
> > +
> > endif
> >
> > endmenu
> > diff --git a/arch/mips/cpu/time.c b/arch/mips/cpu/time.c
> > index af324f77ce..61d1cd9ec0 100644
> > --- a/arch/mips/cpu/time.c
> > +++ b/arch/mips/cpu/time.c
> > @@ -12,7 +12,9 @@ unsigned long notrace timer_read_counter(void)
> > return read_c0_count();
> > }
> >
> > +#ifndef CONFIG_MIPS_OVERRIDE_GET_TBCLK
> > ulong notrace get_tbclk(void)
> > {
> > return CONFIG_SYS_MIPS_TIMER_FREQ;
> > }
> > +#endif
> >
>
> you can drop this patch. I already applied [1] because there was another
> request to make this function weak.
>
> [1] https://patchwork.ozlabs.org/patch/1215073/
>
OK
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-09 8:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-08 3:01 [PATCH 04/16] mips: add an option to support customized get_tbclk() Weijie Gao
2020-01-08 14:32 ` Daniel Schwierzeck
2020-01-09 8:30 ` Weijie Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox