Skip to contentSkip to conversation

PATCH In review Johannes Weiner 6 participants 22 messages Apr 14, 2009 – Apr 23, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Andrew,

these are fixes and dependency patches for xtensa code in mainline and your tree that came in during this merge window.

Thanks,
Hannes

#1 lore raw

PATCH 1/12 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
index 9f0b711..ba9ab93 100644
@@ -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.2.107.ge47ee
#2 lore raw

PATCH 2/12 xtensa: register gpio chip before use

In reply to Johannes Weiner

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.

---
 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
index ae041d5..855ddea 100644
@@ -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
index 33a8d95..79317fd 100644
@@ -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
new file mode 100644
index 0000000..8327f62
@@ -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.2.107.ge47ee
#3 lore raw

PATCH 3/12 xtensa: fix wrong extern declaration renamed in code using it

In reply to Johannes Weiner

From: 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
index b83a818..053bc42 100644
@@ -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
#4 lore raw

PATCH 4/12 xtensa: implement ccount calibration for s6000

In reply to Johannes Weiner

From: 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
index fa6dc4d..ac02f3c 100644
@@ -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
index 03b3975..d83f380 100644
@@ -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
new file mode 100644
index 0000000..54b2b57
@@ -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));
+}
Signature · 1 line
1.6.2.107.ge47ee
#5 lore raw

PATCH 5/12 xtensa: update s6105_defconfig for ccount calibration

In reply to Johannes Weiner

From: 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
index 6e1deff..768bee0 100644
@@ -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
#6 lore raw

PATCH 6/12 xtensa: implement CLK API

In reply to Johannes Weiner

From: Daniel Glöckner <[email protected]>

Implement access to the peripheral clock (half of cpu clock) by means of the generic CLK API.

---
 arch/xtensa/platforms/s6105/Makefile |    2 +-
 arch/xtensa/platforms/s6105/clocks.c |   49 ++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 1 deletions(-)
 create mode 100644 arch/xtensa/platforms/s6105/clocks.c
arch/xtensa/platforms/s6105/Makefile +1 -1
index 0be6194..294427b 100644
@@ -1,3 +1,3 @@
 # Makefile for the Stretch S6105 eval board
 
-obj-y		:= setup.o device.o
+obj-y		:= setup.o device.o clocks.o
arch/xtensa/platforms/s6105/clocks.c new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
1.6.2.107.ge47ee
#7 lore raw

PATCH 7/12 xtensa: implement PTRACE_PEEKUSER addresses for nommu

In reply to Johannes Weiner

From: Daniel Glöckner <[email protected]>

On nommu gdbserver needs to be able to look up where the currently debugged application has been relocated. Based on the Blackfin implementation, this introduces three "addresses" PT_TEXT_ADDR, PT_DATA_ADDR, and PT_TEXT_END_ADDR for PTRACE_PEEKUSER.

---
 arch/xtensa/include/asm/ptrace.h |    4 ++++
 arch/xtensa/kernel/ptrace.c      |   12 ++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
arch/xtensa/include/asm/ptrace.h +4 -0
index 905e1e6..8f4fbf3 100644
@@ -66,6 +66,10 @@
 
 #define SYSCALL_NR	0x00ff
 
+#define PT_TEXT_ADDR	0x0300
+#define PT_DATA_ADDR	0x0301
+#define PT_TEXT_END_ADDR	0x0302
+
 /* Other PTRACE_ values defined in <linux/ptrace.h> using values 0-9,16,17,24 */
 
 #define PTRACE_GETREGS		12
arch/xtensa/kernel/ptrace.c +12 -0
index 9486882..82f3620 100644
@@ -211,6 +211,18 @@ int ptrace_peekusr(struct task_struct *child, long regno, long __user *ret)
 			tmp = regs->syscall;
 			break;
 
+		case PT_TEXT_ADDR:
+			tmp = child->mm->start_code;
+			break;
+
+		case PT_DATA_ADDR:
+			tmp = child->mm->start_data;
+			break;
+
+		case PT_TEXT_END_ADDR:
+			tmp = child->mm->end_code;
+			break;
+
 		default:
 			return -EIO;
 	}
