mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* xtensa patches for -rc5
@ 2009-05-11 13:43 Johannes Weiner
  2009-05-11 13:43 ` [patch 1/5] xtensa: always use correct stack pointer for stack traces Johannes Weiner
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Johannes Weiner @ 2009-05-11 13:43 UTC (permalink / raw)
  To: Chris Zankel; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 1/5] xtensa: always use correct stack pointer for stack traces
  2009-05-11 13:43 xtensa patches for -rc5 Johannes Weiner
@ 2009-05-11 13:43 ` Johannes Weiner
  2009-05-11 13:43 ` [patch 2/5] xtensa: register gpio chip before use Johannes Weiner
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2009-05-11 13:43 UTC (permalink / raw)
  To: Chris Zankel; +Cc: linux-kernel

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.

Signed-off-by: Johannes Weiner <jw@emlix.com>
---
 arch/xtensa/kernel/traps.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index 9f0b711..ba9ab93 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -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: ");
-- 
1.6.3.rc3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 2/5] xtensa: register gpio chip before use
  2009-05-11 13:43 xtensa patches for -rc5 Johannes Weiner
  2009-05-11 13:43 ` [patch 1/5] xtensa: always use correct stack pointer for stack traces Johannes Weiner
@ 2009-05-11 13:43 ` Johannes Weiner
  2009-05-11 13:43 ` [patch 3/5] xtensa: fix wrong extern declaration renamed in code using it Johannes Weiner
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2009-05-11 13:43 UTC (permalink / raw)
  To: Chris Zankel; +Cc: linux-kernel

Platform 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.

Signed-off-by: Johannes Weiner <jw@emlix.com>
---
 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

diff --git a/arch/xtensa/platforms/s6105/setup.c b/arch/xtensa/platforms/s6105/setup.c
index ae041d5..855ddea 100644
--- a/arch/xtensa/platforms/s6105/setup.c
+++ b/arch/xtensa/platforms/s6105/setup.c
@@ -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);
diff --git a/arch/xtensa/variants/s6000/gpio.c b/arch/xtensa/variants/s6000/gpio.c
index 33a8d95..79317fd 100644
--- a/arch/xtensa/variants/s6000/gpio.c
+++ b/arch/xtensa/variants/s6000/gpio.c
@@ -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);
diff --git a/arch/xtensa/variants/s6000/include/variant/gpio.h b/arch/xtensa/variants/s6000/include/variant/gpio.h
new file mode 100644
index 0000000..8327f62
--- /dev/null
+++ b/arch/xtensa/variants/s6000/include/variant/gpio.h
@@ -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 */
-- 
1.6.3.rc3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 3/5] xtensa: fix wrong extern declaration renamed in code using it
  2009-05-11 13:43 xtensa patches for -rc5 Johannes Weiner
  2009-05-11 13:43 ` [patch 1/5] xtensa: always use correct stack pointer for stack traces Johannes Weiner
  2009-05-11 13:43 ` [patch 2/5] xtensa: register gpio chip before use Johannes Weiner
@ 2009-05-11 13:43 ` Johannes Weiner
  2009-05-11 13:43 ` [patch 4/5] xtensa: implement ccount calibration for s6000 Johannes Weiner
  2009-05-11 13:43 ` [patch 5/5] xtensa: update s6105_defconfig for ccount calibration Johannes Weiner
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2009-05-11 13:43 UTC (permalink / raw)
  To: Chris Zankel; +Cc: linux-kernel, Oskar Schirmer

From: Oskar Schirmer <os@emlix.com>

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 <os@emlix.com>
---
 arch/xtensa/include/asm/timex.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/xtensa/include/asm/timex.h b/arch/xtensa/include/asm/timex.h
index b83a818..053bc42 100644
--- a/arch/xtensa/include/asm/timex.h
+++ b/arch/xtensa/include/asm/timex.h
@@ -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)
-- 
1.6.3.rc3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 4/5] xtensa: implement ccount calibration for s6000
  2009-05-11 13:43 xtensa patches for -rc5 Johannes Weiner
                   ` (2 preceding siblings ...)
  2009-05-11 13:43 ` [patch 3/5] xtensa: fix wrong extern declaration renamed in code using it Johannes Weiner
@ 2009-05-11 13:43 ` Johannes Weiner
  2009-05-11 13:43 ` [patch 5/5] xtensa: update s6105_defconfig for ccount calibration Johannes Weiner
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2009-05-11 13:43 UTC (permalink / raw)
  To: Chris Zankel; +Cc: linux-kernel, Oskar Schirmer

From: Oskar Schirmer <os@emlix.com>

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 <os@emlix.com>
---
 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

diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 30d21a9..ebe228d 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -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
diff --git a/arch/xtensa/variants/s6000/Makefile b/arch/xtensa/variants/s6000/Makefile
index 03b3975..d83f380 100644
--- a/arch/xtensa/variants/s6000/Makefile
+++ b/arch/xtensa/variants/s6000/Makefile
@@ -1,3 +1,4 @@
 # s6000 Makefile
 
 obj-y		+= irq.o gpio.o
+obj-$(CONFIG_XTENSA_CALIBRATE_CCOUNT)	+= delay.o
diff --git a/arch/xtensa/variants/s6000/delay.c b/arch/xtensa/variants/s6000/delay.c
new file mode 100644
index 0000000..54b2b57
--- /dev/null
+++ b/arch/xtensa/variants/s6000/delay.c
@@ -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;
+		asm volatile(
+		"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));
+}
-- 
1.6.3.rc3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 5/5] xtensa: update s6105_defconfig for ccount calibration
  2009-05-11 13:43 xtensa patches for -rc5 Johannes Weiner
                   ` (3 preceding siblings ...)
  2009-05-11 13:43 ` [patch 4/5] xtensa: implement ccount calibration for s6000 Johannes Weiner
@ 2009-05-11 13:43 ` Johannes Weiner
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2009-05-11 13:43 UTC (permalink / raw)
  To: Chris Zankel; +Cc: linux-kernel, Oskar Schirmer

From: Oskar Schirmer <os@emlix.com>

The 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 <os@emlix.com>
---
 arch/xtensa/configs/s6105_defconfig |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/xtensa/configs/s6105_defconfig b/arch/xtensa/configs/s6105_defconfig
index 6e1deff..768bee0 100644
--- a/arch/xtensa/configs/s6105_defconfig
+++ b/arch/xtensa/configs/s6105_defconfig
@@ -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"
-- 
1.6.3.rc3


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-05-11 13:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-11 13:43 xtensa patches for -rc5 Johannes Weiner
2009-05-11 13:43 ` [patch 1/5] xtensa: always use correct stack pointer for stack traces Johannes Weiner
2009-05-11 13:43 ` [patch 2/5] xtensa: register gpio chip before use Johannes Weiner
2009-05-11 13:43 ` [patch 3/5] xtensa: fix wrong extern declaration renamed in code using it Johannes Weiner
2009-05-11 13:43 ` [patch 4/5] xtensa: implement ccount calibration for s6000 Johannes Weiner
2009-05-11 13:43 ` [patch 5/5] xtensa: update s6105_defconfig for ccount calibration Johannes Weiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®