xtensa patches for -rc5
Hi Chris,
due to SPI and net driver not getting into .30, I was able to drop all the controversial patches affecting xtensa IRQ code. Also the DMA engine support is now not pressing anymore.
What's left is pretty trivial. Two fixes, one affecting stack trace printing for generic xtensa. Both bugs were introduced with this merge window so it would be good to have the fixes in before the release.
The other part is the boot-time clock calibration on s6000.
Please consider merging this before .30 gets released. We can take care about the rest for .31.
Thanks,
Hannes
PATCH 1/5 xtensa: always use correct stack pointer for stack traces
Commit '28a0ce7 xtensa: use correct stack pointer for stack traces' changed the stack tracer from always reading the stack pointer register to always using the saved value in the task descriptor.
The author was too dense to consider the fact that the saved stack value is stale for a running process und thus unusable for 'current'.
What we do now is to use the stack pointer register (a1) for when the task is unknown - we can't help it then - or when the task is 'current'. For everything else use the saved stack pointer value contained in the task descriptor.
--- arch/xtensa/kernel/traps.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-)
arch/xtensa/kernel/traps.c +14 -2
@@ -369,6 +369,18 @@ void show_regs(struct pt_regs * regs) regs->syscall); } +static __always_inline unsigned long *stack_pointer (struct task_struct *task) +{ +unsigned long *sp; + +if (!task || task == current) + __asm__ __volatile__ ("mov %0, a1\n" :"=a" (sp)); +else + sp = (unsigned long *)task->thread.sp; + +return sp; +} +void show_trace (struct task_struct *task,unsigned long *sp) {unsigned long a0, a1, pc;
@@ -377,7 +389,7 @@ void show_trace(struct task_struct *task, unsigned long *sp)if (sp) a1 = (unsigned long )sp;else - a1 = task->thread.sp; + a1 = (unsigned long )stack_pointer (task); sp_start = a1 & ~(THREAD_SIZE -1 ); sp_end = sp_start +THREAD_SIZE ;
@@ -420,7 +432,7 @@ void show_stack(struct task_struct *task, unsigned long *sp)unsigned long *stack;if (!sp) - sp = (unsigned long *)task->thread.sp; + sp =stack_pointer (task); stack = sp;printk ("\nStack: " );
Signature · 1 line
1.6.3.rc3
PATCH 2/5 xtensa: register gpio chip before use
In reply to Johannes WeinerPlatform initialization sets up the LED heartbeat that is controlled via GPIO. Requesting the GPIO pins fails, however, as the chip is only initialized later by a device_initcall().
Fix this up by exporting the initialization function. Let the platform set up the chip before it starts using it.
--- arch/xtensa/platforms/s6105/setup.c | 3 +++ arch/xtensa/variants/s6000/gpio.c | 3 +-- arch/xtensa/variants/s6000/include/variant/gpio.h | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 arch/xtensa/variants/s6000/include/variant/gpio.h
arch/xtensa/platforms/s6105/setup.c +3 -0
@@ -10,6 +10,8 @@#include <asm/bootparam.h> #include <variant/hardware.h> +#include <variant/gpio.h> +#include <platform/gpio.h> void platform_halt (void )
@@ -47,6 +49,7 @@ void __init platform_setup(char **cmdline)void __init platform_init (bp_tag_t *first) { +s6_gpio_init ();gpio_request (GPIO_LED1_NGREEN ,"led1_green" );gpio_request (GPIO_LED1_RED ,"led1_red" );gpio_direction_output (GPIO_LED1_NGREEN ,1 );
arch/xtensa/variants/s6000/gpio.c +1 -2
@@ -64,8 +64,7 @@ static struct gpio_chip gpiochip = { .exported = 0, /* no exporting to userspace */ }; -static int gpio_init (void ) +int s6_gpio_init (void ) {return gpiochip_add (&gpiochip); } -device_initcall (gpio_init);
arch/xtensa/variants/s6000/include/variant/gpio.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _XTENSA_VARIANT_S6000_GPIO_H +#define _XTENSA_VARIANT_S6000_GPIO_H + +extern int s6_gpio_init (void ); + +#endif /* _XTENSA_VARIANT_S6000_GPIO_H */
Signature · 1 line
1.6.3.rc3
PATCH 3/5 xtensa: fix wrong extern declaration renamed in code using it
In reply to Johannes WeinerFrom: Oskar Schirmer <[email protected]>
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.
--- 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.3.rc3
PATCH 4/5 xtensa: implement ccount calibration for s6000
In reply to Johannes WeinerFrom: Oskar Schirmer <[email protected]>
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.
--- 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 +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.3.rc3
PATCH 5/5 xtensa: update s6105_defconfig for ccount calibration
In reply to Johannes WeinerFrom: Oskar Schirmer <[email protected]>
The previous patch enabled ccount calibration for the s6000 variant. This patch updates the defconfig for the s6105 platform to reflect this change.
--- 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.3.rc3