Signature · 1 line
1.6.2.107.ge47ee
#8 lore raw

PATCH 8/12 xtensa: s6000 dma engine support

In reply to Johannes Weiner

From: Oskar Schirmer <[email protected]>

There are four slightly different dma engines on the s6000 family. One for memory-memory transfers, the other three for memory-device.

This patch implements a platform-specific kernel-API to control these engines. It is needed for the network, video, audio peripherals on s6000.

---
 arch/xtensa/variants/s6000/Makefile               |    2 +-
 arch/xtensa/variants/s6000/dmac.c                 |  174 +++++++++
 arch/xtensa/variants/s6000/include/variant/dmac.h |  387 +++++++++++++++++++++
 3 files changed, 562 insertions(+), 1 deletions(-)
 create mode 100644 arch/xtensa/variants/s6000/dmac.c
 create mode 100644 arch/xtensa/variants/s6000/include/variant/dmac.h
arch/xtensa/variants/s6000/Makefile +1 -1
index d83f380..3e7ef0a 100644
@@ -1,4 +1,4 @@
 # s6000 Makefile
 
-obj-y		+= irq.o gpio.o
+obj-y		+= irq.o gpio.o dmac.o
 obj-$(CONFIG_XTENSA_CALIBRATE_CCOUNT)	+= delay.o
arch/xtensa/variants/s6000/dmac.c new file +174 -0

174 lines not on this page · raw message

arch/xtensa/variants/s6000/include/variant/dmac.h new file +387 -0

387 lines not on this page · raw message

Signature · 1 line
1.6.2.107.ge47ee
#9 lore raw

PATCH 9/12 xtensa: allow platform and variant to initialize own irq chips

In reply to Johannes Weiner

From: Daniel Glöckner <[email protected]>

There was already a PLATFORM_NR_IRQS define, which is now accompanied by a VARIANT_NR_IRQS. To be able to initialize these interrupts, init_IRQ now calls variant and platform specific hooks.

---
 arch/xtensa/include/asm/irq.h                     |   21 ++++++++++++++++++---
 arch/xtensa/kernel/irq.c                          |    3 +++
 arch/xtensa/variants/dc232b/include/variant/irq.h |    4 ++++
 arch/xtensa/variants/fsf/include/variant/irq.h    |    4 ++++
 arch/xtensa/variants/s6000/include/variant/irq.h  |    1 +
 5 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 arch/xtensa/variants/dc232b/include/variant/irq.h
 create mode 100644 arch/xtensa/variants/fsf/include/variant/irq.h
arch/xtensa/include/asm/irq.h +18 -3
index dfac82d..c3c10a7 100644
@@ -11,21 +11,36 @@
 #ifndef _XTENSA_IRQ_H
 #define _XTENSA_IRQ_H
 
+#include <linux/init.h>
 #include <platform/hardware.h>
 #include <variant/core.h>
 
-#ifdef CONFIG_VARIANT_IRQ_SWITCH
 #include <variant/irq.h>
-#else
+#ifndef CONFIG_VARIANT_IRQ_SWITCH
 static inline void variant_irq_enable(unsigned int irq) { }
 static inline void variant_irq_disable(unsigned int irq) { }
 #endif
 
+#ifndef VARIANT_NR_IRQS
+# define VARIANT_NR_IRQS 0
+#endif
 #ifndef PLATFORM_NR_IRQS
 # define PLATFORM_NR_IRQS 0
 #endif
 #define XTENSA_NR_IRQS XCHAL_NUM_INTERRUPTS
-#define NR_IRQS (XTENSA_NR_IRQS + PLATFORM_NR_IRQS)
+#define NR_IRQS (XTENSA_NR_IRQS + VARIANT_NR_IRQS + PLATFORM_NR_IRQS)
+
+#if VARIANT_NR_IRQS == 0
+static inline void variant_init_IRQ(void) { }
+#else
+void variant_init_IRQ(void) __init;
+#endif
+
+#if PLATFORM_NR_IRQS == 0
+static inline void platform_init_IRQ(void) { }
+#else
+void platform_init_IRQ(void) __init;
+#endif
 
 static __inline__ int irq_canonicalize(int irq)
 {
arch/xtensa/kernel/irq.c +3 -0
index a36c85e..61c03a3 100644
@@ -197,4 +197,7 @@ void __init init_IRQ(void)
 	}
 
 	cached_irq_mask = 0;
