diff mbox series

[7/9] arm: armv8: add support for boards with broken/unset counter frequency

Message ID 20181107150441.23383-1-m.szyprowski@samsung.com
State New
Headers show
Series ARM: Exynos: Add TM2 board support | expand

Commit Message

Marek Szyprowski Nov. 7, 2018, 3:04 p.m. UTC
Some boards use legacy firmware which doesn't properly configure ARM
architected timer registers. This patch adds a workaround to use the
defined COUNTER_FREQUENCY instead of reading its value from the timer
registers.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 arch/arm/cpu/armv8/generic_timer.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Lukasz Majewski Nov. 21, 2018, 1:06 a.m. UTC | #1
On Wed, 07 Nov 2018 16:04:41 +0100
Marek Szyprowski <m.szyprowski@samsung.com> wrote:

> Some boards use legacy firmware which doesn't properly configure ARM

> architected timer registers. This patch adds a workaround to use the

> defined COUNTER_FREQUENCY instead of reading its value from the timer

> registers.

> 

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---

>  arch/arm/cpu/armv8/generic_timer.c | 4 ++++

>  1 file changed, 4 insertions(+)

> 

> diff --git a/arch/arm/cpu/armv8/generic_timer.c

> b/arch/arm/cpu/armv8/generic_timer.c index c1706dcec1..5ac62a0a32

> 100644 --- a/arch/arm/cpu/armv8/generic_timer.c

> +++ b/arch/arm/cpu/armv8/generic_timer.c

> @@ -15,9 +15,13 @@ DECLARE_GLOBAL_DATA_PTR;

>   */

>  unsigned long get_tbclk(void)

>  {

> +#ifndef COUNTER_FREQUENCY

>  	unsigned long cntfrq;

>  	asm volatile("mrs %0, cntfrq_el0" : "=r" (cntfrq));

>  	return cntfrq;

> +#else

> +	return COUNTER_FREQUENCY;

> +#endif

>  }

>  

>  #ifdef CONFIG_SYS_FSL_ERRATUM_A008585


Have something changed - or there still is no errata for this?

The COUNTER_FREQUENCY is declared in include/configs/tm2.h, but shall
be moved to Kconfig.

Otherwise looks correct.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
diff mbox series

Patch

diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c
index c1706dcec1..5ac62a0a32 100644
--- a/arch/arm/cpu/armv8/generic_timer.c
+++ b/arch/arm/cpu/armv8/generic_timer.c
@@ -15,9 +15,13 @@  DECLARE_GLOBAL_DATA_PTR;
  */
 unsigned long get_tbclk(void)
 {
+#ifndef COUNTER_FREQUENCY
 	unsigned long cntfrq;
 	asm volatile("mrs %0, cntfrq_el0" : "=r" (cntfrq));
 	return cntfrq;
+#else
+	return COUNTER_FREQUENCY;
+#endif
 }
 
 #ifdef CONFIG_SYS_FSL_ERRATUM_A008585