diff mbox series

[v3,08/20] mips: add a mtmips-specific field to architecture-specific global data

Message ID 1579594730-6982-1-git-send-email-weijie.gao@mediatek.com
State Accepted
Commit a60c1e6d6b682e432e4d6293da5566e0ddc7d3b8
Headers show
Series Refactor the architecture parts of mt7628 | expand

Commit Message

Weijie Gao Jan. 21, 2020, 8:18 a.m. UTC
SoCs of mtmips can use different CPU frequencies depending on the HW/SW
configurations. For example mt7628 uses 580MHz clock if the input xtal
frequency is 40MHz, and 575MHz clock if the xtal is 25MHz. Upon cold boot
the CPU uses the xtal frequency directly.

So hardcoding the timer frequency (half of the CPU frequency) in
CONFIG_SYS_MIPS_TIMER_FREQ is not a good idea for this case.

This patch adds a mtmips-specific field timer_freq to arch_global_data.
This field will be used later in mtmips-specific get_tbclk() to provide
accurate timer frequency in different boot stage.

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
---
Changes since v2: none
---
 arch/mips/include/asm/global_data.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Stefan Roese Jan. 21, 2020, 8:36 a.m. UTC | #1
On 21.01.20 09:18, Weijie Gao wrote:
> SoCs of mtmips can use different CPU frequencies depending on the HW/SW
> configurations. For example mt7628 uses 580MHz clock if the input xtal
> frequency is 40MHz, and 575MHz clock if the xtal is 25MHz. Upon cold boot
> the CPU uses the xtal frequency directly.
> 
> So hardcoding the timer frequency (half of the CPU frequency) in
> CONFIG_SYS_MIPS_TIMER_FREQ is not a good idea for this case.
> 
> This patch adds a mtmips-specific field timer_freq to arch_global_data.
> This field will be used later in mtmips-specific get_tbclk() to provide
> accurate timer frequency in different boot stage.
> 
> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
> Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
> ---
> Changes since v2: none

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan
diff mbox series

Patch

diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h
index 7b4ad083ba..4c30fab871 100644
--- a/arch/mips/include/asm/global_data.h
+++ b/arch/mips/include/asm/global_data.h
@@ -27,6 +27,9 @@  struct arch_global_data {
 #ifdef CONFIG_MIPS_L2_CACHE
 	unsigned short l2_line_size;
 #endif
+#ifdef CONFIG_ARCH_MTMIPS
+	unsigned long timer_freq;
+#endif
 };
 
 #include <asm-generic/global_data.h>