+
+	variant_init_IRQ();
+	platform_init_IRQ();
 }
arch/xtensa/variants/dc232b/include/variant/irq.h new file +4 -0
new file mode 100644
index 0000000..070b9f5
@@ -0,0 +1,4 @@
+#ifndef __XTENSA_VARIANT_IRQ_H
+#define __XTENSA_VARIANT_IRQ_H
+
+#endif
arch/xtensa/variants/fsf/include/variant/irq.h new file +4 -0
new file mode 100644
index 0000000..070b9f5
@@ -0,0 +1,4 @@
+#ifndef __XTENSA_VARIANT_IRQ_H
+#define __XTENSA_VARIANT_IRQ_H
+
+#endif
arch/xtensa/variants/s6000/include/variant/irq.h +1 -0
index fa031cb..55403d1 100644
@@ -2,6 +2,7 @@
 #define __XTENSA_S6000_IRQ_H
 
 #define NO_IRQ		(-1)
+#define VARIANT_NR_IRQS 8 /* GPIO interrupts */
 
 extern void variant_irq_enable(unsigned int irq);
 extern void variant_irq_disable(unsigned int irq);
Signature · 1 line
1.6.2.107.ge47ee
maintainer
#10 lore raw

Re: [patch 09/12] xtensa: allow platform and variant to initialize own irq chips

Hi Daniel,

What

Quoted 11 lines · Johannes Weiner

From: Daniel Glöckner <[email protected]>

arch/xtensa/include/asm/irq.h +1 -0
index dfac82d..c3c10a7 100644
@@ -11,21 +11,36 @@
 #ifndef _XTENSA_IRQ_H
 #define _XTENSA_IRQ_H
 
+#include <linux/init.h>

arch/xtensa/include/asm/irq.h line 22

Quoted 10 lines
arch/xtensa/include/asm/irq.h +1 -2
 #include <platform/hardware.h>
 #include <variant/core.h>
 
-#ifdef CONFIG_VARIANT_IRQ_SWITCH
 #include <variant/irq.h>
-#else
+#ifndef CONFIG_VARIANT_IRQ_SWITCH
 static inline void variant_irq_enable(unsigned int irq) { }
 static inline void variant_irq_disable(unsigned int irq) { }
 #endif

What was the reason for this change? We shouldn't require all processor variants to provide an irq.h header file, unless required (and we wouldn't need to add the following files)

Quoted 16 lines
arch/xtensa/variants/dc232b/include/variant/irq.h new file +4 -0
new file mode 100644
index 0000000..070b9f5
@@ -0,0 +1,4 @@
+#ifndef __XTENSA_VARIANT_IRQ_H
+#define __XTENSA_VARIANT_IRQ_H
+
+#endif
arch/xtensa/variants/fsf/include/variant/irq.h new file +0 -0
new file mode 100644
index 0000000..070b9f5

arch/xtensa/variants/fsf/include/variant/irq.h line 4

Quoted 4 lines
arch/xtensa/variants/fsf/include/variant/irq.h new file +4 -0
@@ -0,0 +1,4 @@
+#ifndef __XTENSA_VARIANT_IRQ_H
+#define __XTENSA_VARIANT_IRQ_H
+
+#endif

Since you are at it, can you change __XTENSA_S6000_IRQ_H to _XTENSA_S6000_IRQ_H (single 'underscore' prefix).

arch/xtensa/variants/s6000/include/variant/irq.h line 8

Quoted 12 lines
arch/xtensa/variants/s6000/include/variant/irq.h +1 -0
index fa031cb..55403d1 100644
@@ -2,6 +2,7 @@
 #define __XTENSA_S6000_IRQ_H
 
 #define NO_IRQ		(-1)
+#define VARIANT_NR_IRQS 8 /* GPIO interrupts */
 
 extern void variant_irq_enable(unsigned int irq);
 extern void variant_irq_disable(unsigned int irq);

