xtensa: fix wrong extern declaration renamed in code using it
PATCH 1/3 xtensa: fix wrong extern declaration renamed in code using it
The variable ccount_nsec has been renamed to nsec_per_ccount in arch/xtensa/kernel/time.c in 2b8aea74 (2007-08-05), but the fix failed to rename the variable in arch/xtensa/include/asm/timex.h as well.
Signed-off-by Oskar Schirmer <[email protected]>
--- arch/xtensa/include/asm/timex.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/xtensa/include/asm/timex.h +2 -2
@@ -39,9 +39,9 @@#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT extern unsigned long ccount_per_jiffy; -extern unsigned long ccount_nsec; +extern unsigned long nsec_per_ccount;#define CCOUNT_PER_JIFFY ccount_per_jiffy -#define NSEC_PER_CCOUNT ccount_nsec +#define NSEC_PER_CCOUNT nsec_per_ccount#else #define CCOUNT_PER_JIFFY (CONFIG_XTENSA_CPU_CLOCK*(1000000UL/HZ))#define NSEC_PER_CCOUNT (1000UL / CONFIG_XTENSA_CPU_CLOCK)
Signature · 1 line
1.6.2.107.ge47ee
PATCH 2/3 xtensa: implement ccount calibration for s6000
Calculate core frequency from timers at boot time
instead of assuming a fixed frequency. This is
useful as the true frequency is set up by the
boot loader, thus variable.
Signed-off-by Oskar Schirmer <[email protected]>
--- arch/xtensa/Kconfig | 1 + arch/xtensa/variants/s6000/Makefile | 1 + arch/xtensa/variants/s6000/delay.c | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 0 deletions(-) create mode 100644 arch/xtensa/variants/s6000/delay.c
arch/xtensa/Kconfig +1 -0
@@ -80,6 +80,7 @@ config XTENSA_VARIANT_S6000 bool "s6000 - Stretch software configurable processor" select VARIANT_IRQ_SWITCH select ARCH_REQUIRE_GPIOLIB + select XTENSA_CALIBRATE_CCOUNT endchoice config XTENSA_UNALIGNED_USER
arch/xtensa/variants/s6000/Makefile +1 -0
@@ -1,3 +1,4 @@ # s6000 Makefile obj-y += irq.o gpio.o dmac.o isef.o uncached-mapping.o +obj-$(CONFIG_XTENSA_CALIBRATE_CCOUNT) += delay.o
arch/xtensa/variants/s6000/delay.c new file +27 -0
@@ -0,0 +1,27 @@ +#include <asm/delay.h> +#include <asm/timex.h> +#include <asm/io.h> +#include <variant/hardware.h> + +#define LOOPS 10 +void platform_calibrate_ccount (void ) +{ +u32 uninitialized_var (a ); +u32 uninitialized_var (u ); +u32 b; +u32 tstamp =S6_REG_GREG1 +S6_GREG1_GLOBAL_TIMER ; +int i =LOOPS +1 ; +do { +u32 t = u; + asmvolatile ( +"1: l32i %0, %2, 0 ;" +" beq %0, %1, 1b ;" + :"=&a" (u) :"a" (t),"a" (tstamp)); + b =xtensa_get_ccount (); +if (i ==LOOPS ) + a = b; + }while (--i >=0 ); + b -= a; + nsec_per_ccount = (LOOPS *10000 ) / b; + ccount_per_jiffy = b * (100000UL / (LOOPS *HZ )); +}
Signature · 1 line
1.6.2.107.ge47ee
PATCH 3/3 xtensa: update s6105_defconfig for ccount calibration
In reply to Oskar SchirmerThe previous patch enabled ccount calibration for the s6000 variant. This patch updates the defconfig for the s6105 platform to reflect this change.
Signed-off-by Oskar Schirmer <[email protected]>
--- arch/xtensa/configs/s6105_defconfig | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
arch/xtensa/configs/s6105_defconfig +1 -2
@@ -115,7 +115,7 @@ CONFIG_XTENSA_VARIANT_S6000=y CONFIG_PREEMPT=y # CONFIG_MATH_EMULATION is not set # CONFIG_HIGHMEM is not set -# CONFIG_XTENSA_CALIBRATE_CCOUNT is not set +CONFIG_XTENSA_CALIBRATE_CCOUNT=y CONFIG_SERIAL_CONSOLE=y # CONFIG_XTENSA_ISS_NETWORK is not set
@@ -131,7 +131,6 @@ CONFIG_SERIAL_CONSOLE=y # CONFIG_XTENSA_PLATFORM_ISS is not set # CONFIG_XTENSA_PLATFORM_XT2000 is not set CONFIG_XTENSA_PLATFORM_S6105=y -CONFIG_XTENSA_CPU_CLOCK=300 CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="console=ttyS1,38400 debug bootmem_debug loglevel=7"
Signature · 1 line
1.6.2.107.ge47ee