Thanks,
-Chris

#11 lore raw

Re: [patch 09/12] xtensa: allow platform and variant to initialize own irq chips

Hi,

Quoted 11 lines · Chris Zankel

arch/xtensa/include/asm/irq.h line 22

Quoted 7 lines
arch/xtensa/include/asm/irq.h +1 -2
-#ifdef CONFIG_VARIANT_IRQ_SWITCH
 #include <variant/irq.h>
-#else
+#ifndef CONFIG_VARIANT_IRQ_SWITCH
 static inline void variant_irq_enable(unsigned int irq) { }
 static inline void variant_irq_disable(unsigned int irq) { }
 #endif

What was the reason for this change? We shouldn't require all processor variants to provide an irq.h header file, unless required (and we wouldn't need to add the following files)

Let me quote a few more lines of that hunk:

Quoted 4 lines

arch/xtensa/include/asm/irq.h line 26

Quoted 4 lines
arch/xtensa/include/asm/irq.h +3 -0
+#ifndef VARIANT_NR_IRQS
+# define VARIANT_NR_IRQS 0
+#endif

Where can a variant define VARIANT_NR_IRQS if not inside a new header? Do you prefer it being defined in core.h, tie.h, or tie-asm.h?

I think this boils down to the restructuring necessary in arch/xtensa that will draw a line between the Xtensa core and a SoC featuring that core (as it was described by Marc on March 31 on the linux-xtensa list). Of course a "core" will never need any IRQs beyond XTENSA_NR_IRQS.

Another possibility would be to select VARIANT_IRQ_SWITCH (or a dedicated new Kconfig option) in all SoCs that need additional IRQs.

Daniel

Signature · 6 lines
Dipl.-Math. Daniel Glöckner, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax -11, Bahnhofsallee 1b, 37081 Göttingen, Germany
Geschäftsführung: Dr. Uwe Kracke, Dr. Cord Seele, Ust-IdNr.: DE 205 198 055
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160

emlix - your embedded linux partner
#12 lore raw

PATCH 10/12 xtensa: support s6000 gpio irqs and alternate function selection

In reply to Johannes Weiner

From: Daniel Glöckner <[email protected]>

Implement an irq chip to handle interrupts via gpio. The GPIO chip initialization function now takes a bitmask denoting pins that should be configured for their alternate function.

---
 arch/xtensa/include/asm/gpio.h                    |    8 +-
 arch/xtensa/platforms/s6105/setup.c               |    2 +-
 arch/xtensa/variants/s6000/gpio.c                 |  163 ++++++++++++++++++++-
 arch/xtensa/variants/s6000/include/variant/gpio.h |    2 +-
 4 files changed, 168 insertions(+), 7 deletions(-)
arch/xtensa/include/asm/gpio.h +4 -4
index 0763b07..a8c9fc4 100644
@@ -38,14 +38,14 @@ static inline int gpio_cansleep(unsigned int gpio)
 	return __gpio_cansleep(gpio);
 }
 
-/*
- * Not implemented, yet.
- */
 static inline int gpio_to_irq(unsigned int gpio)
 {
-	return -ENOSYS;
+	return __gpio_to_irq(gpio);
 }
 
+/*
+ * Not implemented, yet.
+ */
 static inline int irq_to_gpio(unsigned int irq)
 {
 	return -EINVAL;
arch/xtensa/platforms/s6105/setup.c +1 -1
index 855ddea..95fa23c 100644
@@ -49,7 +49,7 @@ void __init platform_setup(char **cmdline)
 
 void __init platform_init(bp_tag_t *first)
 {
-	s6_gpio_init();
+	s6_gpio_init(0);
 	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 +162 -1

196 lines not on this page · raw message

arch/xtensa/variants/s6000/include/variant/gpio.h +1 -1
index 8327f62..8484ab0 100644
@@ -1,6 +1,6 @@
 #ifndef _XTENSA_VARIANT_S6000_GPIO_H
 #define _XTENSA_VARIANT_S6000_GPIO_H
 
-extern int s6_gpio_init(void);
+extern int s6_gpio_init(u32 afsel);
 
 #endif /* _XTENSA_VARIANT_S6000_GPIO_H */
Signature · 1 line
1.6.2.107.ge47ee
#13 lore raw

PATCH 11/12 xtensa: s6105 specific configuration for s6gmac

In reply to Johannes Weiner

From: Oskar Schirmer <[email protected]>

Platform-specific configuration for the s6gmac driver, including the PHY interrupt line.

---
 arch/xtensa/platforms/s6105/device.c |   91 ++++++++++++++++++++++++++++++++++
 arch/xtensa/platforms/s6105/setup.c  |    9 +++
 2 files changed, 100 insertions(+), 0 deletions(-)
arch/xtensa/platforms/s6105/device.c +91 -0
index 78b08be..963634a 100644
@@ -5,14 +5,27 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/phy.h>
 #include <linux/platform_device.h>
 #include <linux/serial.h>
 #include <linux/serial_8250.h>
 
 #include <variant/hardware.h>
+#include <variant/dmac.h>
 
+#include <platform/gpio.h>
+
+#define GPIO3_INTNUM		3
 #define UART_INTNUM		4
+#define GMAC_INTNUM		5
+
+static const signed char gpio3_irq_mappings[] = {
+	S6_INTC_GPIO(3),
+	-1
+};
 
 static const signed char uart_irq_mappings[] = {
 	S6_INTC_UART(0),
@@ -20,8 +33,18 @@ static const signed char uart_irq_mappings[] = {
 	-1,
 };
 
+static const signed char gmac_irq_mappings[] = {
+	S6_INTC_GMAC_STAT,
+	S6_INTC_GMAC_ERR,
+	S6_INTC_DMA_HOSTTERMCNT(0),
+	S6_INTC_DMA_HOSTTERMCNT(1),
+	-1
+};
+
 const signed char *platform_irq_mappings[NR_IRQS] = {
+	[GPIO3_INTNUM] = gpio3_irq_mappings,
 	[UART_INTNUM] = uart_irq_mappings,
+	[GMAC_INTNUM] = gmac_irq_mappings,
 };
 
 static struct plat_serial8250_port serial_platform_data[] = {
@@ -46,6 +69,66 @@ static struct plat_serial8250_port serial_platform_data[] = {
 	{ },
 };
 
+static struct resource s6_gmac_resource[] = {
+	{
+		.name   = "mem",
+		.start  = (resource_size_t)S6_REG_GMAC,
+		.end    = (resource_size_t)S6_REG_GMAC + 0x10000 - 1,
+		.flags  = IORESOURCE_MEM,
+	},
+	{
+		.name   = "dma",
+		.start  = (resource_size_t)
+			DMA_CHNL(S6_REG_HIFDMA, S6_HIFDMA_GMACTX),
+		.end    = (resource_size_t)
+			DMA_CHNL(S6_REG_HIFDMA, S6_HIFDMA_GMACTX) + 0x100 - 1,
+		.flags  = IORESOURCE_DMA,
+	},
+	{
+		.name   = "dma",
+		.start  = (resource_size_t)
+			DMA_CHNL(S6_REG_HIFDMA, S6_HIFDMA_GMACRX),
+		.end    = (resource_size_t)
+			DMA_CHNL(S6_REG_HIFDMA, S6_HIFDMA_GMACRX) + 0x100 - 1,
+		.flags  = IORESOURCE_DMA,
+	},
+	{
+		.name   = "io",
+		.start  = (resource_size_t)S6_MEM_GMAC,
+		.end    = (resource_size_t)S6_MEM_GMAC + 0x2000000 - 1,
+		.flags  = IORESOURCE_IO,
+	},
+	{
+		.name   = "irq",
+		.start  = (resource_size_t)GMAC_INTNUM,
+		.flags  = IORESOURCE_IRQ,
+	},
+	{
+		.name   = "irq",
+		.start  = (resource_size_t)PHY_POLL,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+static int __init prepare_phy_irq(int pin)
+{
+	int irq;
+	if (gpio_request(pin, "s6gmac_phy") < 0)
+		goto fail;
+	if (gpio_direction_input(pin) < 0)
+		goto free;
+	irq = gpio_to_irq(pin);
+	if (irq < 0)
+		goto free;
+	if (set_irq_type(irq, IRQ_TYPE_LEVEL_LOW) < 0)
+		goto free;
+	return irq;
+free:
+	gpio_free(pin);
+fail:
+	return PHY_POLL;
+}
+
 static struct platform_device platform_devices[] = {
 	{
 		.name = "serial8250",
@@ -54,12 +137,20 @@ static struct platform_device platform_devices[] = {
 			.platform_data = serial_platform_data,
 		},
 	},
+	{
+		.name = "s6gmac",
+		.id = 0,
+		.resource = s6_gmac_resource,
+		.num_resources = ARRAY_SIZE(s6_gmac_resource),
+	},
 };
 
 static int __init device_init(void)
 {
 	int i;
 
+	s6_gmac_resource[5].start = prepare_phy_irq(GPIO_PHY_IRQ);
+
 	for (i = 0; i < ARRAY_SIZE(platform_devices); i++)
 		platform_device_register(&platform_devices[i]);
 	return 0;
arch/xtensa/platforms/s6105/setup.c +9 -0
index 95fa23c..86ce730 100644
@@ -35,12 +35,21 @@ void __init platform_setup(char **cmdline)
 {
 	unsigned long reg;
 
+	reg = readl(S6_REG_GREG1 + S6_GREG1_PLLSEL);
+	reg &= ~(S6_GREG1_PLLSEL_GMAC_MASK << S6_GREG1_PLLSEL_GMAC |
+		S6_GREG1_PLLSEL_GMII_MASK << S6_GREG1_PLLSEL_GMII);
+	reg |= S6_GREG1_PLLSEL_GMAC_125MHZ << S6_GREG1_PLLSEL_GMAC |
+		S6_GREG1_PLLSEL_GMII_125MHZ << S6_GREG1_PLLSEL_GMII;
+	writel(reg, S6_REG_GREG1 + S6_GREG1_PLLSEL);
+
 	reg = readl(S6_REG_GREG1 + S6_GREG1_CLKGATE);
 	reg &= ~(1 << S6_GREG1_BLOCK_SB);
+	reg &= ~(1 << S6_GREG1_BLOCK_GMAC);
 	writel(reg, S6_REG_GREG1 + S6_GREG1_CLKGATE);
 
 	reg = readl(S6_REG_GREG1 + S6_GREG1_BLOCKENA);
 	reg |= 1 << S6_GREG1_BLOCK_SB;
+	reg |= 1 << S6_GREG1_BLOCK_GMAC;
 	writel(reg, S6_REG_GREG1 + S6_GREG1_BLOCKENA);
 
 	printk(KERN_NOTICE "S6105 on Stretch S6000 - "
Signature · 1 line
1.6.2.107.ge47ee
#14 lore raw

PATCH 12/12 xtensa: enable s6gmac in s6105_defconfig

In reply to Johannes Weiner

From: Daniel Glöckner <[email protected]>

---
 arch/xtensa/configs/s6105_defconfig |   49 ++++++++++++++++++++++++++++++++++-
 1 files changed, 48 insertions(+), 1 deletions(-)
arch/xtensa/configs/s6105_defconfig +48 -1
index 768bee0..a1eca01 100644
@@ -263,7 +263,54 @@ CONFIG_HAVE_IDE=y
 # CONFIG_SCSI_NETLINK is not set
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
-# CONFIG_NETDEVICES is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_VETH is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+# CONFIG_MARVELL_PHY is not set
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+# CONFIG_LXT_PHY is not set
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+CONFIG_SMSC_PHY=y
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
+# CONFIG_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
+# CONFIG_NET_ETHERNET is not set
+CONFIG_NETDEV_1000=y
+CONFIG_S6GMAC=y
+# CONFIG_NETDEV_10000 is not set
+
+#
+# Wireless LAN
+#
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
Signature · 1 line
1.6.2.107.ge47ee
maintainer
#15 lore raw

Re: Xtensa patches

In reply to Johannes Weiner

Hi Andrew,

I will look over those patches and commit them to xtensa-2.6.

Thanks,
-Chris

Quoted 7 lines · Johannes Weiner

Hi Andrew,

these are fixes and dependency patches for xtensa code in mainline and your tree that came in during this merge window.

Thanks,
Hannes

#16 lore raw

Re: Xtensa patches

Quoted 4 lines · On Thu, 16 Apr 2009 00:42:13 -0700 Chris Zankel <[email protected]> wrote:

Hi Andrew,

I will look over those patches and commit them to xtensa-2.6.

OK. I have a random pile if i-dont-know-what xtensa stuff here.

xtensa-add-flat-support-checkpatch-fixes.patch xtensa-variant-specific-code.patch xtensa-cache-inquiry-and-unaligned-cache-handling-functions.patch xtensa-s6000-dma-engine-support.patch xtensa-allow-platform-and-variant-to-initialize-own-irq-chips.patch xtensa-support-s6000-gpio-irqs-and-alternate-function-selection.patch s6gmac-xtensa-s6000-on-chip-ethernet-driver.patch s6gmac-xtensa-s6000-on-chip-ethernet-driver-fix.patch xtensa-s6105-specific-configuration-for-s6gmac.patch xtensa-enable-s6gmac-in-s6105_defconfig.patch xtensa-add-m41t62-rtc-to-s6105-platform.patch xtensa-enable-m41t80-driver-in-s6105_defconfig.patch

I'll drop xtensa-add-flat-support-checkpatch-fixes.patch (as I usually do when someone merges the base patch but doesn't run checkpatch on it
- hint) and I'll send the rest over at you.

#17 lore raw

Re: Xtensa patches

Quoted 22 lines · Andrew Morton
Quoted 4 lines · On Thu, 16 Apr 2009 00:42:13 -0700 Chris Zankel <[email protected]> wrote:

Hi Andrew,

I will look over those patches and commit them to xtensa-2.6.

OK. I have a random pile if i-dont-know-what xtensa stuff here.

xtensa-add-flat-support-checkpatch-fixes.patch xtensa-variant-specific-code.patch xtensa-cache-inquiry-and-unaligned-cache-handling-functions.patch xtensa-s6000-dma-engine-support.patch xtensa-allow-platform-and-variant-to-initialize-own-irq-chips.patch xtensa-support-s6000-gpio-irqs-and-alternate-function-selection.patch s6gmac-xtensa-s6000-on-chip-ethernet-driver.patch s6gmac-xtensa-s6000-on-chip-ethernet-driver-fix.patch xtensa-s6105-specific-configuration-for-s6gmac.patch xtensa-enable-s6gmac-in-s6105_defconfig.patch xtensa-add-m41t62-rtc-to-s6105-platform.patch xtensa-enable-m41t80-driver-in-s6105_defconfig.patch

Quoted 4 lines

I'll drop xtensa-add-flat-support-checkpatch-fixes.patch (as I usually do when someone merges the base patch but doesn't run checkpatch on it
- hint) and I'll send the rest over at you.

Presumably the nommu xtensa bits still depend on

flat-fix-data-sections-alignment.patch

?

#18 lore raw

Re: Xtensa patches

Quoted 27 lines · On Thu, 16 Apr 2009 17:30:00 +0900 Paul Mundt <[email protected]> wrote:
Quoted 22 lines · Andrew Morton
Quoted 4 lines · On Thu, 16 Apr 2009 00:42:13 -0700 Chris Zankel <[email protected]> wrote:

Hi Andrew,

I will look over those patches and commit them to xtensa-2.6.

OK. I have a random pile if i-dont-know-what xtensa stuff here.

xtensa-add-flat-support-checkpatch-fixes.patch xtensa-variant-specific-code.patch xtensa-cache-inquiry-and-unaligned-cache-handling-functions.patch xtensa-s6000-dma-engine-support.patch xtensa-allow-platform-and-variant-to-initialize-own-irq-chips.patch xtensa-support-s6000-gpio-irqs-and-alternate-function-selection.patch s6gmac-xtensa-s6000-on-chip-ethernet-driver.patch s6gmac-xtensa-s6000-on-chip-ethernet-driver-fix.patch xtensa-s6105-specific-configuration-for-s6gmac.patch xtensa-enable-s6gmac-in-s6105_defconfig.patch xtensa-add-m41t62-rtc-to-s6105-platform.patch xtensa-enable-m41t80-driver-in-s6105_defconfig.patch

Quoted 4 lines

I'll drop xtensa-add-flat-support-checkpatch-fixes.patch (as I usually do when someone merges the base patch but doesn't run checkpatch on it
- hint) and I'll send the rest over at you.

Quoted 5 lines

Presumably the nommu xtensa bits still depend on

flat-fix-data-sections-alignment.patch

?

I don't think I ever knew that.

What's happening with flat-fix-data-sections-alignment.patch, btw? It seems to be stuck.

#19 lore raw

Re: Xtensa patches

Quoted 21 lines · Andrew Morton
Quoted 20 lines · On Thu, 16 Apr 2009 17:30:00 +0900 Paul Mundt <[email protected]> wrote:
Quoted 19 lines · Andrew Morton

OK. I have a random pile if i-dont-know-what xtensa stuff here.

xtensa-add-flat-support-checkpatch-fixes.patch xtensa-variant-specific-code.patch xtensa-cache-inquiry-and-unaligned-cache-handling-functions.patch xtensa-s6000-dma-engine-support.patch xtensa-allow-platform-and-variant-to-initialize-own-irq-chips.patch xtensa-support-s6000-gpio-irqs-and-alternate-function-selection.patch s6gmac-xtensa-s6000-on-chip-ethernet-driver.patch s6gmac-xtensa-s6000-on-chip-ethernet-driver-fix.patch xtensa-s6105-specific-configuration-for-s6gmac.patch xtensa-enable-s6gmac-in-s6105_defconfig.patch xtensa-add-m41t62-rtc-to-s6105-platform.patch xtensa-enable-m41t80-driver-in-s6105_defconfig.patch

I'll drop xtensa-add-flat-support-checkpatch-fixes.patch (as I usually do when someone merges the base patch but doesn't run checkpatch on it
- hint) and I'll send the rest over at you.

Quoted 8 lines
Quoted 5 lines

Presumably the nommu xtensa bits still depend on

flat-fix-data-sections-alignment.patch

?

I don't think I ever knew that.

http://lkml.org/lkml/2009/4/9/241

Quoted 3 lines

What's happening with flat-fix-data-sections-alignment.patch, btw? It seems to be stuck.

As far as I know it was just waiting on Mike to comment, as he was the only other one with concerns. Mike?

#20 lore raw

Re: Xtensa patches

In reply to Andrew Morton

Hi Chris,

Quoted 9 lines · On Thu, 16 Apr 2009 01:24:47 -0700 Andrew Morton <[email protected]>…
Quoted 4 lines · On Thu, 16 Apr 2009 00:42:13 -0700 Chris Zankel <[email protected]> wrote:

Hi Andrew,

I will look over those patches and commit them to xtensa-2.6.

OK. I have a random pile if i-dont-know-what xtensa stuff here.

Interestingly, there is an xtensa tree in linux-next that tracks the master branch of
git://git.kernel.org/pub/scm/linux/kernel/git/czankel/xtensa-next.git.
It hasn't been updated since January ...

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
maintainer
#21 lore raw

Re: Xtensa patches

Hi Stephen,

Quoted 5 lines · Stephen Rothwell
Quoted 4 lines · On Thu, 16 Apr 2009 01:24:47 -0700 Andrew Morton <[email protected]>…
Quoted 2 lines · On Thu, 16 Apr 2009 00:42:13 -0700 Chris Zankel <[email protected]> wrote:

Hi Andrew,

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

I will look over those patches and commit them to xtensa-2.6.

OK. I have a random pile if i-dont-know-what xtensa stuff here.

Interestingly, there is an xtensa tree in linux-next that tracks the master branch of
git://git.kernel.org/pub/scm/linux/kernel/git/czankel/xtensa-next.git.
It hasn't been updated since January ...

Should be updated now. There are a ton of patches outstanding, but they are tracked in a different tree somewhere else and require some heavy lifting to clean up.

What 'random pile' do you still have there that hasn't been merged, yet?

Thanks,
-Chris